Page 1 of 1

Howto-Make an advanced timer

PostPosted: Wed Jun 10, 2009 5:57 am
by Hblade
Advanced Timer
    Written by Hblade

Step 1
    Programming the timer
Open up Global code and put this code in it
Code: Select all
int framecount;
void Wait(int f)
{
    framecount = framecount + 1;
    if (framecount == f)
    {
        switch(temp)
        case 0:
        temp = 1;
        framecount = 0;
    }
}

Make a variable and call it temp, make it an actor variable

Step 2
    Using the timer
Open up the actor you wan't the timer to apply to, then click Draw Actor - Script editor, then put this code in
Code: Select all
Wait(189);
if (temp == 1)
{
enter your code
}

It wil wait for 189 frames then it will initiate the code

Re: Howto-Make an advanced timer

PostPosted: Wed Jun 10, 2009 6:27 am
by Fuzzy
Nicely done.

Re: Howto-Make an advanced timer

PostPosted: Wed Jun 10, 2009 6:40 am
by skydereign
Why not implement two actor variables, since you are already using one? That way any actor can call the function, and framecount won't get confused. Just switch framecount to an actor variable. It wouldn't hurt efficiency, as only actors with the function call would have a changing framecount.

Re: Howto-Make an advanced timer

PostPosted: Fri Jun 12, 2009 6:41 am
by Hblade
Nice sky