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
picking up item activating script area
ApeCake Offline
Member

Posts: 116
Threads: 20
Joined: Jun 2012
Reputation: 4
#4
RE: picking up item activating script area

I prefer this way; put a name in the "PlayerInteractCallback" of your key, I put "ActivateMonsterKey" there.
Then, go to your .hps file and write;

void ActivateMonsterKey(string &in entity)

{
AddEntityCollideCallback("Player", "NameofScriptArea", "nameoffunction", true, 1);
}

void nameoffunction(string &in asParent, string &in asChild, int alState)

{
SetEntityActive("NameofMonster", true);
}

I'm pretty certain that this works. Make sure to set the script area ACTIVE (in the level editor) and the monster INACTIVE.
Explaination (although it is very simple); PlayerInteractCallback activates when the player interacts with the entity. With a door it activates at the moment the player opens the door. However, there is NO other interactivity than picking up with keys. So, when you interact with the key AKA pick it up, this activates the EntityCollideCallback. So, now your script area has a function, before this it was just an invisible wall, but now you gave it code. So, when the player collides with the script area, "nameoffunction" happens. "nameoffunction" sets the monster active thanks to SetEntityActive. I hope that was clear enough, I suck at explaining things.

There are multiple ways (see above posts), but I prefer this one.
(This post was last modified: 07-08-2012, 12:34 PM by ApeCake.)
07-08-2012, 12:28 PM
Find


Messages In This Thread
RE: picking up item activating script area - by ApeCake - 07-08-2012, 12:28 PM



Users browsing this thread: 3 Guest(s)