I have a trigger that searches for untis owned by a player group, in this case the group is Team 1 as determined in the lobby, but when i display the number that the trigger has found, it shows only the units owned by the player first in the index of the picked players.
Overall how do i Make a trigger search for units that owned owned by an array/group of players?
Yea that is the actin part of my trigger... but im pretty sure it only records the first player it picks, or maybe the last player.
Heres the setup of my trigger:
-Events
Timer - Every 1.0 seconds of Game Time
Actions
Player Group - Pick each player in (Players on team 1) and do (Actions)
Actions
Unit Group - Pick each unit in (Command Point - Fuel units in (Entire map) owned by player (Picked player) matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Variable - Set Fuel Flags Team 1 = (Number of Living units in (Unit group((Picked unit))))
here the issue with that: the ownership changes numerous times throughout the game, so do this would require me to add a trigger that subtracts one from the integer, in this case would be ridiculously complex. Also, it does find multiple units of the type it looks for, the issue is that it wont find units owned by each player in the Player group(Team 1) and combine them.
I do believe i need to take count of ownership because the ORIGINAL owner is always player 15, and over the time of the game players will take over these flags, as in thye become the owner of that flag/unit so im pretty sure i must count the owners.Ill give the "tweaked" but still not functioning trigger action:
- Actions
Player Group - Pick each player in (Players on team 1) and do (Actions)
- - - Actions
Unit Group - Pick each unit in (Command Point - Fuel units in (Entire map) owned by player (Picked player) matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
- - - - - - -Actions
Variable - Set Fuel Flags Team 1 = (Number of Living units in (Command Point - Fuel units in (Entire map) owned by player (Picked player) matching Excluded: Missile, Dead, Hidden, with at most Any Amount))
This is the setup of the trigger, and it doesnt record them correctly.
They dont "return" to player 15, there are two teams of 3 human players, and the ownerswhip will go between there 6 players throughout the game duration. Also simply adding wont work, because the trigger it periodic every 1 second to check for ownership changes... sorry i forgot to mention the periodic event in the trigger layout.
I made a map real quick which counts all of the units in a player group and says it in a message. You can also add/remove units from the game and check the count again.
The problem you are having is probably not with your triggers, but with how the editor interacts with computer players. For some reason it never counts more than one computer player on a team. This does not happen on Battle.net, so you could always publish your map to test it. But using "Test Map" you won't find more than a single computer player on a team, or at least be able to communicate with any computers on a team other than the first one.
To get around the issue you can add all of the computers into a separate player group like I have (called "Computers"). This player group will report computer players just fine, unlike "Players on Team". Even if this isn't the problem you are having, this sample map should help.
I have a trigger that searches for untis owned by a player group, in this case the group is Team 1 as determined in the lobby, but when i display the number that the trigger has found, it shows only the units owned by the player first in the index of the picked players.
Overall how do i Make a trigger search for units that owned owned by an array/group of players?
Yea that is the actin part of my trigger... but im pretty sure it only records the first player it picks, or maybe the last player.
Heres the setup of my trigger:
-Events Timer - Every 1.0 seconds of Game Time
Actions Player Group - Pick each player in (Players on team 1) and do (Actions)
Actions Unit Group - Pick each unit in (Command Point - Fuel units in (Entire map) owned by player (Picked player) matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions Variable - Set Fuel Flags Team 1 = (Number of Living units in (Unit group((Picked unit))))
here the issue with that: the ownership changes numerous times throughout the game, so do this would require me to add a trigger that subtracts one from the integer, in this case would be ridiculously complex. Also, it does find multiple units of the type it looks for, the issue is that it wont find units owned by each player in the Player group(Team 1) and combine them.
I do believe i need to take count of ownership because the ORIGINAL owner is always player 15, and over the time of the game players will take over these flags, as in thye become the owner of that flag/unit so im pretty sure i must count the owners.Ill give the "tweaked" but still not functioning trigger action:
- Actions Player Group - Pick each player in (Players on team 1) and do (Actions)
- - - Actions Unit Group - Pick each unit in (Command Point - Fuel units in (Entire map) owned by player (Picked player) matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
- - - - - - -Actions Variable - Set Fuel Flags Team 1 = (Number of Living units in (Command Point - Fuel units in (Entire map) owned by player (Picked player) matching Excluded: Missile, Dead, Hidden, with at most Any Amount))
This is the setup of the trigger, and it doesnt record them correctly.
They dont "return" to player 15, there are two teams of 3 human players, and the ownerswhip will go between there 6 players throughout the game duration. Also simply adding wont work, because the trigger it periodic every 1 second to check for ownership changes... sorry i forgot to mention the periodic event in the trigger layout.
okay i understand now, ill tell you if it works after i test it.
Nope, it just count 1 and thats it.
I made a map real quick which counts all of the units in a player group and says it in a message. You can also add/remove units from the game and check the count again.
The problem you are having is probably not with your triggers, but with how the editor interacts with computer players. For some reason it never counts more than one computer player on a team. This does not happen on Battle.net, so you could always publish your map to test it. But using "Test Map" you won't find more than a single computer player on a team, or at least be able to communicate with any computers on a team other than the first one.
To get around the issue you can add all of the computers into a separate player group like I have (called "Computers"). This player group will report computer players just fine, unlike "Players on Team". Even if this isn't the problem you are having, this sample map should help.
Anyways here is the map.
Hope this helps.