[Solved] Question Regarding Loop Actions
I'm making an AoS map and have a question regarding loop action triggers.
Basically, what I want to do is this:
The thing is that using non-loop triggers I can only do "If [region] contains [random unit owned by [player]], do [actions]," whereas what I want is "If [region] contains [any unit] owned by [enemy of [player]], do [actions]," so I'm forced to use a double loop, but it clearly isn't working as I intend as one player gets massive spawns every time that condition is met.
I honestly don't know what a loop means in JASS or how to close one so it only does things once. I've tried [Skip Remaining Actions] but haven't tried defining variables, which was my next thought - that's a lot of work if I'm not sure it's the solution. At any rate, if anyone knows how to achieve the desired result thanks in advance for letting me know.
Here's what I've got right now for Player A (mirrored for the rest):
I'm making an AoS map and have a question regarding loop action triggers.
Basically, what I want to do is this:
PHP:
Players A, B, C & D spawn units at a given rate normally.
If Players A, C or D have units near Player B's base, Player B gets a few more units
per spawn.
If Players A, C, or D have units [I]in[/I] Player B's base, Player B gets several more
units per spawn.
The thing is that using non-loop triggers I can only do "If [region] contains [random unit owned by [player]], do [actions]," whereas what I want is "If [region] contains [any unit] owned by [enemy of [player]], do [actions]," so I'm forced to use a double loop, but it clearly isn't working as I intend as one player gets massive spawns every time that condition is met.
I honestly don't know what a loop means in JASS or how to close one so it only does things once. I've tried [Skip Remaining Actions] but haven't tried defining variables, which was my next thought - that's a lot of work if I'm not sure it's the solution. At any rate, if anyone knows how to achieve the desired result thanks in advance for letting me know.
Here's what I've got right now for Player A (mirrored for the rest):
PHP:
Player Group - Pick every player in (All enemies of Player 1 (Red)) and do (Actions)
Loop - Actions
Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(RedBase <gen> contains (Picked unit)) Equal to True
Then - Actions
Set LeakSpawnPoint1 = (Random point in [region] <gen>)
Unit - Create 1 [unit] for Player 1 (Red) at LeakSpawnPoint1 facing
Default building facing degrees
Custom script: call RemoveLocation(udg_LeakSpawnPoint1)
[et c. for more units]
Else - Actions