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

[Extension] Unit Event

Something just occurred to me, if the DecayEvent is prolonged with
something like UnitSuspendDecay, it can really increase the chances
that the corpse was removed via RemoveUnit after the 88 second (or
whatever) cutoff period. What is wrong with hooking RemoveUnit?
The RemoveUnit hook could not possibly be called enough times to
produce lag.

Hooking RemoveUnit would also help you to deindex units properly
when they are paused, in a transport and then removed, because
your Unit Indexer still bugs when this happens.
 
Actually... it does matter


I had a map long ago and when I had an early version of this system that hooked RemoveUnit, it caused mass low fps (like 0). When I got rid of RemoveUnit hook and used timer, it ran at 60 fps.


So the RemoveUnit hook request is denied. I worked hard to get rid of it because it made one of my maps unplayable (a map I never finished, but w/e).
 
Level 7
Joined
Dec 3, 2006
Messages
339
JASS:
            loop
                call TriggerRegisterPlayerUnitEvent(death,Player(i),EVENT_PLAYER_UNIT_DEATH,null)
                exitwhen 0==i
                set i=i-1
            endloop
Could be replaced with:
JASS:
            call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_DEATH, function OnDeath)

using RegisterPlayerUnitEvent ofc.

Heck you could even make UnitIndexer use it as well probably; but it's probably not that much of a speed boost.
 
Last edited:
Was just notified that the unit in the map had an unknown ability. This is the Unit Indexer ability. I have re-uploaded the map to make it so that it has the UnitIndexer ability in the map. If you do not edit it to have the correct UnitIndexer ability for your map, the system decay event will not work and will fire incorrectly as a RemoveUnit event.

The Lua code does add the ability to the unit, but as Lua doesn't appear to work on newer machines, you'll just have to remember to edit the ability on the unit to the UnitIndexer ability.

edit
I have just modified the code in the Lua version and the code in the map to automatically add the UnitIndexer ability, so don't worry about editing it now, just update if you aren't using the Lua version : ).
 
Top