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
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#5
RE: picking up item activating script area

(07-08-2012, 12:28 PM)ApeCake Wrote: 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.
makes perfect sense to me. Thanks Smile
07-08-2012, 10:14 PM
Find


Messages In This Thread
RE: picking up item activating script area - by HoyChampoy - 07-08-2012, 10:14 PM



Users browsing this thread: 1 Guest(s)