• 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.

GetInRangeSourceUnit()?

Status
Not open for further replies.
Level 10
Joined
Aug 19, 2008
Messages
491
Hello again.
I've been trying to code something that if a unit gets in range of another unit, and that unit is an enemy, I want to do stuff to the enetering unit.
However there doesn't seem to exist a even response that returns the unit which the entering unit got close to.
This is for a MUI spell so it should be castable with 100 units at the same time, which is why I need the source unit.
Does anyone know how to work around this problem?

In gui it would look something like this, though I don't use gui for it.
  • Dont Touch God
    • Events
      • Unit - A unit comes within 500.00 of God 0000 <gen>
    • Conditions
      • ((Triggering unit) belongs to an enemy of (Owner of (Source Unit)) Equal to True
    • Actions
      • Unit - Kill (Triggering unit)
 
So, this function won't work?
JASS:
function GetUnitsInRangeOfLocMatching takes real radius, location whichLocation, boolexpr filter returns group
    local group g = CreateGroup()
    call GroupEnumUnitsInRangeOfLoc(g, whichLocation, radius, filter)
    call DestroyBoolExpr(filter)
    return g
endfunction
You will refer as TriggerUnit for the (Triggering unit) and for the "Entering unit" as FirstOfGroup.
(Along with a periodic event)
 
Level 10
Joined
Aug 19, 2008
Messages
491
That would require a refresher, i.e a timer which refresh every 0.1 second (example)
What's dumb is that it isn't as easy as just killing the unit, I gotta check alot of stuff and when I tried using a timer 1s it started lagging alot.
But I was using it as an aura back then, now it's more of a 200 area (and not 700)
 
Status
Not open for further replies.
Top