• 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 comes out of range

Status
Not open for further replies.
Level 7
Joined
Apr 5, 2011
Messages
245
I need to check coming out of range immediately, because it must remove some spell. If it is delayed, spell can be casted and mana/cooldown wasted (because effect must not take place out of range). (Spell must have no cast animation)
What I am doing currently, is
- eventually check unit comes within range
- eventually check unit leaves region
- every 0.1 sec check if unit is within range
Thus, you can use it in corner, which is not that critical, but still not good
Using less time period seems to be a solution, but some kind of retarded
 
The best way is add units to unit group when they are in certain radius of point.
Every 0.03 check for units in range and add them to a tempGroup.
Then check the main group and loop through it to check if units are in tempGroup.
If that unit is not in tempGroup then it is not in range anymore.

Also 0.03 is the normal time period. Almost all spells use 0.03 as a timer.
 
Level 7
Joined
Apr 5, 2011
Messages
245
Ty, this looks much better than calculating distance
Does not solve problem on 100% though, so I have to check leave region also
Btw, just spent 20 min in searching of bug. That was GetFilterUnit() not working on filter for unit leave region event, but TriggerUnit() instead (!). So retarded. :/

qac
 
You should not need a leave region event for this.
You should only need one trigger with one event in it. Unit in Range event.
With the extra events unit leave / enter region you could make it more efficient as you can turn the trigger off that checks for unit in range if no units are even close to it.

Also this post should be in WEHZ not in Triggers and Scripts.
 
Level 8
Joined
Oct 2, 2013
Messages
288
Why 0.03 timer for spells specificly? Does it take too much unnecessary data to use shorter or?

I have a "mass mana burn" spell I use that summons a dummy to cast mana burn on everything around it. Should I use a 0.03 timer for that, instead of 0.01?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Why 0.03 timer for spells specificly? Does it take too much unnecessary data to use shorter or?
It is a good compromise between performance and smooth visuals.

Ideally you would want a 0.01667 delay as this would mean that not a single frame would render without the actions being performed however the gain for performance is often not worth it.

Unit in Range event.
This breaks auras as a warning. Auras seem to use the mechanics of this event in a mutually exclusive way.
 
Status
Not open for further replies.
Top