• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Income Counter

Status
Not open for further replies.
Posting a thread: you're doing it wrong.

1) Post the complete triggers with which you have problems here (right-click the name of the trigger above "Events", click "Copy as text", paste it here and wrap [trigger][/trigger] around it).
2) "this are the results" - which results? I only see a very lame trigger.

This is what your trigger does:

Var1 = xgold1RX
Var2 = xgold1R

Set Var1 to 250
Set Var1 to Var2 (WTF? You just changed Var1! Why did you set it to Var2 right after you set it to 250? And Var2 isn't even set up yet...)
Set Var2 = number of units owned by red (since there is no triggering player, it will automatically be set to red, always).

And there's a leak (unit group).

And this runs every 2 seconds... futile, to say the least.

I mean, seriously?
 
I thought i can combine the variable, this was the opionon for set Var1 to 250 set var1 to var2. but if you have a idea how to make a income timer that count mabye from 4 buildings with a different income (gold) output. example:
Market1:150g " "2:250g " "3:325 " "4:495= 1220g this in one income timer is difficult?

an to the triggering player i would fit that into a unitgruop action.
 
It really doesn't work like that.
Triggering player is for when you have an event in which a player does something.
The variables... I don't have the slightest clue what you were trying to achieve with those.

For you, I'll make it a simple (yet a bit less good) trigger.
It should look like this:

  • Income
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer LoopInt) from 1 to [X], do (Actions)
        • Loop - Actions
          • Set Group = (Units owned by (Player(LoopInt)) of type Market1)
          • Unit Group - Pick every unit in Group and do (Actions)
            • Loop - Actions
              • Player - Add 150 to (Player(LoopInt)) Current gold
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market2)
          • Unit Group - Pick every unit in Group and do (Actions)
            • Loop - Actions
              • Player - Add 250 to (Player(LoopInt)) Current gold
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market3)
          • Unit Group - Pick every unit in Group and do (Actions)
            • Loop - Actions
              • Player - Add 325 to (Player(LoopInt)) Current gold
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market4)
          • Unit Group - Pick every unit in Group and do (Actions)
            • Loop - Actions
              • Player - Add 495 to (Player(LoopInt)) Current gold
          • Custom script: call DestroyGroup(udg_Group)
[X] should be the maximum amount of human players there can be in the game (e.g. if pink is the last player, it would be 8).

It took me about 10 seconds, so no: it's not difficult at all.
 
Okay.

I'll still use the previous trigger, but instead of those "Player - add gold"-actions, do:

  • Income
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer LoopInt) from 1 to [X], do (Actions)
        • Loop - Actions
          • Set IncomeAmount[LoopInt] = 0
          • Set Group = (Units owned by (Player(LoopInt)) of type Market1)
          • Unit Group - Pick every unit in Group and do (Actions)
            • Loop - Actions
              • Set IncomeAmount[LoopInt] = IncomeAmount[LoopInt] + 150
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market2)
          • Unit Group - Pick every unit in Group and do (Actions)
            • Loop - Actions
              • Set IncomeAmount[LoopInt] = IncomeAmount[LoopInt] + 250
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market3)
          • Unit Group - Pick every unit in Group and do (Actions)
            • Loop - Actions
              • Set IncomeAmount[LoopInt] = IncomeAmount[LoopInt] + 325
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market4)
          • Unit Group - Pick every unit in Group and do (Actions)
            • Loop - Actions
              • Set IncomeAmount[LoopInt] = IncomeAmount[LoopInt] + 495
          • Custom script: call DestroyGroup(udg_Group)
IncomeAmount[X] will show the income the player will receive next cycle.
(X is the player number).

You just need to add these values to the multiboard.
 
Yes that is this what i need but one question what does the Custom skript do?
It removes the unit group leak.

Every time you use a unit group, location, special effect or player group you will create a leak.
Leaks cause lag (if you ever played the old WMW, the mid-game lag is almost completely caused by leaks), and that's why you always need to remove them.
 
Cool but but what to do here:
  • AreaSpawn
  • Events
    • Time - Elapsed game time is 10.00 seconds
  • Conditions
  • Actions
    • Create 1 swordmen for player 6 (orange) at EnemySpawn1 facing handicap for building orientation degrees
    • Custom skript: call RemoveLocation(udg_EnemySpawn1)
___
  • AreaSpawn2
  • Events
    • Time - Elapsed game time is 15.00 Seconds
  • Conditions
  • Actions
    • Create 5 Knights for Player 6 (Orange) at EnemySpawn1
    • Custom Skript: call RemoveLocation(udg_EnemySPawn1)

I do this with the custom skript how u can see here but if the Area gets romved the nex spawn dont spawn becaouse they have no area?
 
Units don't spawn if you use a null/removed location, that's not like when you use coordinates instead of locations (it doesn't stop the execution of the trigger, though).

I would recommend you to not care a lot of the leak until you use the trigger editor with more ease : just check it in the periodic timers. Or look at tutorials, at least, because it's not an easy thing to clearly understand for a lot of people.
 
LoopInt is an integer variable without array.
IncomeAmount is an integer variable with array.

Your editor is in German, but this is how you get the player-thing in the English editor:
Conversion - Convert Player Index to Player (above "Event Response - Previous Owner"), you should see "Player(1)".
Replace the '1' with the variable LoopInt and you're done.

Also, I see a lot more wrong things in your trigger.
- Do not place the unit groups inside the other unit groups.
- For each integer LoopInt from 1 to X_X? What is X_X?
 
Only the X_X bothers me now :D (and that you should copy the custom script after the last unit group as well, but it may not be the complete trigger you just posted).

The X_X should be the maximum amount of human players there can be on a map.
It's quite simple: let's say you can play the map with 8 people, then it should say "from 1 to 8".

Also, could you perhaps post the trigger here in the future (it's easier for both you and the one trying to help you).
Just right-click the trigger name above "Ereignisse" and select "copy as text".
Paste it here and put [trigger][/trigger] around it :)
 
So right ? ^^ The X_X is your x the number of players how you said it.

  • Apocalypses Income Counter
    • Ereignisse
      • Zeit - Every 2.00 seconds of game time
    • Bedingungen
    • Aktionen
      • For each (Integer LoopInt) from 1 to X_X, do (Actions)
        • Schleifen - Aktionen
          • Custom script: call DestroyGroup(udg_Group)
          • Set IncomeAmount[LoopInt] = 0
          • Set Group = (Units owned by (Player(LoopInt)) of type Market_1Gold)
          • Einheitengruppe - Pick every unit in Group and do (Actions)
            • Schleifen - Aktionen
              • Set IncomeAmount[LoopInt] = IncomeAmount[(LoopInt + 150)]
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market_2Gold)
          • Einheitengruppe - Pick every unit in Group and do (Actions)
            • Schleifen - Aktionen
              • Set IncomeAmount[LoopInt] = IncomeAmount[(LoopInt + 250)]
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market_3Gold)
          • Einheitengruppe - Pick every unit in Group and do (Actions)
            • Schleifen - Aktionen
              • Set IncomeAmount[LoopInt] = IncomeAmount[(LoopInt + 325)]
 
So right?^^ The X_X is your x , its the number of players .

  • Apocalypses Income Counter
    • Ereignisse
      • Zeit - Every 2.00 seconds of game time
    • Bedingungen
    • Aktionen
      • For each (Integer LoopInt) from 1 to X_X, do (Actions)
        • Schleifen - Aktionen
          • Custom script: call DestroyGroup(udg_Group)
          • Set IncomeAmount[LoopInt] = 0
          • Set Group = (Units owned by (Player(LoopInt)) of type Market_1Gold)
          • Einheitengruppe - Pick every unit in Group and do (Actions)
            • Schleifen - Aktionen
              • Set IncomeAmount[LoopInt] = IncomeAmount[(LoopInt + 150)]
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market_2Gold)
          • Einheitengruppe - Pick every unit in Group and do (Actions)
            • Schleifen - Aktionen
              • Set IncomeAmount[LoopInt] = IncomeAmount[(LoopInt + 250)]
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market_3Gold)
          • Einheitengruppe - Pick every unit in Group and do (Actions)
            • Schleifen - Aktionen
              • Set IncomeAmount[LoopInt] = IncomeAmount[(LoopInt + 325)]
 
So right?^^

(trigger)

  • Apocalypses Income Counter
    • Ereignisse
      • Zeit - Every 2.00 seconds of game time
    • Bedingungen
    • Aktionen
      • For each (Integer LoopInt) from 1 to X_X, do (Actions)
        • Schleifen - Aktionen
          • Set IncomeAmount[LoopInt] = 0
          • Set Group = (Units owned by (Player(LoopInt)) of type Market_1Gold)
          • Einheitengruppe - Pick every unit in Group and do (Actions)
            • Schleifen - Aktionen
              • Set IncomeAmount[LoopInt] = IncomeAmount[LoopInt] + 150
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market_2Gold)
          • Einheitengruppe - Pick every unit in Group and do (Actions)
            • Schleifen - Aktionen
              • Set IncomeAmount[LoopInt] = IncomeAmount[LoopInt] + 250
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market_3Gold)
          • Einheitengruppe - Pick every unit in Group and do (Actions)
            • Schleifen - Aktionen
              • Set IncomeAmount[LoopInt] = IncomeAmount[LoopInt] + 325
          • Custom script: call DestroyGroup(udg_Group)
:3
 
Last edited:
hmm,, its alot smarter to use 1 group, that checks a condition with 4 ands.
1 and = unit type 1.
second and = unit type 2.
and so on,
then check unit type and add the income on the check, alot smarter.

edit:

  • Find income
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set income[(Integer A)] = 0
          • Set UnitGroup = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Peasant) and (((Unit-type of (Matching unit)) Equal to Footman) and ((Unit-type of (Matching unit)) Equal to Knight))))
          • Unit Group - Pick every unit in UnitGroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Peasant
                • Then - Actions
                  • Set income[(Integer A)] = (income[(Integer A)] + 150)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Picked unit)) Equal to Footman
                    • Then - Actions
                      • Set income[(Integer A)] = (income[(Integer A)] + 250)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Picked unit)) Equal to Knight
                        • Then - Actions
                          • Set income[(Integer A)] = (income[(Integer A)] + 325)
                        • Else - Actions
          • Custom script: call DestroyGroup(udg_UnitGroup)
thats it. income = the income for that player, 12 = max players possible in a wc 3 map. no need for anything else i guess =]
 
hmm,, its alot smarter to use 1 group, that checks a condition with 4 ands.
1 and = unit type 1.
second and = unit type 2.
and so on,
then check unit type and add the income on the check, alot smarter.

ap0calypse said:
For you, I'll make it a simple (yet a bit less good) trigger.
Read the thread.
And it really doesn't matter that much either way.
 
oh..
sorry, didnt see that post.. o.o
but it does matter..
3 unit groups rather then 1 really matters.
its 3 extra groups that the function uses, makes it alot less efficent. and dont use my code if you dont understend it.. cuz i guess hes will be easier ;p
 
oh..
sorry, didnt see that post.. o.o
but it does matter..
3 unit groups rather then 1 really matters.
its 3 extra groups that the function uses, makes it alot less efficent. and dont use my code if you dont understend it.. cuz i guess hes will be easier ;p
I just thought it'd be easier to copy a unit group loop a few times for every unit type ^^

You're right about the efficiency though (still not THAT much - and if you want to be as efficient as possible I can only recommend JASS).
 
  • Apocalypses Income Counter
    • Ereignisse
      • Zeit - Every 2.00 seconds of game time
    • Bedingungen
    • Aktionen
      • For each (Integer LoopInt) from 1 to 5, do (Actions)
        • Schleifen - Aktionen
          • Set IncomeAmount[LoopInt] = 0
          • Set Group = (Units owned by (Player(LoopInt)) of type Market_1Gold)
          • Einheitengruppe - Pick every unit in Group and do (Actions)
            • Schleifen - Aktionen
              • Set IncomeAmount[LoopInt] = IncomeAmount[(LoopInt + 150)]
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market_2Gold)
          • Einheitengruppe - Pick every unit in Group and do (Actions)
            • Schleifen - Aktionen
              • Set IncomeAmount[LoopInt] = IncomeAmount[(LoopInt + 250)]
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market_3Gold)
          • Einheitengruppe - Pick every unit in Group and do (Actions)
            • Schleifen - Aktionen
              • Set IncomeAmount[LoopInt] = IncomeAmount[(LoopInt + 325)]
          • Custom script: call DestroyGroup(udg_Group)
It only show on the Multiboard "0" but i had 3 income buildings

  • Multiboard - Set the text for The_Multiboard item in column 1, row 4 to (String(IncomeAmount[1]))
 
wow, you think that

  • Set IncomeAmount[LoopInt] = (IncomeAmount[LoopInt] + 150)
is same as

  • Set IncomeAmount[LoopInt] = IncomeAmount[LoopInt] + 150.
because its not..
its loopint + 150, that means it increases the array by 150, and not the amount it self.
but option #2 increases the amount, instead of the array.
 
ohh, i thought it was INSIDE the brackets ;/
dam me + my eyes xD
sry for that, ;p well.. i still dont get why he wont use my system o.o
is there any simpler then:

  • Setup Income Count
    • Events
      • Time - Elapsed game time is 0.05 seconds
    • Conditions
    • Actions
      • -------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --------
      • -------- Income_Multiboard is the multiboard the Update Income trigger uses to update. --------
      • Set Income_Multiboard = The_Multiboard
      • -------- my multiboard row 1 = player name, while row 2 = income for that player. --------
      • -------- the numbers in the [] means the player number, player 1 row = 2, player 2 row = 2, and so on. --------
      • Set Income_MultiboardIncomeRow[1] = 2
      • Set Income_MultiboardIncomeRow[2] = 2
      • Set Income_MultiboardIncomeRow[3] = 2
      • Set Income_MultiboardIncomeRow[4] = 2
      • Set Income_MultiboardIncomeRow[5] = 2
      • Set Income_MultiboardIncomeRow[6] = 2
      • Set Income_MultiboardIncomeRow[7] = 2
      • Set Income_MultiboardIncomeRow[8] = 2
      • Set Income_MultiboardIncomeRow[9] = 2
      • Set Income_MultiboardIncomeRow[10] = 2
      • Set Income_MultiboardIncomeRow[11] = 2
      • Set Income_MultiboardIncomeRow[12] = 2
      • -------- the numbers in the [] means the player number, player 1 column = 2, player 2 column = 3, and so on. --------
      • Set Income_MultiboardIncomeColumn[1] = 2
      • Set Income_MultiboardIncomeColumn[2] = 3
      • Set Income_MultiboardIncomeColumn[3] = 4
      • Set Income_MultiboardIncomeColumn[4] = 5
      • Set Income_MultiboardIncomeColumn[5] = 6
      • Set Income_MultiboardIncomeColumn[6] = 7
      • Set Income_MultiboardIncomeColumn[7] = 8
      • Set Income_MultiboardIncomeColumn[8] = 9
      • Set Income_MultiboardIncomeColumn[9] = 10
      • Set Income_MultiboardIncomeColumn[10] = 11
      • Set Income_MultiboardIncomeColumn[11] = 12
      • Set Income_MultiboardIncomeColumn[12] = 13
      • -------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --------
      • -------- // you can set this to 12, but this makes it alot less efficent. so if you put the exact number, its the best. --------
      • Set Income_AmountOfPlayers = 12
      • -------- ------ My favorite part: setting up unit types and incomes. --------
      • Set Income_MaxUnitTypes = (Income_MaxUnitTypes + 1)
      • Set Income_UnitTypes[Income_MaxUnitTypes] = Market_1Gold
      • Set Income_UnitTypeIncome[Income_MaxUnitTypes] = 150
      • -------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --------
      • Set Income_MaxUnitTypes = (Income_MaxUnitTypes + 1)
      • Set Income_UnitTypes[Income_MaxUnitTypes] = Market_2Gold
      • Set Income_UnitTypeIncome[Income_MaxUnitTypes] = 250
      • -------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --------
      • Set Income_MaxUnitTypes = (Income_MaxUnitTypes + 1)
      • Set Income_UnitTypes[Income_MaxUnitTypes] = Market_3Gold
      • Set Income_UnitTypeIncome[Income_MaxUnitTypes] = 350
      • -------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --------
  • Update income Counter
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Income_Count) from 1 to Income_AmountOfPlayers, do (Actions)
        • Loop - Actions
          • Set Income_PlayerCurrentIncome[Income_Count] = 0
          • Set Income_Group = (Units owned by (Player(Income_Count)))
          • Unit Group - Pick every unit in Income_Group and do (Actions)
            • Loop - Actions
              • For each (Integer Income_Count2) from 1 to Income_MaxUnitTypes, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Picked unit)) Equal to Income_UnitTypes[Income_Count2]
                      • ((Picked unit) is alive) Equal to True
                    • Then - Actions
                      • Set Income_PlayerCurrentIncome[Income_Count] = (Income_PlayerCurrentIncome[Income_Count] + Income_UnitTypeIncome[Income_Count2])
                    • Else - Actions
              • Multiboard - Set the text for Income_Multiboard item in column Income_MultiboardIncomeColumn[Income_Count], row Income_MultiboardIncomeRow[Income_Count] to (String(Income_PlayerCurrentIncome[Income_Count]))
              • Multiboard - Hide Income_Multiboard
              • Multiboard - Show Income_Multiboard
          • Custom script: call DestroyGroup(udg_Income_Group)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Income_SecondCount Greater than or equal to 30
        • Then - Actions
          • Set Income_SecondCount = 0
          • For each (Integer Income_ThirdCount) from 1 to Income_AmountOfPlayers, do (Actions)
            • Loop - Actions
              • Player - Add Income_PlayerCurrentIncome[Income_ThirdCount] to (Player(Income_ThirdCount)) Current gold
        • Else - Actions
          • Set Income_SecondCount = (Income_SecondCount + 2)
o.o
 
  • Apocalypses Income Counter
    • Ereignisse
      • Zeit - Every 2.00 seconds of game time
    • Bedingungen
    • Aktionen
      • For each (Integer LoopInt) from 1 to 5, do (Actions)
        • Schleifen - Aktionen
          • Set IncomeAmount[LoopInt] = 0
          • Set Group = (Units owned by (Player(LoopInt)) of type Market_1Gold)
          • Einheitengruppe - Pick every unit in Group and do (Actions)
            • Schleifen - Aktionen
              • Set IncomeAmount[LoopInt] = (IncomeAmount[LoopInt] + 150)
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market_2Gold)
          • Einheitengruppe - Pick every unit in Group and do (Actions)
            • Schleifen - Aktionen
              • Set IncomeAmount[LoopInt] = (IncomeAmount[LoopInt] + 225)
          • Custom script: call DestroyGroup(udg_Group)
          • Set Group = (Units owned by (Player(LoopInt)) of type Market_3Gold)
          • Einheitengruppe - Pick every unit in Group and do (Actions)
            • Schleifen - Aktionen
              • Set IncomeAmount[LoopInt] = (IncomeAmount[LoopInt] + 305)
          • Custom script: call DestroyGroup(udg_Group)
now i will do this for lumber to thanks apocalypse and dardas

what i learned what and how to use arrays ^^
 
Status
Not open for further replies.
Back
Top