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

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

Status
Not open for further replies.
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 26
Joined
Mar 19, 2008
Messages
3,140
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'.
 
Status
Not open for further replies.
Top