Pick every player action not working

Level 13
Joined
Sep 25, 2013
Messages
717
EDIT: I figured out the problem. Thanks for the help everyone!

The trigger "pick every player in (all players) and do (actions)" no longer seems to work for me. This exact trigger which provides income to all players was working a day ago, but today it is no longer working. There was tiny patch for reforged today, could they have introduced a bug causing this problem?

I hosted my map today with 5 other players and only I received income. Everyone else got none. This exact map was working as intended the other day. I'm very confused.

After the trigger not working for real players when i hosted my map, I tested my map with computer players and gave myself full control of them to see if they would receive income but they did not.

EDIT: Just to check, i individually gave players income, like player 1 red, player 2 blue, player 3 teal, etc. and that works fine. Its just the pick every player action.

  • Income Amount
    • Events
      • Time - IncomeTimer expires
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • -------- Lumber --------
          • Player - Add ((Number of living Dwarven Fortress (Dwarves) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Gondor Fortress (Gondor) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Haradrim Fortress (Haradrim) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Mordor Fortress (Mordor) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Uruk-Hai Fortress (Isengard) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Elven Fortress (Elves) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Rohan Fortress (Rohan) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add (8 x (Number of living Control Point (Balrog) units owned by (Picked player))) to (Picked player).Current lumber
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of living Control Point units owned by (Picked player)) Equal to 1
            • Then - Actions
              • Player - Add 5 to (Picked player).Current lumber
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of living Control Point units owned by (Picked player)) Equal to 2
                • Then - Actions
                  • Player - Add 10 to (Picked player).Current lumber
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of living Control Point units owned by (Picked player)) Equal to 3
                    • Then - Actions
                      • Player - Add 14 to (Picked player).Current lumber
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of living Control Point units owned by (Picked player)) Equal to 4
                        • Then - Actions
                          • Player - Add 17 to (Picked player).Current lumber
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of living Control Point units owned by (Picked player)) Equal to 5
                            • Then - Actions
                              • Player - Add 19 to (Picked player).Current lumber
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Number of living Control Point units owned by (Picked player)) Equal to 6
                                • Then - Actions
                                  • Player - Add 20 to (Picked player).Current lumber
                                • Else - Actions
          • -------- Gold --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of living Control Point units owned by (Picked player)) Equal to 1
            • Then - Actions
              • Player - Add 300 to (Picked player).Current gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of living Control Point units owned by (Picked player)) Equal to 2
                • Then - Actions
                  • Player - Add 550 to (Picked player).Current gold
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of living Control Point units owned by (Picked player)) Equal to 3
                    • Then - Actions
                      • Player - Add 750 to (Picked player).Current gold
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of living Control Point units owned by (Picked player)) Equal to 4
                        • Then - Actions
                          • Player - Add 900 to (Picked player).Current gold
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of living Control Point units owned by (Picked player)) Equal to 5
                            • Then - Actions
                              • Player - Add 1000 to (Picked player).Current gold
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Number of living Control Point units owned by (Picked player)) Equal to 6
                                • Then - Actions
                                  • Player - Add 1050 to (Picked player).Current gold
                                • Else - Actions
          • Player - Add (500 x (Number of living Control Point (Balrog) units owned by (Picked player))) to (Picked player).Current gold
          • Player - Add ((Number of living Dwarven Fortress (Dwarves) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Gondor Fortress (Gondor) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Haradrim Fortress (Haradrim) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Mordor Fortress (Mordor) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Uruk-Hai Fortress (Isengard) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Elven Fortress (Elves) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Rohan Fortress (Rohan) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Dwarven Vassal Fortress (Dwarves) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Gondor Vassal Fortress (Gondor) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Haradrim Vassal Fortress (Haradrim) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Mordor Vassal Fortress (Mordor) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Uruk-Hai Vassal Fortress (Isengard) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Elven Vassal Fortress (Elves) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Rohan Vassal Fortress (Rohan) units owned by (Picked player)) x 1000) to (Picked player).Current gold

This alternate trigger to give income does work. But i need "pick all players" to work.
  • Untitled Trigger 001
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Player - Add 1 to (Player((Player number of (Player((Integer A)))))).Current gold

This trigger is not working. I don't understand why.
  • Untitled Trigger 001 Copy
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Add 1 to (Picked player).Current gold

EDIT 2: I may have figured out what was the problem.

At the bottom of the trigger, i had nested another "pick every player" action within the primary "pick every player action, instead of outside of it, separately. I changed it to look like the trigger below this one.
  • Income and Conquest Points
    • Events
      • Time - IncomeTimer expires
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • -------- Lumber --------
          • Player - Add ((Number of living Dwarven Fortress (Dwarves) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Gondor Fortress (Gondor) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Haradrim Fortress (Haradrim) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Mordor Fortress (Mordor) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Uruk-Hai Fortress (Isengard) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Elven Fortress (Elves) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Rohan Fortress (Rohan) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add (8 x (Number of living Control Point (Balrog) units owned by (Picked player))) to (Picked player).Current lumber
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of living Control Point units owned by (Picked player)) Equal to 1
            • Then - Actions
              • Player - Add 5 to (Picked player).Current lumber
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of living Control Point units owned by (Picked player)) Equal to 2
                • Then - Actions
                  • Player - Add 10 to (Picked player).Current lumber
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of living Control Point units owned by (Picked player)) Equal to 3
                    • Then - Actions
                      • Player - Add 14 to (Picked player).Current lumber
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of living Control Point units owned by (Picked player)) Equal to 4
                        • Then - Actions
                          • Player - Add 17 to (Picked player).Current lumber
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of living Control Point units owned by (Picked player)) Equal to 5
                            • Then - Actions
                              • Player - Add 19 to (Picked player).Current lumber
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Number of living Control Point units owned by (Picked player)) Equal to 6
                                • Then - Actions
                                  • Player - Add 20 to (Picked player).Current lumber
                                • Else - Actions
          • -------- Gold --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of living Control Point units owned by (Picked player)) Equal to 1
            • Then - Actions
              • Player - Add 300 to (Picked player).Current gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of living Control Point units owned by (Picked player)) Equal to 2
                • Then - Actions
                  • Player - Add 550 to (Picked player).Current gold
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of living Control Point units owned by (Picked player)) Equal to 3
                    • Then - Actions
                      • Player - Add 750 to (Picked player).Current gold
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of living Control Point units owned by (Picked player)) Equal to 4
                        • Then - Actions
                          • Player - Add 900 to (Picked player).Current gold
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of living Control Point units owned by (Picked player)) Equal to 5
                            • Then - Actions
                              • Player - Add 1000 to (Picked player).Current gold
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Number of living Control Point units owned by (Picked player)) Equal to 6
                                • Then - Actions
                                  • Player - Add 1050 to (Picked player).Current gold
                                • Else - Actions
          • Player - Add (500 x (Number of living Control Point (Balrog) units owned by (Picked player))) to (Picked player).Current gold
          • Player - Add ((Number of living Dwarven Fortress (Dwarves) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Gondor Fortress (Gondor) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Haradrim Fortress (Haradrim) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Mordor Fortress (Mordor) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Uruk-Hai Fortress (Isengard) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Elven Fortress (Elves) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Rohan Fortress (Rohan) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Dwarven Vassal Fortress (Dwarves) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Gondor Vassal Fortress (Gondor) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Haradrim Vassal Fortress (Haradrim) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Mordor Vassal Fortress (Mordor) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Uruk-Hai Vassal Fortress (Isengard) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Elven Vassal Fortress (Elves) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Rohan Vassal Fortress (Rohan) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • -------- ----------------------------------------Conquest Points---------------------------------------- --------
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked player) is in ConquestPoints_PlayerGroup.) Equal to True
                • Then - Actions
                  • Set VariableSet ConquestPoints_Integer[(Player number of (Picked player))] = (ConquestPoints_Integer[(Player number of (Picked player))] + (80 x (Number of living Control Point units owned by (Player((Player number of (Picked player)))))))
                  • Set VariableSet ConquestPoints_Integer[(Player number of (Picked player))] = (ConquestPoints_Integer[(Player number of (Picked player))] + (80 x (Number of living Control Point (Spiked Barricades) units owned by (Player((Player number of (Picked player)))))))
                  • Set VariableSet ConquestPoints_Integer[(Player number of (Picked player))] = (ConquestPoints_Integer[(Player number of (Picked player))] + (160 x (Number of living Control Point (Balrog) units owned by (Player((Player number of (Picked player)))))))
                  • Leaderboard - Change the value for (Player((Player number of (Picked player)))) in Conquest_Leaderboard to ConquestPoints_Integer[(Player number of (Picked player))]
                • Else - Actions
          • Leaderboard - Sort Conquest_Leaderboard by Value in Descending order
This is the corrected version. It worked with computer players. Now i just have to test with real players.

  • Income and Conquest Points
    • Events
      • Time - IncomeTimer expires
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • -------- Lumber --------
          • Player - Add ((Number of living Dwarven Fortress (Dwarves) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Gondor Fortress (Gondor) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Haradrim Fortress (Haradrim) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Mordor Fortress (Mordor) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Uruk-Hai Fortress (Isengard) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Elven Fortress (Elves) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add ((Number of living Rohan Fortress (Rohan) units owned by (Picked player)) x 8) to (Picked player).Current lumber
          • Player - Add (8 x (Number of living Control Point (Balrog) units owned by (Picked player))) to (Picked player).Current lumber
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of living Control Point units owned by (Picked player)) Equal to 1
            • Then - Actions
              • Player - Add 5 to (Picked player).Current lumber
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of living Control Point units owned by (Picked player)) Equal to 2
                • Then - Actions
                  • Player - Add 10 to (Picked player).Current lumber
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of living Control Point units owned by (Picked player)) Equal to 3
                    • Then - Actions
                      • Player - Add 14 to (Picked player).Current lumber
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of living Control Point units owned by (Picked player)) Equal to 4
                        • Then - Actions
                          • Player - Add 17 to (Picked player).Current lumber
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of living Control Point units owned by (Picked player)) Equal to 5
                            • Then - Actions
                              • Player - Add 19 to (Picked player).Current lumber
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Number of living Control Point units owned by (Picked player)) Equal to 6
                                • Then - Actions
                                  • Player - Add 20 to (Picked player).Current lumber
                                • Else - Actions
          • -------- Gold --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of living Control Point units owned by (Picked player)) Equal to 1
            • Then - Actions
              • Player - Add 300 to (Picked player).Current gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of living Control Point units owned by (Picked player)) Equal to 2
                • Then - Actions
                  • Player - Add 550 to (Picked player).Current gold
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of living Control Point units owned by (Picked player)) Equal to 3
                    • Then - Actions
                      • Player - Add 750 to (Picked player).Current gold
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of living Control Point units owned by (Picked player)) Equal to 4
                        • Then - Actions
                          • Player - Add 900 to (Picked player).Current gold
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of living Control Point units owned by (Picked player)) Equal to 5
                            • Then - Actions
                              • Player - Add 1000 to (Picked player).Current gold
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Number of living Control Point units owned by (Picked player)) Equal to 6
                                • Then - Actions
                                  • Player - Add 1050 to (Picked player).Current gold
                                • Else - Actions
          • Player - Add (500 x (Number of living Control Point (Balrog) units owned by (Picked player))) to (Picked player).Current gold
          • Player - Add ((Number of living Dwarven Fortress (Dwarves) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Gondor Fortress (Gondor) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Haradrim Fortress (Haradrim) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Mordor Fortress (Mordor) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Uruk-Hai Fortress (Isengard) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Elven Fortress (Elves) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Rohan Fortress (Rohan) units owned by (Picked player)) x 3500) to (Picked player).Current gold
          • Player - Add ((Number of living Dwarven Vassal Fortress (Dwarves) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Gondor Vassal Fortress (Gondor) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Haradrim Vassal Fortress (Haradrim) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Mordor Vassal Fortress (Mordor) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Uruk-Hai Vassal Fortress (Isengard) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Elven Vassal Fortress (Elves) units owned by (Picked player)) x 1000) to (Picked player).Current gold
          • Player - Add ((Number of living Rohan Vassal Fortress (Rohan) units owned by (Picked player)) x 1000) to (Picked player).Current gold
      • -------- ----------------------------------------Conquest Points---------------------------------------- --------
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) is in ConquestPoints_PlayerGroup.) Equal to True
            • Then - Actions
              • Set VariableSet ConquestPoints_Integer[(Player number of (Picked player))] = (ConquestPoints_Integer[(Player number of (Picked player))] + (80 x (Number of living Control Point units owned by (Player((Player number of (Picked player)))))))
              • Set VariableSet ConquestPoints_Integer[(Player number of (Picked player))] = (ConquestPoints_Integer[(Player number of (Picked player))] + (80 x (Number of living Control Point (Spiked Barricades) units owned by (Player((Player number of (Picked player)))))))
              • Set VariableSet ConquestPoints_Integer[(Player number of (Picked player))] = (ConquestPoints_Integer[(Player number of (Picked player))] + (160 x (Number of living Control Point (Balrog) units owned by (Player((Player number of (Picked player)))))))
              • Leaderboard - Change the value for (Player((Player number of (Picked player)))) in Conquest_Leaderboard to ConquestPoints_Integer[(Player number of (Picked player))]
            • Else - Actions
      • Leaderboard - Sort Conquest_Leaderboard by Value in Descending order
 
Last edited:
Level 18
Joined
Feb 2, 2009
Messages
217
It’s sometimes possible for the custom scripts like ‘BJ_wantDestroyGroup’ to snag on to ‘All Players’ in your map script and destroy it where you may not intend to if that is used elsewhere in your map.

In any case a good way of debugging this is to create a new player group variable and set it on game initialization to contain all players.

Then you can select all players in that new player group variable as opposed to ‘all players’ for your income trigger to see if it works.

If it DOES work after that then that means something must be destroying or otherwise interfering with ‘all players’ over the course of your game’s runtime.

If it still does not work after that then it must be something else, in which case I’m sure someone more experienced than me may have a solution.

Hope this helps friend!
 
Level 13
Joined
Sep 25, 2013
Messages
717
It’s sometimes possible for the custom scripts like ‘BJ_wantDestroyGroup’ to snag on to ‘All Players’ in your map script and destroy it where you may not intend to if that is used elsewhere in your map.

In any case a good way of debugging this is to create a new player group variable and set it on game initialization to contain all players.

Then you can select all players in that new player group variable as opposed to ‘all players’ for your income trigger to see if it works.

If it DOES work after that then that means something must be destroying or otherwise interfering with ‘all players’ over the course of your game’s runtime.

If it still does not work after that then it must be something else, in which case I’m sure someone more experienced than me may have a solution.

Hope this helps friend!
Thank you for your quick reply! I may have figured out the issue which i describe in my edited first post. I'll make sure its working though and report back if it is or isn't.
 
Level 13
Joined
Sep 25, 2013
Messages
717
Forgive me as this is irrelevant to your problem, but there's A LOT of memory leaks in your Income Amount trigger. I feel compelled to comment on it for the sake of your map's performance. I suppose it doesn't run too often, though.
I believe it, I don't understand much in the way of leaks. Could you tell me what areas are leaking? Thanks for pointing it out!
Does "(all players") in pick every player action?
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I believe it, I don't understand much in the way of leaks. Could you tell me what areas are leaking? Thanks for pointing it out!
Does "(all players") in pick every player action?
(All players) doesn't leak.

Here's an example of how you can improve your triggers to be both more efficient and avoid all memory leaks.

First you want to setup your data beforehand so that you can simplify things in your timer trigger:
  • Income Setup
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- [ Define the gold and lumber rewards for different buildings ] --------
      • -------- --------
      • -------- The Control Points have their own special rewards which are handled separately: --------
      • Set VariableSet Income_Control_Point_Lumber[1] = 5
      • Set VariableSet Income_Control_Point_Lumber[2] = 10
      • Set VariableSet Income_Control_Point_Lumber[3] = 14
      • Set VariableSet Income_Control_Point_Gold[1] = 300
      • Set VariableSet Income_Control_Point_Gold[2] = 550
      • Set VariableSet Income_Control_Point_Gold[3] = 750
      • -------- --------
      • -------- Moving onto the other Building types, define how many different Unit_Types we use below: --------
      • Set VariableSet Income_Unit_Type_Count = 4
      • -------- --------
      • -------- Control Point --------
      • Set VariableSet Income_Unit_Type[1] = Control Point
      • Set VariableSet Income_Gold_Rewards[1] = 500
      • Set VariableSet Income_Lumber_Rewards[1] = 8
      • -------- --------
      • -------- Gondor Fortress --------
      • Set VariableSet Income_Unit_Type[2] = Gondor Fortress (Gondor)
      • Set VariableSet Income_Gold_Rewards[2] = 3500
      • Set VariableSet Income_Lumber_Rewards[2] = 8
      • -------- --------
      • -------- Haradrim Fortress --------
      • Set VariableSet Income_Unit_Type[3] = Haradrim Fortress (Haradrim)
      • Set VariableSet Income_Gold_Rewards[3] = 3500
      • Set VariableSet Income_Lumber_Rewards[3] = 8
      • -------- --------
      • -------- Mordor Fortress --------
      • Set VariableSet Income_Unit_Type[4] = Mordor Fortress (Mordor)
      • Set VariableSet Income_Gold_Rewards[4] = 3500
      • Set VariableSet Income_Lumber_Rewards[4] = 8
The [index] for the Control_Point variables represents how many of those Control Points you control. So if you control 2, then you'll gain 10 lumber and 550 gold. The [index] for the other Income variables uses a simple pattern of starting at [1] and working up from there, this is so we can easily reference this data in a For Loop later on.

Note that I only setup this trigger to work for 3 Control Points and 3 of those Buildings that I picked at random. I obviously don't have access to your map so you'll need to go through and customize this Setup trigger to work with your map. The Income Amount trigger should work without any adjustments needed as it relies entirely on the Setup trigger. Just don't forget to give it an Event for when your Timer expires, which I excluded from my example.

Then here's the timer trigger that rewards each Player every X seconds:
  • Income Amount
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set VariableSet Income_Player = (Picked player)
          • -------- --------
          • -------- Reset variables used to calculate rewards for this Player: --------
          • Set VariableSet Income_Gold_Reward = 0
          • Set VariableSet Income_Lumber_Reward = 0
          • Set VariableSet Income_Control_Point_Count = 0
          • -------- --------
          • -------- Apply generic rewards for owning certain amounts of each building: --------
          • Set VariableSet Income_Unit_Group = (Units owned by Income_Player matching ((((Matching unit) is A structure) Equal to True) and (((Matching unit) is alive) Equal to True)).)
          • Unit Group - Pick every unit in Income_Unit_Group and do (Actions)
            • Loop - Actions
              • Set VariableSet Income_Unit_Type[0] = (Unit-type of (Picked unit))
              • For each (Integer Income_Loop) from 1 to Income_Unit_Type_Count, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Income_Unit_Type[0] Equal to Income_Unit_Type[Income_Loop]
                    • Then - Actions
                      • Set VariableSet Income_Gold_Reward = (Income_Gold_Reward + Income_Gold_Rewards[Income_Loop])
                      • Set VariableSet Income_Lumber_Reward = (Income_Lumber_Reward + Income_Lumber_Rewards[Income_Loop])
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Income_Unit_Type[0] Equal to Control Point
                        • Then - Actions
                          • Set VariableSet Income_Control_Point_Count = (Income_Control_Point_Count + 1)
                        • Else - Actions
                      • Skip remaining actions
                    • Else - Actions
          • Custom script: call DestroyGroup( udg_Income_Unit_Group )
          • -------- --------
          • -------- Apply special control point rewards for reaching certain amounts: --------
          • Set VariableSet Income_Gold_Reward = (Income_Gold_Reward + Income_Control_Point_Gold[Income_Control_Point_Count])
          • Set VariableSet Income_Lumber_Reward = (Income_Lumber_Reward + Income_Control_Point_Lumber[Income_Control_Point_Count])
          • -------- --------
          • -------- Lastly, give the Player their rewards: --------
          • Player - Add Income_Gold_Reward to Income_Player.Current gold
          • Player - Add Income_Lumber_Reward to Income_Player.Current lumber
So the idea is to take advantage of Array data that we've setup at the start of the game in order to simplify the gold/lumber calculations. Then use a single Unit Group to detect all of the Units owned by our Player, Loop over the Array data to compare the Units in that group to our stored building types, and increase the rewards as needed. We avoid all of your original memory leaks by using this one Unit Group to temporarily store the units and reference them before destroying it. In your original trigger you were leaking 1 Unit Group every single time you used the function (Number of living units owned by player). Also, note that we Add the Gold/Lumber in one single Action by summing the values during the calculation process, avoiding unnecessary complication and repetition.
 

Attachments

  • Income Reward Cleaned Up 1.w3m
    19.8 KB · Views: 4
Last edited:
Level 13
Joined
Sep 25, 2013
Messages
717
(All players) doesn't leak.

Here's an example of how you can improve your triggers to be both more efficient and avoid all memory leaks.

First you want to setup your data beforehand so that you can simplify things in your timer trigger:
  • Income Setup
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- [ Define the gold and lumber rewards for different buildings ] --------
      • -------- --------
      • -------- The Control Points have their own special rewards which are handled separately: --------
      • Set VariableSet Income_Control_Point_Lumber[1] = 5
      • Set VariableSet Income_Control_Point_Lumber[2] = 10
      • Set VariableSet Income_Control_Point_Lumber[3] = 14
      • Set VariableSet Income_Control_Point_Gold[1] = 300
      • Set VariableSet Income_Control_Point_Gold[2] = 550
      • Set VariableSet Income_Control_Point_Gold[3] = 750
      • -------- --------
      • -------- Moving onto the other Building types, define how many different Unit_Types we use below: --------
      • Set VariableSet Income_Unit_Type_Count = 4
      • -------- --------
      • -------- Control Point --------
      • Set VariableSet Income_Unit_Type[1] = Control Point
      • Set VariableSet Income_Gold_Rewards[1] = 500
      • Set VariableSet Income_Lumber_Rewards[1] = 8
      • -------- --------
      • -------- Gondor Fortress --------
      • Set VariableSet Income_Unit_Type[2] = Gondor Fortress (Gondor)
      • Set VariableSet Income_Gold_Rewards[2] = 3500
      • Set VariableSet Income_Lumber_Rewards[2] = 8
      • -------- --------
      • -------- Haradrim Fortress --------
      • Set VariableSet Income_Unit_Type[3] = Haradrim Fortress (Haradrim)
      • Set VariableSet Income_Gold_Rewards[3] = 3500
      • Set VariableSet Income_Lumber_Rewards[3] = 8
      • -------- --------
      • -------- Mordor Fortress --------
      • Set VariableSet Income_Unit_Type[4] = Mordor Fortress (Mordor)
      • Set VariableSet Income_Gold_Rewards[4] = 3500
      • Set VariableSet Income_Lumber_Rewards[4] = 8
The [index] for the Control_Point variables represents how many of those Control Points you control. So if you control 2, then you'll gain 10 lumber and 550 gold. The [index] for the other Income variables uses a simple pattern of starting at [1] and working up from there, this is so we can easily reference this data in a For Loop later on.

Note that I only setup this trigger to work for 3 Control Points and 3 of those Buildings that I picked at random. I obviously don't have access to your map so you'll need to go through and customize this Setup trigger to work with your map. The Income Amount trigger should work without any adjustments needed as it relies entirely on the Setup trigger. Just don't forget to give it an Event for when your Timer expires, which I excluded from my example.

Then here's the timer trigger that rewards each Player every X seconds:
  • Income Amount
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set VariableSet Income_Player = (Picked player)
          • -------- --------
          • -------- Reset variables used to calculate rewards for this Player: --------
          • Set VariableSet Income_Gold_Reward = 0
          • Set VariableSet Income_Lumber_Reward = 0
          • Set VariableSet Income_Control_Point_Count = 0
          • -------- --------
          • -------- Apply generic rewards for owning certain amounts of each building: --------
          • Set VariableSet Income_Unit_Group = (Units owned by Income_Player matching ((((Matching unit) is A structure) Equal to True) and (((Matching unit) is alive) Equal to True)).)
          • Unit Group - Pick every unit in Income_Unit_Group and do (Actions)
            • Loop - Actions
              • Set VariableSet Income_Unit_Type[0] = (Unit-type of (Picked unit))
              • For each (Integer Income_Loop) from 1 to Income_Unit_Type_Count, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Income_Unit_Type[0] Equal to Income_Unit_Type[Income_Loop]
                    • Then - Actions
                      • Set VariableSet Income_Gold_Reward = (Income_Gold_Reward + Income_Gold_Rewards[Income_Loop])
                      • Set VariableSet Income_Lumber_Reward = (Income_Lumber_Reward + Income_Lumber_Rewards[Income_Loop])
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Income_Unit_Type[0] Equal to Control Point
                        • Then - Actions
                          • Set VariableSet Income_Control_Point_Count = (Income_Control_Point_Count + 1)
                        • Else - Actions
                      • Skip remaining actions
                    • Else - Actions
          • Custom script: call DestroyGroup( udg_Income_Unit_Group )
          • -------- --------
          • -------- Apply special control point rewards for reaching certain amounts: --------
          • Set VariableSet Income_Gold_Reward = (Income_Gold_Reward + Income_Control_Point_Gold[Income_Control_Point_Count])
          • Set VariableSet Income_Lumber_Reward = (Income_Lumber_Reward + Income_Control_Point_Lumber[Income_Control_Point_Count])
          • -------- --------
          • -------- Lastly, give the Player their rewards: --------
          • Player - Add Income_Gold_Reward to Income_Player.Current gold
          • Player - Add Income_Lumber_Reward to Income_Player.Current lumber
So the idea is to take advantage of Array data that we've setup at the start of the game in order to simplify the gold/lumber calculations. Then use a single Unit Group to detect all of the Units owned by our Player, Loop over the Array data to compare the Units in that group to our stored building types, and increase the rewards as needed. We avoid all of your original memory leaks by using this one Unit Group to temporarily store the units and reference them before destroying it. In your original trigger you were leaking 1 Unit Group every single time you used the function (Number of living units owned by player). Also, note that we Add the Gold/Lumber in one single Action by summing the values during the calculation process, avoiding unnecessary complication and repetition.

Wow thank you for going so far to help me! Was it the "add number of living unit type owned by picked player to picked player resource" that was leaking? I just don't know which part was leaking.

I'm going to try and use your system, so thank you very much for that!
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Wow thank you for going so far to help me! Was it the "add number of living unit type owned by picked player to picked player resource" that was leaking? I just don't know which part was leaking.

I'm going to try and use your system, so thank you very much for that!
No problem, and yes, a leak would occur whenever you ran the function (Number of living units owned by player). This function creates a Unit Group in order to count the number of units, and then fails to destroy that group which creates a leak.

Edit: Actually, it's leak isn't as bad as I thought, it destroys the Unit Group but leaks a handle.
Here's the code

Either way, it leaks, and my solution will prevent that. Plus the trigger is much more optimized now, regardless of leaks.
 
Last edited:
Level 13
Joined
Sep 25, 2013
Messages
717
No problem, and yes, a leak would occur whenever you ran the function (Number of living units owned by player). This function creates a Unit Group in order to count the number of units, and then fails to destroy that group which creates a leak.

Edit: Actually, it's leak isn't as bad as I thought, it destroys the Unit Group but leaks a handle.
Here's the code

Either way, it leaks, and my solution will prevent that. Plus the trigger is much more optimized now, regardless of leaks.
I see, well thank you!

Everything is working with the system you gave me except for the control points which have a separate reward amount. Regardless of how many are under my control, they currently are contributing 0 income. Im trying to figure out why but I think you'll see faster than me.

  • Income Setup
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- [ Define the gold and lumber rewards for different buildings ] --------
      • -------- --------
      • -------- The Control Points have their own special rewards which are handled separately: --------
      • -------- Regular Control Point --------
      • Set VariableSet Income_Control_Point_Type = Control Point
      • Set VariableSet Income_Control_Point_Lumber[1] = 5
      • Set VariableSet Income_Control_Point_Lumber[2] = 10
      • Set VariableSet Income_Control_Point_Lumber[3] = 14
      • Set VariableSet Income_Control_Point_Lumber[4] = 17
      • Set VariableSet Income_Control_Point_Lumber[5] = 19
      • Set VariableSet Income_Control_Point_Lumber[6] = 20
      • Set VariableSet Income_Control_Point_Gold[1] = 300
      • Set VariableSet Income_Control_Point_Gold[2] = 550
      • Set VariableSet Income_Control_Point_Gold[3] = 750
      • Set VariableSet Income_Control_Point_Gold[4] = 900
      • Set VariableSet Income_Control_Point_Gold[5] = 1000
      • Set VariableSet Income_Control_Point_Gold[6] = 1050
      • -------- --------
      • -------- Moving onto the other Building types, define how many different Unit_Types we use below: --------
      • Set VariableSet Income_Unit_Type_Count = 15
      • -------- --------
      • -------- Balrog Control Point --------
      • Set VariableSet Income_Unit_Type[1] = Control Point (Balrog)
      • Set VariableSet Income_Gold_Rewards[1] = 500
      • Set VariableSet Income_Lumber_Rewards[1] = 8
      • -------- --------
      • -------- Dwarven Fortress --------
      • Set VariableSet Income_Unit_Type[2] = Dwarven Fortress (Dwarves)
      • Set VariableSet Income_Gold_Rewards[2] = 3500
      • Set VariableSet Income_Lumber_Rewards[2] = 8
      • -------- --------
      • -------- Gondor Fortress --------
      • Set VariableSet Income_Unit_Type[3] = Gondor Fortress (Gondor)
      • Set VariableSet Income_Gold_Rewards[3] = 3500
      • Set VariableSet Income_Lumber_Rewards[3] = 8
      • -------- --------
      • -------- Haradrim Fortress --------
      • Set VariableSet Income_Unit_Type[4] = Haradrim Fortress (Haradrim)
      • Set VariableSet Income_Gold_Rewards[4] = 3500
      • Set VariableSet Income_Lumber_Rewards[4] = 8
      • -------- --------
      • -------- Mordor Fortress --------
      • Set VariableSet Income_Unit_Type[5] = Mordor Fortress (Mordor)
      • Set VariableSet Income_Gold_Rewards[5] = 3500
      • Set VariableSet Income_Lumber_Rewards[5] = 8
      • -------- --------
      • -------- Rohan Fortress --------
      • Set VariableSet Income_Unit_Type[6] = Rohan Fortress (Rohan)
      • Set VariableSet Income_Gold_Rewards[6] = 3500
      • Set VariableSet Income_Lumber_Rewards[6] = 8
      • -------- --------
      • -------- Isengard Fortress --------
      • Set VariableSet Income_Unit_Type[7] = Uruk-Hai Fortress (Isengard)
      • Set VariableSet Income_Gold_Rewards[7] = 3500
      • Set VariableSet Income_Lumber_Rewards[7] = 8
      • -------- --------
      • -------- Elven Fortress --------
      • Set VariableSet Income_Unit_Type[8] = Elven Fortress (Elves)
      • Set VariableSet Income_Gold_Rewards[8] = 3500
      • Set VariableSet Income_Lumber_Rewards[8] = 8
      • -------- --------
      • -------- Dwarven Vassal Fortress --------
      • Set VariableSet Income_Unit_Type[9] = Dwarven Vassal Fortress (Dwarves)
      • Set VariableSet Income_Gold_Rewards[9] = 3500
      • Set VariableSet Income_Lumber_Rewards[9] = 5
      • -------- --------
      • -------- Gondor Vassal Fortress --------
      • Set VariableSet Income_Unit_Type[10] = Gondor Vassal Fortress (Gondor)
      • Set VariableSet Income_Gold_Rewards[10] = 3500
      • Set VariableSet Income_Lumber_Rewards[10] = 5
      • -------- --------
      • -------- Haradrim Vassal Fortress --------
      • Set VariableSet Income_Unit_Type[11] = Haradrim Vassal Fortress (Haradrim)
      • Set VariableSet Income_Gold_Rewards[11] = 3500
      • Set VariableSet Income_Lumber_Rewards[11] = 5
      • -------- --------
      • -------- Mordor Vassal Fortress --------
      • Set VariableSet Income_Unit_Type[12] = Mordor Vassal Fortress (Mordor)
      • Set VariableSet Income_Gold_Rewards[12] = 3500
      • Set VariableSet Income_Lumber_Rewards[12] = 5
      • -------- --------
      • -------- Rohan Vassal Fortress --------
      • Set VariableSet Income_Unit_Type[13] = Rohan Vassal Fortress (Rohan)
      • Set VariableSet Income_Gold_Rewards[13] = 3500
      • Set VariableSet Income_Lumber_Rewards[13] = 5
      • -------- --------
      • -------- Isengard Vassal Fortress --------
      • Set VariableSet Income_Unit_Type[14] = Uruk-Hai Vassal Fortress (Isengard)
      • Set VariableSet Income_Gold_Rewards[14] = 3500
      • Set VariableSet Income_Lumber_Rewards[14] = 5
      • -------- --------
      • -------- Elven Vassal Fortress --------
      • Set VariableSet Income_Unit_Type[15] = Elven Vassal Fortress (Elves)
      • Set VariableSet Income_Gold_Rewards[15] = 3500
      • Set VariableSet Income_Lumber_Rewards[15] = 5

  • Income Amount New
    • Events
      • Time - IncomeTimer expires
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set VariableSet Income_Player = (Picked player)
          • -------- --------
          • -------- Reset variables used to calculate rewards for this Player: --------
          • Set VariableSet Income_Gold_Reward = 0
          • Set VariableSet Income_Lumber_Reward = 0
          • Set VariableSet Income_Control_Point_Count = 0
          • -------- --------
          • -------- Apply generic rewards for owning certain amounts of each building: --------
          • Set VariableSet Income_Unit_Group = (Units owned by Income_Player matching ((((Matching unit) is A structure) Equal to True) and (((Matching unit) is alive) Equal to True)).)
          • Unit Group - Pick every unit in Income_Unit_Group and do (Actions)
            • Loop - Actions
              • Set VariableSet Income_Unit_Type[0] = (Unit-type of (Picked unit))
              • For each (Integer Income_Loop) from 1 to Income_Unit_Type_Count, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Income_Unit_Type[0] Equal to Income_Unit_Type[Income_Loop]
                    • Then - Actions
                      • Set VariableSet Income_Gold_Reward = (Income_Gold_Reward + Income_Gold_Rewards[Income_Loop])
                      • Set VariableSet Income_Lumber_Reward = (Income_Lumber_Reward + Income_Lumber_Rewards[Income_Loop])
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Income_Unit_Type[0] Equal to Control Point
                        • Then - Actions
                          • Set VariableSet Income_Control_Point_Count = (Income_Control_Point_Count + 1)
                        • Else - Actions
                      • Skip remaining actions
                    • Else - Actions
          • Custom script: call DestroyGroup (udg_Income_Unit_Group)
          • -------- --------
          • -------- Apply special control point rewards for reaching certain amounts: --------
          • Set VariableSet Income_Gold_Reward = (Income_Gold_Reward + Income_Control_Point_Gold[Income_Control_Point_Count])
          • Set VariableSet Income_Lumber_Reward = (Income_Lumber_Reward + Income_Control_Point_Lumber[Income_Control_Point_Count])
          • -------- --------
          • -------- Lastly, give the Player their rewards: --------
          • Player - Add Income_Gold_Reward to Income_Player.Current gold
          • Player - Add Income_Lumber_Reward to Income_Player.Current lumber
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
It looks like you have two different types of Control Points: Control Point (Balrog) and Control Point.

Maybe that's the issue? Otherwise, it could be that the Control Points are not Structures:
  • Set VariableSet Income_Unit_Group = (Units owned by Income_Player matching ((((Matching unit) is A structure) Equal to True) and (((Matching unit) is alive) Equal to True)).)
Lastly, the Income_Control_Point_Type variable is unused, although I think that's a mistake on my part. You can just delete it.


Edit:

Okay, I see the issue, it's because I only increase Income_Control_Point_Count when this Condition is met:
  • Income_Unit_Type[0] Equal to Income_Unit_Type[Income_Loop]
Since the normal Control Points are not included in the For Loop you will need to reposition the "increase actions" so that they occur regardless:
  • Unit Group - Pick every unit in Income_Unit_Group and do (Actions)
    • Loop - Actions
      • Set VariableSet Income_Unit_Type[0] = (Unit-type of (Picked unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Income_Unit_Type[0] Equal to Control Point
        • Then - Actions
          • Set VariableSet Income_Control_Point_Count = (Income_Control_Point_Count + 1)
        • Else - Actions
      • For each (Integer Income_Loop) from 1 to Income_Unit_Type_Count, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Income_Unit_Type[0] Equal to Income_Unit_Type[Income_Loop]
            • Then - Actions
              • Set VariableSet Income_Gold_Reward = (Income_Gold_Reward + Income_Gold_Rewards[Income_Loop])
              • Set VariableSet Income_Lumber_Reward = (Income_Lumber_Reward + Income_Lumber_Rewards[Income_Loop])
              • Skip remaining actions
            • Else - Actions
So simply drag and drop that If Then Else to be above the For Loop rather than inside of it.
 
Last edited:
Level 13
Joined
Sep 25, 2013
Messages
717
It looks like you have two different types of Control Points: Control Point (Balrog) and Control Point.

Maybe that's the issue? Otherwise, it could be that the Control Points are not Structures:
  • Set VariableSet Income_Unit_Group = (Units owned by Income_Player matching ((((Matching unit) is A structure) Equal to True) and (((Matching unit) is alive) Equal to True)).)
Lastly, the Income_Control_Point_Type variable is unused, although I think that's a mistake on my part. You can just delete it.


Edit:

Okay, I see the issue, it's because I only increase Income_Control_Point_Count when this Condition is met:
  • Income_Unit_Type[0] Equal to Income_Unit_Type[Income_Loop]
Since the normal Control Points are not included in the For Loop you will need to reposition the "increase actions" so that they occur regardless:
  • Unit Group - Pick every unit in Income_Unit_Group and do (Actions)
    • Loop - Actions
      • Set VariableSet Income_Unit_Type[0] = (Unit-type of (Picked unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Income_Unit_Type[0] Equal to Control Point
        • Then - Actions
          • Set VariableSet Income_Control_Point_Count = (Income_Control_Point_Count + 1)
        • Else - Actions
      • For each (Integer Income_Loop) from 1 to Income_Unit_Type_Count, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Income_Unit_Type[0] Equal to Income_Unit_Type[Income_Loop]
            • Then - Actions
              • Set VariableSet Income_Gold_Reward = (Income_Gold_Reward + Income_Gold_Rewards[Income_Loop])
              • Set VariableSet Income_Lumber_Reward = (Income_Lumber_Reward + Income_Lumber_Rewards[Income_Loop])
              • Skip remaining actions
            • Else - Actions
So simply drag and drop that If Then Else to be above the For Loop rather than inside of it.

Theres the ticket! Now its working as smooth as a well oiled bear trap! Thanks once again!
 
Top