You need to do a loop that systematically checks the stack count of each unit and has a highest stack local variable and highest stack unit variable. You then do a comparison of if the local variable has no value set the highest stack to the value for the index unit. You then set the index unit to the second variable if the current index unit stack is greater than the highest stack variable. At the end of the loop you then return the unit associated with the highest stack. Use the Closest Unit To Point Old function as a guide.
Thank you very much for your reply. I basically unterstand what you mean. But a litte more detailed example how it works would be very great..! Thank you again.
As stated look at the Closest Unit To Point Old function. How it functions is it does a binary comparison of each unit in the group where the higher unit is stored as a variable and used for the next comparison until all units have been compared. It then returns the unit that remains.
Rollback Post to RevisionRollBack
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
is there a way, to easily get the unit with highest behavior Stack count in a unit group in a trigger?
Alternatively, you can create a Function that looks like below:-
Get Unit From Unit Group with Number of Behaviours More Than
Return Type : Unit
Parameters : Unit Group = Empty Unit Group <Unit Group>, Number of Behaviours = 0 <Integer>
Actions :-
Pick Each Unit In Unit Group [Parameter]
Actions:-
If
And
Conditions :-
(Number of Behaviours on (Picked Unit)) > Number of Behaviours [Parameter]
((Picked Unit) is in Unit Group [Parameter] == True
Then
Return (Picked Unit)
Return No Unit [Preset]
Then, create and set a Unit Variable to the function as above, where the Variable references the picked unit from said unit group with the highest number of behaviours.
That function just returns the first unit that has over a threshold number of behaviour stacks and not the single unit in the group with the most stacks.
Rollback Post to RevisionRollBack
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
That function just returns the first unit that has over a threshold number of behaviour stacks and not the single unit in the group with the most stacks.
I figured it out. Thank you very much again! :-)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hello everyone,
is there a way, to easily get the unit with highest behavior Stack count in a unit group in a trigger?
Thanks,
Fletscher
You need to do a loop that systematically checks the stack count of each unit and has a highest stack local variable and highest stack unit variable. You then do a comparison of if the local variable has no value set the highest stack to the value for the index unit. You then set the index unit to the second variable if the current index unit stack is greater than the highest stack variable. At the end of the loop you then return the unit associated with the highest stack. Use the Closest Unit To Point Old function as a guide.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
Thank you very much for your reply. I basically unterstand what you mean. But a litte more detailed example how it works would be very great..! Thank you again.
As stated look at the Closest Unit To Point Old function. How it functions is it does a binary comparison of each unit in the group where the higher unit is stored as a variable and used for the next comparison until all units have been compared. It then returns the unit that remains.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
That function just returns the first unit that has over a threshold number of behaviour stacks and not the single unit in the group with the most stacks.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg