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

Gold Variable

Status
Not open for further replies.
Level 4
Joined
Aug 30, 2008
Messages
82
I suck with variables.. How do I make it so a player gets 50 gold per Specific Building he has every 20 seconds.

sry for my noob question.

working on a WW3 type map.
 
Level 10
Joined
Jun 1, 2008
Messages
485
try this

  • Adding Gold
    • Events
      • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units owned by <Your Player> of type <Your Building>) and do (Actions)
        • Loop - Actions
          • Player - Add 50 to <Your Player> Current gold
 
Level 4
Joined
Aug 30, 2008
Messages
82
try this

  • adding gold
    • events
      • time - every 20.00 seconds of game time
    • conditions
    • actions
      • unit group - pick every unit in (units owned by <your player> of type <your building>) and do (actions)
        • loop - actions
          • player - add 50 to <your player> current gold

thanks man!
 
Level 10
Joined
Jun 1, 2008
Messages
485
you're welcome

but that trigger only work for one player, if you want to work for all player, try this:
  • Adding Gold All Player
    • Events
      • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set Unit_Group = (Units owned by (Picked player) of type <Your Building>)
          • Unit Group - Pick every unit in Unit_Group and do (Actions)
            • Loop - Actions
              • Player - Add 50 to (Picked player) Current gold
          • Custom script: call RemoveLocation(udg_Unit_Group)
Unit_Group is unit group variable.
this trigger is leakless
 
Level 1
Joined
Feb 7, 2009
Messages
1
Various objects.

Hello there! I want to ask about similar thing- What if I want to have a GROUP of buildings giving income, not only one specific? I wanted to implement Aws/Risk-like system with Circles named after location (like Point: Glacial Falls or Point: Eastern Woods etc) I don't know how the trigger should look :(
 
Status
Not open for further replies.
Top