I need something like: create 2 guardians at x location
give last created unit y buff
Except the function last created unit will not give to both of them. I don't want to put the buff on a type of unit because it will change. So I want to put a particular buff, based on conditionals, on a unit.
Pick every unit in last created unit group and then in the loop add the behaviour to the picked unit. Works because it adds the behaviour to all created units.
Another approach would be to repeat actions 2 times. In the loop place a create unit for just a single unit and then add the behaviour to last created unit. Works because it creates a single unit 2 times.
The problem is, there are 6 players, each creating units for a time limit, which may differ from another player. Creating a loop and singularly adding buff seems like a longer, inefficient way.
I thought up of something after I posted shown as attachment.
Meanwhile, as the number of ultralisk caverns change, the more # of guardians and/or the longer the guardians last.
Creating a loop and singularly adding buff seems like a longer, inefficient way.
How many thousand times per frame are you planning on running this?! Does not matter if it is inefficient, better to get it working.
I thought up of something after I posted shown as attachment.
One second you worry about efficiency then you do that... Counting units in group matching and enumerating units in an area are both computationally expensive operations.
Pick every unit in last created unit group and then add a behaviour to them. Keep each type of building in a separate group so counting is more efficient.
Is it possible to create a unit with a behavior.
I need something like: create 2 guardians at x location
give last created unit y buff
Except the function last created unit will not give to both of them. I don't want to put the buff on a type of unit because it will change. So I want to put a particular buff, based on conditionals, on a unit.
https://www.sc2mapster.com/forums/development/data/228160-timed-life-like-infested-terran-turret is the buff that I want to apply, basically a timer for the unit.
Pick every unit in last created unit group and then in the loop add the behaviour to the picked unit. Works because it adds the behaviour to all created units.
Another approach would be to repeat actions 2 times. In the loop place a create unit for just a single unit and then add the behaviour to last created unit. Works because it creates a single unit 2 times.
The problem is, there are 6 players, each creating units for a time limit, which may differ from another player.
Creating a loop and singularly adding buff seems like a longer, inefficient way.
I thought up of something after I posted shown as attachment.
Meanwhile, as the number of ultralisk caverns change, the more # of guardians and/or the longer the guardians last.
How many thousand times per frame are you planning on running this?! Does not matter if it is inefficient, better to get it working.
One second you worry about efficiency then you do that... Counting units in group matching and enumerating units in an area are both computationally expensive operations.
Pick every unit in last created unit group and then add a behaviour to them. Keep each type of building in a separate group so counting is more efficient.
Ok I'll use a loop, thanks!