• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Set variable = Random integer... NOT random at all?

Status
Not open for further replies.
Level 5
Joined
Feb 24, 2009
Messages
110
This question has been satisfactorily answered, topic can be closed.



Hi there!

I've been using the trigger Action
  • Set Variable = (Random integer number between 1 and 10)
And after testing it out, it ALWAYS shows the numbers in this order
6,1,9,3,10,8,7,2, (3,7, but have been already used), 4, (9,4, but have been already used),5.

Ive tried it 5 times in a row my map, and they always "random" the same way.

I took so long to make my map with a random dynamic system to be different each game, and it happens to be the same each time because the "random factor" is a linear factor instead.

Should I try using Jass instead (i have no idea about jass), or can anyone tell me a way to have random numbers?

here is the whole trigger with loop:

  • Events
    • Time - Every 0.01 seconds of game time
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • MaxNumberComparator Not equal to MaxNumber
      • Then - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ArrayR[var] Not equal to 0
          • Then - Actions
            • Set MaxNumberComparator = (MaxNumberComparator + 1)
            • Trigger - Turn on triggerAsk <gen>
            • Trigger - Turn off (This trigger)
          • Else - Actions
            • Set var = (Random integer number between 1 and MaxNumber)
      • Else - Actions
        • Trigger - Turn on Victory <gen>
        • Trigger - Turn off (This trigger)
MaxNumber = 10
 
Last edited:
Level 26
Joined
Aug 18, 2009
Messages
4,097
When testing the map via the editor, there is a flag that can fixate the results of randomizations. This is useful because if you are in need to debug or only want to test certain parts of your map, random variables could deflect from the problem, making it harder to recognize its determinacy.

You can change the flag:

>>>File >>Presets >Test Map >[ ] Use fixed random starting value

or similar, I do not possess the english version of the editor.
 
Level 5
Joined
Feb 24, 2009
Messages
110
When testing the map via the editor, there is a flag that can fixate the results of randomizations. This is useful because if you are in need to debug or only want to test certain parts of your map, random variables could deflect from the problem, making it harder to recognize its determinacy.

You can change the flag:

>>>File >>Presets >Test Map >[ ] Use fixed random starting value

or similar, I do not possess the english version of the editor.

Ohhhhh, so if I DO try the map on custom game, random numbers will work?
Thank for your answer. will check the flag you said and +rep after ;)

EDIT: if anyone interested where to find it exactly in the English version of the editor
The flag is at:
>>>File >>>Preferences >>>Test Map >>> [ ] Use Fixed Random Seed
 
Status
Not open for further replies.
Top