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

resource producing buildings

Status
Not open for further replies.
Level 4
Joined
Jun 19, 2007
Messages
53
This is something i've been stuck on for a while now. I'm trying to find a way to make a certain building produce 10 gold per building per 10 seconds. The ways I've tried have leaked very badly or not worked at all. The big trick is that i need it to work for three players. If it helps, they are all on the same team. If possible, could they not all trigger at the same exact time? But I'll take what I get

PLEASE HELP ME!
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
This assumes you don't use Custom Value. Accurate to within 1 second, as it may as well be more efficient and a bit less accurate than a tiny interval.

  • Some Trigger
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick Every Unit in (Units of Type (Resource Producing Building)) Matching (((Matching Unit) is Alive) Equal to True) and do Actions
        • Loop - Actions
          • Unit - Set Custom Value of (Picked Unit) to ((Custom Value of (Picked Unit)) + 1)
          • If (All Conditions are True) Then do (Then actions) Else do (Else actions)
            • If - Conditions
              • (Custom Value of (Picked Unit)) Equal to 10
            • Then - Actions
              • Unit - Set Custom Value of (Picked Unit) to 0
              • Player - Add 10 to (Owner of (Picked Unit)) Current Gold
            • Else - Actions
 
Status
Not open for further replies.
Top