• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Unit In Range (Help with a Spell Trigger!)

Status
Not open for further replies.
Level 11
Joined
Feb 11, 2010
Messages
199
Alright, so I'm currently working on a custom triggered spell and I've run into a bit of a wall. The spell in question creates a ring of dummy units around a target area. Anyone approaching the ring (either from the inside or outside) is supposed to be damaged and knocked back away from the ring (either inside or outside, respectively). The problem is that I need to be able to detect when a unit comes in range of the ring in order to select them to knock back, yet I can't figure out a way to do this while keeping the spell MUI. I've considered the possibility of using "Enters Region" but I don't think you can make a circular region, and I've considered using the "unit comes within range" event yet there's no way to detect which of the dummies the triggering unit came in range of (that I know of)!

What can I do? +Rep for anyone who can help!
 
Level 11
Joined
Feb 11, 2010
Messages
199
You could probably use the event for Unit in range too. Unit-group enumeration works just as well.
Didn't I mention that event in the OP? The question is *how* would I use that event? There's no way to detect the unit it came in range of (and thus which dummy was approached) in the trigger itself (as far as I know).

Just wondering, but in order to get this to work you could pick every unit within like 100.00 of each dummy unit you got and then if a unit is picked you'll add the picked unit into a knockback system and knock it back. That's the way I would have done it. :)

...Sure, that's an action, but what's the event? Periodic event?
 
Didn't I mention that event in the OP? The question is *how* would I use that event? There's no way to detect the unit it came in range of (and thus which dummy was approached) in the trigger itself (as far as I know).



...Sure, that's an action, but what's the event? Periodic event?

Yes, you use a periodic event.

  1. You use a periodic event to check if any unit is within range of your dummy units.
  2. You add the picked unit into a knockback system if it's in range
  3. You knockback the picked unit with the knockback system.

It's actually very simple.

I did this trigger very fast about checking if a unit is in range of a dummy unit:


  • Dummy Check
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Integer[3]) from 1 to Integer[1], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Spell_Off[Integer[3]] Equal to False
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Dummy_Timer[Integer[3]] Less than or equal to 0.00
                • Then - Actions
                  • Set Spell_Off[Integer[3]] = True
                  • Unit - Kill (Dummy_Unit[Integer[3]])
                  • Set Integer[2] = (Integer[2] - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Integer[2] Less than or equal to 0
                    • Then - Actions
                      • Set Integer[1] = 0
                      • Set Integer[2] = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
                  • Set Dummy_Timer[Integer[3]] = (Dummy_Timer[Integer[3]] - 0.03)
                  • -------- --- --------
                  • Set TempPoint[0] = (Position of (Dummy_Unit[Integer[3]]))
                  • Set UnitGroup[0] = (Units within 100.00 of TempPoint[0] matching (((Matching unit) belongs to an enemy of (Owner of (Dummy_Unit[Integer[3]]))) Equal to True))
                  • Unit Group - Pick every unit in UnitGroup[0] and do (Actions)
                    • Loop - Actions
                      • -------- ADD PICKED UNITS TO THE KNOCKBACK SYSTEM HERE --------
                  • Custom script: call DestroyGroup(udg_UnitGroup[0])
                  • Custom script: call RemoveLocation(udg_TempPoint[0])
            • Else - Actions
 
Status
Not open for further replies.
Top