You shouldn't do that, looping the same pick each unit may get you an error since they loop using a variable called Picked unit so there's no way to consider which picked unit you want for the second loop. I would consider use a combination of Pick each unit and For each unit in unit group. With the For loop you can stick a local var for it
use the for each unit, as a replacement for one of the 2 pick each loops. You'll need to define your own unit variable then though, but it does the same as the for each unit loop. Which is setting a variable to the current unit it is checking.
The "Pick Each" functions are a convenience for people who don't understand how to make their own index variable for a for loop. They use a global variable to handle looping, hence they cannot be nested. Just use a for loop.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I have a problem, that I cannot pick units in a pick each unit loop.
I want to kill the units of the second unit group. How can I do this?
@WiiKing: Go
You shouldn't do that, looping the same pick each unit may get you an error since they loop using a variable called Picked unit so there's no way to consider which picked unit you want for the second loop. I would consider use a combination of Pick each unit and For each unit in unit group. With the For loop you can stick a local var for it
The first loop is unnecessary... The second loop will loop through all units within the region...
As for why it's not working, I'd have to open the editor and check the syntax for that region you're creating.
There is a nice region function that is a circle around a unit with radius r. Might want to look into that
@progammer: Go Now it works with one For each unit in unit group. Thanks.
The first loop is necessary because the second uses the picked unit.
Where? Didn't see.^^
@WiiKing: Go
use the for each unit, as a replacement for one of the 2 pick each loops. You'll need to define your own unit variable then though, but it does the same as the for each unit loop. Which is setting a variable to the current unit it is checking.
The "Pick Each" functions are a convenience for people who don't understand how to make their own index variable for a for loop. They use a global variable to handle looping, hence they cannot be nested. Just use a for loop.