[Trigger] How do you add gold to a specific Race at the start of a Map?

Level 5
Joined
Jun 27, 2009
Messages
137
As the title suggests I need help with setting a trigger that at the start of the match adds gold to a specific race. The only way I could figure to do it is just having it be a specific Player, and then allowing you to choose the different teams to be the different races. Is there another way to do this?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
What about:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • 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
              • (Race of (Picked player)) Equal to Night Elf
            • Then - Actions
              • Player - Set (Picked player) Current gold to 750
            • Else - Actions
OR
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players matching ((Race of (Matching player)) Equal to Undead)) and do (Actions)
        • Loop - Actions
          • Player - Set (Picked player) Current gold to 750
You can off course, change the race and the actions as you like.
 
What about:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • 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
              • (Race of (Picked player)) Equal to Night Elf
            • Then - Actions
              • Player - Set (Picked player) Current gold to 750
            • Else - Actions
OR
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players matching ((Race of (Matching player)) Equal to Undead)) and do (Actions)
        • Loop - Actions
          • Player - Set (Picked player) Current gold to 750
You can off course, change the race and the actions as you like.

Use his second solution because the first solution can cause desyncs.
 

Bannar

Code Reviewer
Level 25
Joined
Mar 19, 2008
Messages
3,138
Spartipilo, your second solution leaks:

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set force = (All players matching ((Race of (Matching player)) Equal to Undead))
      • Player Group - Pick every player in force and do (Actions)
        • Loop - Actions
          • Player - Set (Picked player) Current gold to 750
      • Custom script: call DestroyForce(udg_force)
Where "force" is variable of type 'player group'.
 
Top