Well I'm wondering how to make a timer for my mod for example...
if timer = 5
do this
else if timer = 10
do something else
I'm stumped at the moment but if anyone can help me that'd be awesome thanks
(12-05-2012, 11:14)AZUMIKKEL Wrote: [ -> ]Code:
Init()
{
level thread Timer("timer1", 25);
level thread Effect();
}
Timer(name, time)
{
for(level.timer[name]=time;level.timer[name]>0;level.timer[name]--)
{
wait 1;
}
}
Effect()
{
if(level.timer[timer1] > 15)
{
//dostuff
}
}
Thank you so so so much!
*edit*
I get an error;\
ERROR: script compile error
uninitialised variable 'timer1'
maps/mp/gametypes/_rank.gsc
(see console for actual details)
I'm new to modding.-.
@
AZUMIKKEL That isn't going to work, it's just going to exit the Effect function/sub straight away....
Of course it is, the effect thread is an example...
Yes but to make it keep checking can't i just put wait 1; in the effect as well?
Code:
Effect()
{
for(;;)
{
if(level.timer["timer1"] > 15)
{
//dostuff
}
wait 0.5;
}
}
Every coding language 101..
I was just making sure...