Jump to content
Sign in to follow this  
jeppelykke

Random calulation script

Recommended Posts

Hey Hey biggrin.gif

Anyone able to write me a random calulation script! It quite simple:

I need a script that randoms pick a number from 1-10 smile.gif

and set it to a _mission

I need for if _mission = 1 : goto "mission1"

#mission1

Am trying to work out a random "action" map, so that each time you play it, it randoms picks 1 out of 10 ways for enermy to complete it's mission! biggrin.gif

Share this post


Link to post
Share on other sites

Hi,

try the following, it should do the trick (I calculate a number ranging 0,...,9 which is equivalent to yours)

;;;;;;;;;;;;;;;;;;;

;this is a float random number ranging from 0 to 9.99999999

_mission = random 9.999999999

;this should transform it into a integer random number 0,1,...,9

_mission = _mission - (_mission mod 1)

;this then jumps to the appropriate subroutine

goto format ["mission%1", _mission]

#mission0

....

exit

#mission1

......

;;;;;;;;;;;;;;;;;

Hope this helps,

Spinor

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×