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


Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Check if a player is inside a script area?
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#2
RE: Check if a player is inside a script area?

Could be wrong, haven't done any messing with variables in HPS yet, but here we go...

void OnStart()
{
SetLocalVarInt("bank", 0);
AddEntityCollideCallback("player", "scriptarea", "function", [delete?], 1);
AddEntityCollideCallback("player", "scriptarea", "function", [delete?], -1);
}

void function(string &in asParent, string &in asChild, int alState)
{
if (bank == 0)
{ bank = 1; }
else if (bank == 1)
{ bank = 0; }
}

Not sure if you need to have the int name in "" if your referencing it like I have in the 'if' there, but basically when you enter the area the function runs, if it finds the int is 0 it sets it to one. Once the player leave the area the function will run again and if its at 1 it will be set back to 0. You probably dont want those collide callbacks to delete so put false where ive said 'delete?', but I dont know what your trying to do with this so, adapt as required.

Let me know if you get any issues
03-06-2012, 04:47 PM
Find


Messages In This Thread
RE: Check if a player is inside a script area? - by Adrianis - 03-06-2012, 04:47 PM



Users browsing this thread: 1 Guest(s)