- Joined
- Jul 10, 2007
- Messages
- 6,306
GetUnitState(u,UNIT_STATE_LIFE)
unsafe by sometimes returning the value of the unit's health + the offset of the maximum life ability.* readonly static real life
* - how much life the target unit has
call UnitDamageTarget(u1, u2, 0.5*GetUnitState(u2, UNIT_STATE_LIFE), true, false, null, DAMAGE_TYPE_UNIVERSAL, null)
struct Test extends array
private static method onDamage takes nothing returns nothing
set damage = 0.0001*damage
endmethod
implement DDS
endstruct
scope test initializer Init
private function slowCallback takes nothing returns nothing
call UnitDamageTarget(gg_unit_hkni_0000, gg_unit_hkni_0000, 0.5*GetUnitState(gg_unit_hkni_0000, UNIT_STATE_MAX_LIFE), true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, null)
endfunction
private function fastCallback takes nothing returns nothing
call UnitDamageTarget(gg_unit_hkni_0000, gg_unit_hkni_0000, 10000.0, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, null)
endfunction
private function Init takes nothing returns nothing
call TimerStart(CreateTimer(), 0.01, true, function fastCallback)
call TimerStart(CreateTimer(), 1.00, true, function slowCallback)
endfunction
endscope
struct Test extends array
private static method onDamage takes nothing returns nothing
set damage = 0.0001*damage
endmethod
implement DDS
endstruct
struct test extends array
private static method slowCallback takes nothing returns nothing
call BJDebugMsg(R2S(life))
call UnitDamageTarget(gg_unit_hkni_0000, gg_unit_hkni_0000, 0.5*GetUnitState(gg_unit_hkni_0000, UNIT_STATE_MAX_LIFE), true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, null)
endmethod
private static method fastCallback takes nothing returns nothing
call UnitDamageTarget(gg_unit_hkni_0000, gg_unit_hkni_0000, 10000.0, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, null)
endmethod
private static method onInit takes nothing returns nothing
call TimerStart(CreateTimer(), 0.01, true, function thistype.fastCallback)
call TimerStart(CreateTimer(), 1.00, true, function thistype.slowCallback)
endmethod
implement DDS
endstruct
readonly static real life
Or code that runs in between that has nothing to do with the damage event stuff. I see what you mean now : ).
call RemoveAfterDamage(targetId_p)
if (actualDamage < 0) then
set DDS[targetId_p].enabled = false
call SetWidgetLife(u, damageOriginal)
call UnitDamageTarget(u, u, damageOriginal*100, true, false, null, DAMAGE_TYPE_UNIVERSAL, null)
call UnitDamageTarget(u, u, damageOriginal*100, true, false, null, DAMAGE_TYPE_NORMAL, null)
set DDS[targetId_p].enabled = true
else
call SetWidgetLife(u, actualDamage)
endif
if (life - damage_p < .4051) then
call RemoveAfterDamage(targetId_p)
if (actualDamage < 0) then
set DDS[targetId_p].enabled = false
call SetWidgetLife(u, damageOriginal)
call UnitDamageTarget(u, u, damageOriginal*100, true, false, null, DAMAGE_TYPE_UNIVERSAL, null)
call UnitDamageTarget(u, u, damageOriginal*100, true, false, null, DAMAGE_TYPE_NORMAL, null)
set DDS[targetId_p].enabled = true
else
call SetWidgetLife(u, actualDamage)
endif
if (life - damage_p < .4051) then
unit u
killing u
(himself)? I just tested it and it seems that heros also don't get XP from killing enemy units with modified spell damage, so I guess the problems are not caused by flamestrike.