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
Need help with a script (again)
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#10
RE: Need help with a script (again)

It won't work, let me clarify it for you:

void OnStart ()
{
AddEntityCollideCallback("box1","area_red","BOX1RED", false, 1);
}

void BOX1RED(string &in asParent, string &in asChild, int alState)
{if(asChild == "area_red") {
SetLightVisible("redy", true);
// "redy" is a pointlight
}
else SetLightVisible("redy", false);
}

1. the alState in AddEntityCollideCallback doesn't mean - "1" means that the "BOX1RED" runs on collide (-1 runs when they're not colliding) - it means alStates = 1=only call when entity enters, -1=only call when entity leaves 0=both
2. a solution to your problem I can think of is:

void OnStart ()
{
AddEntityCollideCallback("box1","area_red","BOX1RED", false, 0);
SetLocalVarInt("RedLightOn", 1);
}

void BOX1RED(string &in asParent, string &in asChild, int alState)
{
//Why this? Do you want to trigger this function from multiple areas? If not, remove it.
if(asChild == "area_red") {
if(GetLocalVarInt("RedLightOn") == 1) SetLocalVarInt("RedLightOn", 0);
else SetLocalVarInt("RedLightOn", 1);

if(GetLocalVarInt("RedLightOn") == 1) SetLightVisible("redy", true);
else SetLightVisible("redy", false);
}
}

Could have made the script much easier if the game had local booleans though.

09-22-2010, 09:12 PM
Find


Messages In This Thread
Need help with a script (again) - by Akasu - 09-22-2010, 08:03 PM
RE: Need help with a script (again) - by gosseyn - 09-22-2010, 08:11 PM
RE: Need help with a script (again) - by Akasu - 09-22-2010, 08:17 PM
RE: Need help with a script (again) - by gosseyn - 09-22-2010, 08:23 PM
RE: Need help with a script (again) - by Akasu - 09-22-2010, 08:32 PM
RE: Need help with a script (again) - by gosseyn - 09-22-2010, 08:35 PM
RE: Need help with a script (again) - by Akasu - 09-22-2010, 08:38 PM
RE: Need help with a script (again) - by gosseyn - 09-22-2010, 08:47 PM
RE: Need help with a script (again) - by Akasu - 09-22-2010, 09:05 PM
RE: Need help with a script (again) - by Pandemoneus - 09-22-2010, 09:12 PM
RE: Need help with a script (again) - by Akasu - 09-22-2010, 09:25 PM
RE: Need help with a script (again) - by jens - 09-23-2010, 06:34 AM
RE: Need help with a script (again) - by Akasu - 09-23-2010, 10:44 AM



Users browsing this thread: 1 Guest(s)