HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Why won't Random number generate anything but 7?

10-27-2003, 07:13 PM#1
Biflspud
I'm stumped on why the Random Number between x and y function seems to ALWAYS go for the same number. Each time my map-in-progress generates a random number, it's always the same one.

I've turned off the "Fixed random number seed" option, and tried both testing the map and loading it through Warcraft; same results each time -- "random" event after "random" event comes up with the same thing happening. Adding more random number generating statements simply sets the number to something else -- 7 instead of 5, but always 7's, no matter how many iterations.

Anybody got a random function that actually does its job?
10-27-2003, 07:29 PM#2
MartinezTG
I bet your using "Test Map" cuz it always generates the same number.

You can turn that off in your WE Options.

Martinez
10-27-2003, 07:31 PM#3
Biflspud
Quote:
Originally posted by MartinezTG
I bet your using "Test Map" cuz it always generates the same number.
Not to be rude, Martinez, but I said clearly in my post that opening it in Warcraft *still* keeps generating the same #.
10-27-2003, 07:37 PM#4
MartinezTG
OOPS! Big sorry for that. Too fast answer I guess. Could you copy the trigger or the function in which you make it cuz I can't think of anything that could cause the problem. My random generated numbers always worked.

Martinez
10-27-2003, 07:45 PM#5
Biflspud
Hey, it's no biggie, thanks for checking back.

Set RandomInteger = (Random integer number between 1 and 7)
Game - Display to (All players) the text: (I just generated the random number: + (String(RandomInteger)))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomInteger Equal to 7
Then - Actions
Trigger - Run Tornado spawn <gen> (ignoring conditions)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomInteger Equal to 6
...

Essentially, there are 7 if/thens, non-nested, checking to see if the number that just generated applies to them or not. There's a previous random # generator in this trigger that burps out game messages; I don't recall if it always favors the same # as well. But this one ALWAYS goes for 5.
10-27-2003, 07:47 PM#6
Draco
In WE options, just set it to use a random seed, instead of fixed. Then try a test map.

Also, maybe a wait .01 seconds after you set the variable?
10-27-2003, 08:00 PM#7
Biflspud
Hey! That worked! Thanks, Draco - I had already unchecked "Fixed # seed," but oddly, the wait did the trick.

Why, I don't know. But I'm not likely to complain. emote_confused
10-27-2003, 08:15 PM#8
Draco
The game prolly didnt have enough time to change the value and display the new one.