| 11-24-2002, 11:30 PM | #1 |
ok, i have a trigger that picks every unit in a region and explodes that unit looks like this: for every integer a from 1 to spread do: pick every unit in (region centered at ((position of (triggering unit)) offset by ((128 x real(loop integer a),0) with size (128,128)) and do unit-explode (picked unit). now, this is workin great, except now i wanted to replace the Unit - explode (picked unit) part of the pick every unit and explode with: if (units in (region centered at ((position of (triggering unit)) offset by ((128 x real(loop integer a),0) with size (128,128)) is empty then do nothing else: unit - explode (picked unit) (somehow break out of loop) i want this so that if there is no unit in that region, then it'll continue on and check 128 degrees to the right of there in that region and check for units, and so on till either it gets to the end of the loop (limited by the spread variable) or it gets to a unit. if it finds a unit, then it'll explode it and break out of the loop (so it won't continue on and check the next place for more units and possibly explode those). anyway, in short, id like to kno if theres anyway i can break out of the loop. custom text is fine since im gonna have to convert this to custom text anyway in order to get multiple then/else's in the same if statement. i thought about skip remaining actions, but i think it'd just finish that loop, and anyway i want the other actions to still work as well. |
| 11-24-2002, 11:48 PM | #2 |
Hmm, in custom text it's easy. It might also be easy using triggers, but I can't confirm. Anyway, in custom text, in your "if....then" loop, simply have a line that adds to counting integer A: set bj_forLoopAIndex = 1 set bj_forLoopAIndexEnd = 20 loop exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd if [condition] then desired action1 desired action2 etc set bj_forLoopAIndex = 21 endif set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop |
