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

Income trigger help!

Status
Not open for further replies.
Level 9
Joined
Jul 10, 2011
Messages
562
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.
 
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.
 
Status
Not open for further replies.
Top