• 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.

[Trigger] Simplify Creating Units

Status
Not open for further replies.

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
i have done this tigger, but i think it's to long and there could be a smaller one for all players instead of one by one, if there is a way to simplify it, anyone could share it with me?
66208866uz5.jpg
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
  • For each Integer A from 1 to x do:
    • If / Then / Else - Multiple Conditions
      • If - Conditions
        • (Player(Integer A) slot status) Equalt to Is playing
      • Then - Actions
        • Set temppoint = Random point in Explorers Starting Point
        • Unit - Create 1 Explorer (Corporeal) for Player(Integer A) at temppoint facing default building facing degrees
        • Custom script: call RemoveLocation(udg_temppoint)
      • Else - Actions
Just assign x to your maximum player number (max. 12)
 
  • Like
Reactions: Ham
Level 16
Joined
Jul 21, 2008
Messages
1,121
Here is one trigger:

  • Spawn
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- This function picks every player --------
      • -------- If the player is playing creates him unit --------
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • -------- Clearing memory leaks is important because they cause lag --------
              • -------- Positions leak --------
              • -------- Use temporary point variable like this to remove leak --------
              • Set TempPoint = (Random point in (YourRegion))
              • Unit - Create 1 Footman for (Picked player) at TempPoint facing Default building facing degrees
              • Custom script: call RemoveLocation(udg_TempPoint)
            • Else - Actions
 

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
Thank you both, even tho once again child made the tigger that fit to my map the most ;]
 

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
You could also add this to the condition:
  • ((Player((Integer A))) controller) Equal to User
So the explorers won't be created for computer players, which won't play (unless you have AI for them)

yeah, i added it too, thanks anyways
 
Status
Not open for further replies.
Top