| 05-02-2004, 07:09 AM | #1 |
This is something that has always bugged me. It seems like something that should be easy to do, yet I don't think there's an easy way to do it. Basically, I want to construct a trigger of the form, "If a unit of type A gets within X range of a unit of type B, then..." I don't really know a good way to set up the events / conditions that would make this work. The "Unit Within Range" event demands that the units be preset, and I can't do that. I could do a periodic trigger that checks, for every A, whether a B is within range, but obviously it would be ridiculous to run a trigger like that for every unit, every second. I don't know how to use JASS, but if JASS is required, I'm willing to learn in this instance. It really annoys me that I can't construct something that's so simple. Any help would be appreciated. |
| 05-02-2004, 11:18 AM | #2 |
I think you're going to need a periodic trigger for this. Code:
EVENTS
Time - Every [u]0.20[/u] seconds of game time
ACTIONS
Unit Group - Pick every unit in ([u]Units of type Footman[/u]) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in (Units within [u]512.00[/u] of (Position of ([u]Picked unit[/u])) matching ((Unit-type of (Matching unit)) Equal to [u]Knight[/u]))) [u]Greater than or equal to[/u] [u]1[/u]
Then - Actions
Run [u]TriggerX[/u]
Else - Actions
Run [u]TriggerY[/u] |
