So I got this embedded loop error in my code and I am not sure what causes it. I have tried a lot like making extra variables for the picked units.
What I am trying to do is search for units of the type buff around a buff respawn (the unit Powerups). Then if there is a unit nearby the custom value 2 of Powerups should be increasing until it reaches a certain value and respawns another one. Maybe there is an even simpler way of doing it?
Sorry for the long post but there was no option to use a spoiler.
You need to switch it to use..... unit i of unit group
It is pointless to set a variable to = picked unit unless you are going to refer to that unit after the loop. Which you are not doing.
Why are you looping through all your power ups on the map? I would think theres more effienct ways for doing something similiar
to re-spawn your buffs. make a unit that has a behavior that spawns your power ups. I see from your code your spawning them through triggers. change it to do it all from data
to detect units near power ups, give the power up a behavior that does an effect to all unit in the search area around itself. Detect this effect being using from a trigger and do what ever custom value changing you need to do at that point. if you really don't need to change the custom value you may be able to just have each power up apply a buff behavior to the units in range. This behavior can be stack-able to indicate that the unit is in range of multiple power ups.
this way you avoid having to loop through all the shit anyways....
So I got this embedded loop error in my code and I am not sure what causes it. I have tried a lot like making extra variables for the picked units. What I am trying to do is search for units of the type buff around a buff respawn (the unit Powerups). Then if there is a unit nearby the custom value 2 of Powerups should be increasing until it reaches a certain value and respawns another one. Maybe there is an even simpler way of doing it? Sorry for the long post but there was no option to use a spoiler.
@Zer0kx: Go
You can not use pick each unit within itself...
same goes for pick each player
or any pick each
Why are you looping through all your power ups on the map? I would think theres more effienct ways for doing something similiar
this way you avoid having to loop through all the shit anyways....