first time using rand(), requested cog by spiral:
Thanks to Greven who helped out with the multiply-by-30 deal.. it took me a few minutes to understand how to use rand effectively - I don't think my brain functions well late at night.
Edit: Had outdated version posted..
[This message has been edited by Jipe (edited July 06, 2001).]
Code:
symbols
message startup
message timer
message pulse
thing soundlocation=
sound thundersound=
flex volume=
flex mindistance=
flex maxdistance=
flex random local
end
code
startup:
random = Rand() * 30;
SetPulse(0.1);
return;
timer:
if(GetSenderID() == 5678)
{
PlaySoundPos(thundersound, GetThingPos(soundlocation), volume, mindistance, maxdistance, 0x40);
random = Rand() * 30;
SetPulse(0.1);
}
return;
pulse:
if(random < 10)
{
random = Rand() * 30;
}
else
if(random >= 10)
{
SetTimerEx(random, 5678, 0, 0);
SetPulse(0.0);
}
return;
endThanks to Greven who helped out with the multiply-by-30 deal.. it took me a few minutes to understand how to use rand effectively - I don't think my brain functions well late at night.
Edit: Had outdated version posted..
[This message has been edited by Jipe (edited July 06, 2001).]