| 04-06-2007, 11:18 AM | #1 |
I need a fairly reliable way to get a random integer for use in a race selection trigger. Right now I've a temporary integer variable which I set to a random value using the "Math - Random.." thing. But I always get the same race when I test. How do I make it more random? ;) |
| 04-06-2007, 11:26 AM | #2 |
File->preferences->Test Map tab->uncheck "Use Fixed Random Seed" |
| 04-06-2007, 11:35 AM | #3 |
It is already unchecked :/ |
| 04-06-2007, 11:58 AM | #4 |
If it's already unchecked, it's probably a problem with the trigger rather than the random number. Just use BJDebugMsg to display the random number, and if it's the same repeatedly, then you'll know if the random number is actually at fault. |
| 04-06-2007, 12:35 PM | #5 |
Try testing from within WC3 itself anyway. Also be warned that if there is some cinematic mode thing that will set your random seed to a constant value, so this might be an issue if you use any cinematic stuff. |
| 04-06-2007, 03:32 PM | #7 |
Trigger: ![]() If (All Conditions are True) then do (Then Actions) else do (Else Actions)![]() If - Conditions![]() (Clicked dialog button) Equal to DialogButton[5]![]() Then - Actions![]() Set TempInteger = (Random integer number between 1 and 4)![]() If (TempInteger Equal to 1) then do (Melee Game - Create Human starting units for (Triggering player) at ((Triggering player) start location) (Include Heroes)) else do (Do nothing)![]() If (TempInteger Equal to 2) then do (Melee Game - Create Orc starting units for (Triggering player) at ((Triggering player) start location) (Include Heroes)) else do (Do nothing)![]() If (TempInteger Equal to 3) then do (Melee Game - Create Human starting units for (Triggering player) at ((Triggering player) start location) (Include Heroes)) else do (Do nothing)![]() If (TempInteger Equal to 4) then do (Melee Game - Create Human starting units for (Triggering player) at ((Triggering player) start location) (Include Heroes)) else do (Do nothing)![]() Else - Actionsu have Human three times in there....shouldnt be there all 4 races ?! |
| 04-06-2007, 03:41 PM | #8 |
Oh god, I'm off to kill myself. |
| 04-06-2007, 04:47 PM | #9 |
hah, sometimes it's the simple things that are overlooked first. Dont worry, it has happened to everyone =P |
| 04-06-2007, 08:09 PM | #10 |
Also, hitting the test button in WE will usually give me the same starting random value. Just FYI. |
