# Income trigger help!

Status
Not open for further replies.

#### Spank_my_kodo

Level 5
Does anyone know how to make a trigger that will give each player gold depending on how many 'income buildings' they have built? Any help will be greatly appreciated, thanks! I will include your name in the credits

#### claptomanic

Level 9
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.

#### ap0calypse

Level 28
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.

#### Spank_my_kodo

Level 5
Thanks everyone for the help. I appreciate all the helpful comments from everyone!

Status
Not open for further replies.

Replies
3
Views
929
Replies
3
Views
705
Replies
2
Views
2K
Replies
10
Views
1K
Replies
6
Views
730