• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Spell] Imitate Die Roll

Status
Not open for further replies.
Level 2
Joined
Mar 15, 2017
Messages
6
Hello guys!

I wonder if it is possible to make a trigger that would imitate a die roll in WE. I want to make a spell that would summon a random unit out of X possible at target point. I tried to base the spell on Dark Portal (Archimond) w/o using any triggers but the spell seems bugged and keeps summoning the same objects every time I test-run the map. So, I tried to make a trigger spell but I can't find a proper command that would do a unique action for every single integer (number on the die) (e.g. 1 - footman, 2 - knight, 3- priest etc). I could use some help here.

Thanks in advance!
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
Dark Portal should work I guess. You need to deactivate fixed random seed (file -> preferneces -> test map -> use fixed random seed).
When you are using a trigger you should save a random number to a variable first and then to create a different unit for different values of the variable.
  • Random
    • Events
    • Conditions
    • Actions
      • Set RandomInteger = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomInteger Equal to 1
        • Then - Actions
          • -------- create first unit --------
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomInteger Equal to 2
        • Then - Actions
          • -------- create first unit --------
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomInteger Equal to 3
        • Then - Actions
          • -------- create first unit --------
        • Else - Actions
 
Level 2
Joined
Mar 15, 2017
Messages
6
Dark Portal should work I guess. You need to deactivate fixed random seed (file -> preferneces -> test map -> use fixed random seed).
When you are using a trigger you should save a random number to a variable first and then to create a different unit for different values of the variable.
  • Random
    • Events
    • Conditions
    • Actions
      • Set RandomInteger = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomInteger Equal to 1
        • Then - Actions
          • -------- create first unit --------
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomInteger Equal to 2
        • Then - Actions
          • -------- create first unit --------
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomInteger Equal to 3
        • Then - Actions
          • -------- create first unit --------
        • Else - Actions

Jampion, thank you ever so much!!!
 
Status
Not open for further replies.
Top