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

[JASS] Damage over time trigger

Status
Not open for further replies.
Level 16
Joined
Feb 22, 2006
Messages
960
So I'm a newbie in jass and so i tried my best with this, and my question is, is there a better way to do it

i noticed it starts to lag when the spell is 5 times active

JASS:
function dot_action takes nothing returns nothing
 local unit caster = GetSpellAbilityUnit()
 local unit target = GetSpellTargetUnit()  
 local real damage = ( ( GetUnitAbilityLevelSwapped('A000', caster) * 10 ) + GetHeroInt(caster,true) )
 local integer start = 0
 local integer stop = 5
    
    loop
        exitwhen start > stop
        call UnitDamageTarget(caster,target,damage,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
        call TriggerSleepAction(3.00)
        set start = start + 1
    endloop 
 set caster = null
 set target = null
endfunction

function Condition_Function takes nothing returns boolean
  return GetSpellAbilityId() == 'A000'
endfunction

function InitTrig_dot takes nothing returns nothing
  local trigger dot= CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(dot,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(dot,Condition(function Condition_Function))
    call TriggerAddAction(dot,function dot_action)
  set dot = null    
endfunction
 
Last edited:
Level 4
Joined
Aug 9, 2004
Messages
70
Try to use native TriggerSleepAction(real duration) istead of function PolledWait.
I did not understand why it lag but natives are faster than functions, so it may work for you. Just replace;
call PolledWait(3.00) with
call TriggerSleepAction(3.00)

Tell me if it works.
 
Status
Not open for further replies.
Top