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

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.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
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