• 🏆 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!

A simple non-repeating random number for GUI users.

  • Random Number
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set Random_Number = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Removed_Number Equal to 9
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Check_Number[Random_Number] Not equal to 1
        • Then - Actions
          • Set Removed_Number = (Removed_Number + 1)
          • Set Check_Number[Random_Number] = 1
          • Game - Display to (All players) the text: (String(Random_Number))
        • Else - Actions
          • Trigger - Run (This trigger) (checking conditions)
This trigger randomize numbers between 1 and 10 (or more) without repeating.
You will need to create 3 integer variables = Random_Number, Removed_Number and Check_Number[with array].
*Note that in the condition that turn off the trigger, the 'Random Number' must be minus 1 of the total numbers you will need.
Hope it helps someone. :thumbs_up:
 
This is more of a "here's the trigger" solution type and not a tutorial at all. You need to explain the thought process and why it works that way.
You're right, this isn't meant to be here. Is there a section where this post can be moved? I'm really bad at explaining (and my mother tongue isn't English, which makes it even worse) and it will take some time to come up with a decent post. Maybe another time I can do that. I'll wait for your answer, if there's nothing you can do I'll delete it, no problem.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
Well, this has been discussed many times on Hive already, but it could be useful to have a tutorial for it I suppose.
 
Top