• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Income trigger help!

Not open for further replies.
Level 9
Jul 10, 2011
every x seconds pick every unit/building of your type and add X gold to the player.

or, if you want each unit/building give gold every x seconds starting from being built/trained you just set an integer array to X (the seconds) and reduce that value every second by 1 and if the integer reaches 0 you give the gold to the owner and set the integer value to X again.

the first solution is easier.
Level 28
Jan 26, 2007
There are already many threads regarding this topic in WEHZ.
And then you've got Spells and systems forum.
Try searching a little bit first :).

If you only have 1 building-type that increases income:
  • Build Town Hall
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Town Hall
    • Actions
      • Set TempInt = (Player number of (Owner of (Triggering unit)))
      • Set CountTownHalls[TempInt] = (CountTownHalls[TempInt] + 1)
  • Gather Income
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Player - Add (100 x CountTownHalls[(Integer A)]) to (Player((Integer A))) Current gold
This example gives 100 gold for every "Town Hall" that's been built.
(I must add that I made this specifically so it does not use any unit groups).

If you have multiple building-types that increase income, the easiest method would be with a simple table and a unit group loop.
Example of the simple table:
Set BuildingType[1] = Mine 1
Set BuildingIncome[1] = 100
Set BuildingType[2] = Mine 2
Set BuildingIncome[2] = 250

Then loop through all buildings, check if they're the correct type and if it's done constructing, then add BuildingIncome[loop int] to the player owning that building.
Not open for further replies.