Warcraft III resources & community, 2003–2006 · archived

DamageUnitOverTime

not rated
Submitted by Nantuko_HuskFunctions0 downloads
Damages a unit over a certain period of time.

Source

function DamageUnitOverTime takes unit caster,unit victim,integer damage,integer dur,string attach,string fxpath returns nothing
local integer dscale=damage/dur
local integer seconds=0
local effect Fx=AddSpecialEffectTargetUnitBJ(attach,victim,fxpath)
loop
exitwhen seconds==dur 
if(IsUnitAliveBJ(victim)!=true) then
call DestroyEffect(Fx)
endif
call UnitDamageTargetBJ(caster,victim,dscale,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_ENHANCED)
set seconds=seconds+1
call TriggerSleepAction(1)
endloop
call DestroyEffect(Fx)
set seconds=0
set dscale=0
set victim=null
set caster=null
set attach=""
set fxpath=""
endfunction

Comments

3
Can u make a script that increase your scale by a certain percent over time, so it does a growing like feature to a unit?
Well,the damage over time usually damage 1 time a sec!and yes it deals full damage
You think this would actually be useful?

- attack type and damage type is hardcoded.

- the "buff" is ignored, and instead presented. by the "buff effect". It is important for most over-time
damage spells to have the spell buff going along.

- the damage interval is hardcoded to "polled" 1 second. It is known that PolledWait() lasts longer than it actually does, usually around 0.2s. Over a long period, using PolledWait() causes big errors.

- Using your method limits the damage interval to 0.25s minimum, due to the wait error as said.