Using math.random function in timers [Solved]

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Using math.random function in timers [Solved]

Post by Noobasaurus »

How would one get a random timer value between two numbers? Say you want it between 500 and 600...how would you do that in a timer?
Last edited by Noobasaurus on Sat Oct 29, 2011 9:13 pm, edited 1 time in total.
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Using math.random function in timers

Post by DarthD.U.C.K. »

have you tried that?

Code: Select all

duration = math.random(500,600)
SetTimerValue(timername, duration)
User avatar
DarthXeon
Banned
Posts: 84
Joined: Mon Sep 19, 2011 5:41 pm
Projects :: I move fast... Lightning fast...
Games I'm Playing :: Hmm... I wonder...
Location: In A Nearby Solar System

Re: Using math.random function in timers

Post by DarthXeon »

i wanna see what your trying to make with the timer noobasarus i bet its something cool :)
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Using math.random function in timers

Post by Noobasaurus »

DarthD.U.C.K. wrote:have you tried that?

Code: Select all

duration = math.random(500,600)
SetTimerValue(timername, duration)
No I haven't, thanks. Trying it right now.
DarthXeon wrote:i wanna see what your trying to make with the timer noobasarus i bet its something cool :)
It's something for the hard mode on Gamorrean Attack...so that you can't time it...

EDIT: Yup, it works, thanks. :)
Post Reply