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

[Trigger] Random is not random

Status
Not open for further replies.
Level 7
Joined
Mar 8, 2009
Messages
360
i'n my tower diffence you can select random race, but the problem is that i always get the same builder (90% of the cases) when i test my map. This is my trigger:

  • random
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • ((Trained unit) is A peon-type unit) Equal to True
    • Actions
      • Set tempPlayer = (Owner of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Trained unit-type) Equal to Random
        • Then - Actions
          • Unit - Remove (Trained unit) from the game
          • Set tempInt = (Random integer number between 1 and 80)
          • If (tempInt Less than or equal to 20) then do (Unit - Create 1 Crazy Elf Scientist for tempPlayer at (tempPlayer start location) facing Default building facing degrees) else do (Do nothing)
          • If ((tempInt Less than or equal to 40) and (tempInt Greater than or equal to 21)) then do (Unit - Create 1 Ethereal Builder for tempPlayer at (tempPlayer start location) facing Default building facing degrees) else do (Do nothing)
          • If ((tempInt Greater than or equal to 41) and (tempInt Less than or equal to 60)) then do (Unit - Create 1 Mad Scientist for tempPlayer at (tempPlayer start location) facing Default building facing degrees) else do (Do nothing)
          • If ((tempInt Greater than or equal to 61) and (tempInt Less than or equal to 80)) then do (Unit - Create 1 Physicist for tempPlayer at (tempPlayer start location) facing Default building facing degrees) else do (Do nothing)
        • Else - Actions
A solution in jass is also ok.
(I know it leaks)
 
Level 6
Joined
May 7, 2009
Messages
228
Do you get the same builder all the time, or just most of the time?

I don't see anything particular in your trigger that would cause it to give the same unit every time.

I could try to write you a better one in JASS when I'm not busy.
 
Status
Not open for further replies.
Top