• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Triggers- Random %'s using integers...

Status
Not open for further replies.
Level 8
Joined
Jul 9, 2004
Messages
405
someone said you can use integers for a % chance to do something... i see the part that says for each integer "1-10" do actions, but how do i have it choose the integer between ... say 1-30?
 
Level 8
Joined
Jul 9, 2004
Messages
405
lol that would be cool... like dice !

i did have another way to make random chances like that, make however regions to equal the %chance u need (25% would be 4) make them same size and space them apart fairly large, order a unit to patrol from the middle of one to the middle of the one on the other edge, use conditions like unit in region equal to true. spacing is critical along the units speed. also make the unit unselectable. :D
 
Level 7
Joined
Jul 30, 2004
Messages
451
um, for X to Y is a loop, which means it uses each and every number

you're looking for the function
random integer between X and Y
or
random real between X.x and Y.y

to make a bi-random statement u use an if statement
if (random integer between 1 and 3) < 2 then
"you got low 66%"
else
"you got high 33%"

as for multiple choices you need to store the random number in a variable first and then do the same checks to the variable

o, and theres also the option of using the function
random percent
which gives u a number between 0.00 and 1.00
 
Level 7
Joined
Jul 30, 2004
Messages
451
RaD- said:
hehe can you say that again in english plz? im not to good at % chances variables etc so i got NO idea what your talking about :lol:

ok, look for the function called Math - Random Integer or something like that, it looks like
(Random integer number between 1 and 10)
once u use it

what this function does is return a random integer between 1 and 10

so,
set varX = random integer number between 1 and 3
if varX == 1 then "YOU GOT ONE"
if varX == 2 then "YOU GOT TWO"
if varX == 3 then "YOU GOT THREE"

alternatively, theres
(Random percentage)

which gives u a number between 0.00 and 100.00
 
Status
Not open for further replies.
Top