Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help This won't work for some reason...
ElectricRed Offline
Member

Posts: 106
Threads: 13
Joined: Jun 2012
Reputation: 5
#1
This won't work for some reason...

I wrote a simple script and for some reason it's not working. I've tried everything. (Yes, I double checked the name of the area in the level editor. Tongue )

void OnStart()
{
AddEntityCollideCallback("Player", "AreaSeeMonster", "SeeMonster", true, 1);
}

void SeeMonster(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("monster_1");
    StartPlayerLookAt("monster_1", 2.0f, 2.0f, "");
    GiveSanityDamage(15, true);
    AddDebugMessage("SeeMonster", false);
}

I get no errors when loading the map or anything. It just doesn't work. The debug message doesn't show up either. Is there a reason why this could be happening?

Thanks.
07-11-2012, 07:47 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#2
RE: This won't work for some reason...

Everything in your script appears to be correct. Is the name of the .hps file the same as the .map file? Are they located in the same folder? Is the area "AreaSeeMonster" active in the level editor?

Also, if you have a .cache file in the same folder as your map, delete it. It prevents changes in the level editor from appearing in game; perhaps its preventing the script area from appearing altogether. Oh, and add OnEnter/OnLeave functions to your hps file as well.

Those are all of the immediate problems/fixes I can think of. Good luck.

I rate it 3 memes.
07-11-2012, 08:43 PM
Find
ElectricRed Offline
Member

Posts: 106
Threads: 13
Joined: Jun 2012
Reputation: 5
#3
RE: This won't work for some reason...

Well, there are other scripts in the map that are working fine. It's just this one that isn't working, so I figured it was the script itself. I tried deleting the map cache, but nothing happened. The area is active in the level editor.

Thanks for the response.
07-11-2012, 09:13 PM
Find
Rapture Offline
Posting Freak

Posts: 1,078
Threads: 79
Joined: May 2011
Reputation: 30
#4
RE: This won't work for some reason...

Make sure the Area name is called "AreaSeeMonster"
07-11-2012, 09:17 PM
Find
ElectricRed Offline
Member

Posts: 106
Threads: 13
Joined: Jun 2012
Reputation: 5
#5
RE: This won't work for some reason...

Yeah it is...

Okay, so I messed around with a ton of stuff, including just rewriting the script from scratch, and somehow it started working. I have no idea how or why, but at least it's fixed! Thanks for the help. >.<
07-11-2012, 09:26 PM
Find
Omyn Offline
Junior Member

Posts: 13
Threads: 2
Joined: Jul 2012
Reputation: 0
#6
RE: This won't work for some reason...

(07-11-2012, 09:26 PM)ElectricRed Wrote: Yeah it is...

Okay, so I messed around with a ton of stuff, including just rewriting the script from scratch, and somehow it started working. I have no idea how or why, but at least it's fixed! Thanks for the help. >.<
I noticed you missed the end } in SeeMonster. Not sure if you just missed that when you copy pasted. Glad to see you got it resolved tho.
(This post was last modified: 07-13-2012, 02:59 PM by Omyn.)
07-13-2012, 02:57 PM
Find




Users browsing this thread: 2 Guest(s)