• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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