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
Preventing scripts from repeating
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#4
RE: Preventing scripts from repeating

It doesn't matter if you leave a map and then come back to it, it would still work if it is set to false, else if it is true, then it would only happen once. If you wanted to have it only work when you are in that map, and if you leave it and come back, you could have it stop working. For example:

void OnStart()
{
     SetLocalVarInt("Var01", 0);
     AddEntityCollideCallback("Player", "ScriptArea_1", "Func01", true, 1);
}
void Func01(string &in asParent, string &in asChild, int alState)
{
     if (GetLocalVarInt("Var01") == 0)
     {
          //Do whatever you want to happen here.
          Func02();
     }
}
void Func02()
{
     AddEntityCollideCallback("Player", "ScriptArea_1", "Func01", true, 1);
}
void OnLeave()
{
     SetLocalVarInt("Var01", 1);
}

If you notice in the script above, I set it to "true" for the AddEntityCollideCallback command functions. There are ways like this that don't require for it to be "true".

(This post was last modified: 08-17-2011, 05:59 PM by Kyle.)
08-17-2011, 05:57 PM
Find


Messages In This Thread
Preventing scripts from repeating - by rybray - 08-17-2011, 04:16 PM
RE: Preventing scripts from repeating - by Kyle - 08-17-2011, 04:30 PM
RE: Preventing scripts from repeating - by rybray - 08-17-2011, 05:46 PM
RE: Preventing scripts from repeating - by Kyle - 08-17-2011, 05:57 PM
RE: Preventing scripts from repeating - by rybray - 08-17-2011, 09:12 PM
RE: Preventing scripts from repeating - by Acies - 08-18-2011, 12:01 AM



Users browsing this thread: 1 Guest(s)