# Income Trigger

#### Koopa124

Level 9
Alright guys, I need a good income trigger. Vergil made me one, but it isn't
working.

For Each:
Building A = 16 Gold
Building B = 24 Gold
Building C = 32 Gold
Building D = 40 Gold

Every 60 seconds of the game, the players get paid pending how many of each building they have. [2 A's and 3 C's = 2x16 + 3x32]
If the unit dies, it no longer counts.

The twist:
Low upkeep = 100% of your income
Medium upkeep = 80% of your income
High upkeep = 60% of your income
Insane upkeep = 40% of your income
And so on [if I add more upkeeps]

Anyone who can give me a good trigger [or JASS] will receive 2 rep from me, and credit in my map.

This trigger goes for each player [except brown], every 60 seconds.

Food reduction:
I think it's something with the food limit.

Here:
0-15 - Very Low Upkeep
16-25 - Low Upkeep
26-50 - Medium Upkeep
51-75 - High Upkeep
76-100 - Insane Upkeep
[Food goes up to 300, so make some room that I can add more if needed]

Last edited:

#### Hashjie

Level 14
cant you do it like this?

• Initialization
• Events
• Map initialization
• Conditions
• Actions
• Set Building[1] = 16
• Set Building[2] = 24
• Set Building[3] = 32
• Set Building[4] = 40
• Recieve income
• Events
• Time - Every 60.00 seconds of game time
• Conditions
• Actions
• For each (Integer A) from 1 to 11, do (Actions)
• Loop - Actions
• Set Number_of_building1_Player[(Integer A)] = (Number of units in (Units owned by (Player((Integer A))) of type Farm))
• Set Number_of_building2_Player[(Integer A)] = (Number of units in (Units owned by (Player((Integer A))) of type Cannon Tower))
• Set Number_of_building3_Player[(Integer A)] = (Number of units in (Units owned by (Player((Integer A))) of type Town Hall))
• Set Number_of_building4_Player[(Integer A)] = (Number of units in (Units owned by (Player((Integer A))) of type Barracks))
• Player - Add (Building[1] x Number_of_building1_Player[(Integer A)]) to (Player((Integer A))) Current gold
• Player - Add (Building[2] x Number_of_building2_Player[(Integer A)]) to (Player((Integer A))) Current gold
• Player - Add (Building[3] x Number_of_building3_Player[(Integer A)]) to (Player((Integer A))) Current gold
• Player - Add (Building[4] x Number_of_building4_Player[(Integer A)]) to (Player((Integer A))) Current gold
I haven't made something for the upkeep since I never used it before 0.o... I don't know which condition checks how much upkeep a player has, if you could tell me that, that would be great... Then I'll edit the income trigger to work with upkeeps

EDIT: here is the one updated with upkeep, but I'm unsure if it works since I dont have the time to test it now...

• Recieve income
• Events
• Time - Every 60.00 seconds of game time
• Conditions
• Actions
• For each (Integer A) from 1 to 11, do (Actions)
• Loop - Actions
• -------- you should change the type of buildings to your types ofcourse ;) --------
• Set Number_of_building1_Player[(Integer A)] = (Number of units in (Units owned by (Player((Integer A))) of type Farm))
• Set Number_of_building2_Player[(Integer A)] = (Number of units in (Units owned by (Player((Integer A))) of type Cannon Tower))
• Set Number_of_building3_Player[(Integer A)] = (Number of units in (Units owned by (Player((Integer A))) of type Town Hall))
• Set Number_of_building4_Player[(Integer A)] = (Number of units in (Units owned by (Player((Integer A))) of type Barracks))
• -------- you can also change these if then elses into a single action if then else since your only updating the income percentage variable... That shortens the code down a bit :) --------
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (((Player((Integer A))) Food used) Greater than or equal to 0) and (((Player((Integer A))) Food used) Less than or equal to 15)
• Then - Actions
• -------- if your upkeep is verry low then it will be 100% --------
• Set income_percentage = 100
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (((Player((Integer A))) Food used) Greater than or equal to 16) and (((Player((Integer A))) Food used) Less than or equal to 25)
• Then - Actions
• -------- if your upkeep is low then it will be 80% --------
• Set income_percentage = 80
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (((Player((Integer A))) Food used) Greater than or equal to 26) and (((Player((Integer A))) Food used) Less than or equal to 50)
• Then - Actions
• -------- if your upkeep is mediom then it will be 60% --------
• Set income_percentage = 60
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (((Player((Integer A))) Food used) Greater than or equal to 51) and (((Player((Integer A))) Food used) Less than or equal to 75)
• Then - Actions
• -------- if your upkeep is high then it will be 40% --------
• Set income_percentage = 40
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (((Player((Integer A))) Food used) Greater than or equal to 76) and (((Player((Integer A))) Food used) Less than or equal to 100)
• Then - Actions
• -------- if your upkeep is insane then it will be 20% --------
• Set income_percentage = 20
• -------- and so on ;) --------
• Else - Actions
• -------- example: set total_income_of_player[(1)] = (total_income_of_player[(1)] + 16 x 2 buildings = 32 gold... --------
• Set total_income_of_player[(Integer A)] = (total_income_of_player[(Integer A)] + (Building[1] x Number_of_building1_Player[(Integer A)]))
• Set total_income_of_player[(Integer A)] = (total_income_of_player[(Integer A)] + (Building[2] x Number_of_building2_Player[(Integer A)]))
• Set total_income_of_player[(Integer A)] = (total_income_of_player[(Integer A)] + (Building[3] x Number_of_building3_Player[(Integer A)]))
• Set total_income_of_player[(Integer A)] = (total_income_of_player[(Integer A)] + (Building[4] x Number_of_building4_Player[(Integer A)]))
• -------- example: set total_income_of_player([1]) = (total_income_of_player[(1)] /100 x 80 *percentage of income* = 25,6 (26) gold if you look @ previous example... --------
• Set total_income_of_player[(Integer A)] = (total_income_of_player[(Integer A)] / (100 x income_percentage))
• Player - Add total_income_of_player[(Integer A)] to (Player((Integer A))) Current gold
• -------- (lol I forgot this part XD) --------
• Set total_income_of_player[(Integer A)] = 0
ANOTHER EDIT: oops I forgot the most important part: setting the total income of the player back to 0 because else each time you get income it will get doubled XD

Last edited:

#### Koopa124

Level 9
I think it's something with the food limit.

Here:
0-15 - Very Low Upkeep
16-25 - Low Upkeep
26-50 - Medium Upkeep
51-75 - High Upkeep
76-100 - Insane Upkeep

I think that information is necessary. Anyone else have any triggers?

Replies
5
Views
772
Replies
3
Views
747
Replies
10
Views
818
Replies
4
Views
582