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
#4
RE: Check if a player is inside a script area?

(03-06-2012, 04:54 PM)Unearthlybrutal Wrote:
Spoiler below!
void OnStart()
{
SetLocalVarInt("bank", 0);
AddEntityCollideCallback("player", "scriptarea", "function", false, 1);
AddEntityCollideCallback("player", "scriptarea", "function", false, -1);
}

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

Or:
Spoiler below!

void OnStart()
{
SetLocalVarInt("bank", 0);
AddEntityCollideCallback("player", "scriptarea", "function", false, 1);
AddEntityCollideCallback("player", "scriptarea", "function", false, -1);
}

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

SetLocalVarInt("bank ", 0);
}

So, you need to use SetLocalVarInt(name, val) every time you need to change the value of a variable? I was hoping it was enough like javascript that you could just set it by referencing the name and giving it a value. My apologies for poor practise OP!

03-06-2012, 05:45 PM
Find


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



Users browsing this thread: 1 Guest(s)