shiFt
Member
- Reaction score
- 8
Which systems would I need to make a Damage over time function, Im currently using Damage and T32 as my timer system and interval.
How can I make this MUI and MPI and so on, so that there are no glitches in multiplayer with multiple units being dealt damage over time with different amounts and durations?
As far as ive gotten
How can I make this MUI and MPI and so on, so that there are no glitches in multiplayer with multiple units being dealt damage over time with different amounts and durations?
As far as ive gotten
JASS:
library DamOT requires T32, Damage
private struct DamOT
private static thistype data = 0
unit Damager2
widget Target2
real Damage2
attacktype AttackType2
damagetype DamageType2
effect Effect2
integer tick2
real Time2
static method periodic takes nothing returns nothing
local thistype this = thistype.data
if tick2 >= T32_Tick then
call DestroyEffect(Effect2)
call UnitDamageTargetEx(Damager2, Target2, Damage2, false, false, AttackType2, DamageType2, null)
if tick2 == T32_Tick or GetWidgetLife(Target2) < .405 then
call .stopPeriodic()
call DestroyEffect(Effect2)
call this.destroy()
endif
endif
endmethod
implement T32x
static method start takes unit Damager, widget Target, real Damage, real Time, attacktype AttackType, damagetype DamageType, string Effect, string EffectAttach returns nothing
local thistype this = thistype.allocate()
set Damager2 = Damager
set Target2 = Target
set AttackType2 = AttackType
set DamageType2 = DamageType
set Effect2 = AddSpecialEffectTarget(Effect, Target, EffectAttach)
set Time2 = Time
set Damage2 = Damage * T32_PERIOD
set tick2 = T32_Tick + R2I(Time / T32_PERIOD)
set thistype.data = this
call .startPeriodic()
endmethod
method onDestroy takes nothing returns nothing
set Damager2 = null
set Target2 = null
call DestroyEffect(Effect2)
endmethod
endstruct
function DamageOT takes unit Damager, widget Target, real Damage, real Time, attacktype AttackType, damagetype DamageType, string Effect, string EffectAttach returns nothing
call DamOT.start(Damager, Target, Damage, Time, AttackType, DamageType, Effect, EffectAttach)
endfunction
endlibrary