- Joined
- Jul 10, 2007
- Messages
- 6,306
I've been writing an AttackIndexer, but I just realized something troubling... if the attacking unit is removed during an attack, EventDamageSource will return null, meaning that the following script displays 0. I made priest have like 3000 range and 9000 sight radius and 4500 acquisition range and .01 cooldown on attack with 1 dmg per attack, lol...
Anyone know a way to fix this? : O
Unit recycling isn't an answer as the abilities and what not screw it up as well as the techs ;O... if a tech goes between players, yea... if an ability is permanent, yea...
Well, I could hook RemoveUnit and have a dummy for it somewhere in the background that stores it's data (in AttackIndexer) until all of its attacks are done ; |, but GetEventDamageSource would still return null... I can't hook RemoveUnit and make it stop calling : |... I could just say don't remove units and use RemoveUnitEx instead >.>. I could fix this with cJASS definitions if cJASS actually worked... /cry
Anyone know a way to fix this? : O
Unit recycling isn't an answer as the abilities and what not screw it up as well as the techs ;O... if a tech goes between players, yea... if an ability is permanent, yea...
Well, I could hook RemoveUnit and have a dummy for it somewhere in the background that stores it's data (in AttackIndexer) until all of its attacks are done ; |, but GetEventDamageSource would still return null... I can't hook RemoveUnit and make it stop calling : |... I could just say don't remove units and use RemoveUnitEx instead >.>. I could fix this with cJASS definitions if cJASS actually worked... /cry
JASS:
struct tester extends array
private static unit u1
private static unit u2
private static method onD takes nothing returns boolean
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, I2S(DamageEvent.sourceId))
return false
endmethod
private static method run2 takes nothing returns nothing
call RemoveUnit(u1)
call DestroyTimer(GetExpiredTimer())
endmethod
private static method run takes nothing returns nothing
local fogmodifier f = CreateFogModifierRect(Player(0), FOG_OF_WAR_VISIBLE, WorldBounds.world, false, false)
call FogModifierStart(f)
set u1 = CreateUnit(Player(0), 'hmpr', WorldBounds.centerX-2500, WorldBounds.centerY, 0)
set u2 = CreateUnit(Player(8), 'hpea', WorldBounds.centerX, WorldBounds.centerY, 0)
call IssueTargetOrder(u1, "attack", u2)
call TimerStart(GetExpiredTimer(), 2, false, function thistype.run2)
endmethod
private static method onInit takes nothing returns nothing
call TimerStart(CreateTimer(), 0, false, function thistype.run)
call DamageEvent.EVENT.register(Condition(function thistype.onD))
endmethod
endstruct