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
how do timers work?
Mackiiboy Offline
Member

Posts: 101
Threads: 7
Joined: Jan 2012
Reputation: 11
#6
RE: how do timers work?

Something like this would do. Feel free to change all the function/torch names, and modify the timers!
For this, you will need a script area named TorchCollideArea, and a hallway with some torches. When you collide the TorchCollideArea, two torches will be lit every 0,5 second. You can add more / remove some torches, and edit if you want the timers to be called faster/slower :]

void OnStart()
{
    AddEntityCollideCallback("Player", "TorchCollideArea", "TorchFunc", true, 1);
}

void TorchFunc(string &in asParent, string &in asChild, int alState)
{
    AddTimer("T1", 0.0f, "TorchTimer");
    AddTimer("T2", 0.5f, "TorchTimer");
    AddTimer("T3", 1.0f, "TorchTimer");
    AddTimer("T4", 1.5f, "TorchTimer");
}

void TorchTimer(string &in asTimer)
{
    string x = asTimer;
    if (x == "T1")
    {
        SetLampLit("Torch_1", true, true);
        SetLampLit("Torch_2", true, true);
    }
    else if (x == "T2")
    {
        SetLampLit("Torch_2", true, true);
        SetLampLit("Torch_3", true, true);
    }
    else if (x == "T3")
    {
        SetLampLit("Torch_4", true, true);
        SetLampLit("Torch_5", true, true);
    }
    else if (x == "T4")
    {
        SetLampLit("Torch_5", true, true);
        SetLampLit("Torch_6", true, true);
    }
}
.
(07-31-2012, 08:49 PM)Soverain Wrote: Sorry if I am not clear. What I mean by the torches lighting up is that I saw another persons CS where he had a bunch of torches down a hall and they all lit up one by one which i thought was pretty cool
(This post was last modified: 07-31-2012, 09:07 PM by Mackiiboy.)
07-31-2012, 09:02 PM
Website Find


Messages In This Thread
how do timers work? - by Soverain - 07-31-2012, 04:49 AM
RE: how do timers work? - by Mackiiboy - 07-31-2012, 09:56 AM
RE: how do timers work? - by ApeCake - 07-31-2012, 10:45 AM
RE: how do timers work? - by Soverain - 07-31-2012, 08:49 PM
RE: how do timers work? - by Mackiiboy - 07-31-2012, 09:02 PM
RE: how do timers work? - by FlawlessHappiness - 07-31-2012, 08:58 PM
RE: how do timers work? - by Soverain - 07-31-2012, 09:51 PM



Users browsing this thread: 1 Guest(s)