HELP with triggering damage over time effects

wewso

New Member
Reaction score
11
Hi everyone. I am having problem with triggering DoTs and haven't found any solution yet so I hope you can help me.
I want to have a spell named Corruption that deals damage every 3 seconds for 18 seconds. (Like the one in WOW) I don't want to use any Globals or dummies and just one triggerfor the spell. I have tried these things and none works.
JASS:
function Trig_Corruption_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A007' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Corruption_Func002C takes nothing returns boolean
    local unit target = GetSpellTargetUnit()
    if ( not ( UnitHasBuffBJ(target, 'B001') == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Corruption_Actions takes nothing returns nothing
    local unit target = GetSpellTargetUnit()
    if ( Trig_Corruption_Func002C() ) then
        set udg_REAL = GetRandomReal(105.00, 125.00)
        call UnitDamageTargetBJ( GetTriggerUnit(), target, udg_REAL, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_DEATH )
        call CreateTextTagUnitBJ( R2S(udg_REAL), target, 0, 10, 100, 0.00, 100, 0 )
        call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 64, 90 )
        call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
        call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.50 )
        call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
    else
        call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_138" )
        return
    endif
    call TriggerSleepAction( 3.00 )
    call TriggerExecute( GetTriggeringTrigger() )
endfunction


Code:
Corruption Effect
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Corruption 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Triggering unit) has buff Corruption Warlock) Equal to True
            Then - Actions
                Set REAL = (Random real number between 105.00 and 125.00)
                Game - Display to (All players) the text: (String(REAL))
                Unit - Cause Hero[(Player number of (Owner of (Attacking unit)))] to damage (Triggering unit), dealing REAL damage of attack type Magic and damage type Death
                Floating Text - Create floating text that reads (String(REAL)) above (Target unit of ability being cast) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 100.00%), and 0.00% transparency
                Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                Floating Text - Change (Last created floating text): Disable permanence
                Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
            Else - Actions
                Skip remaining actions
        Wait 3.00 seconds
        Trigger - Run (This trigger) (ignoring conditions)


JASS:
function Trig_looooooooop_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A007' ) ) then
        return false
    endif
    return true
endfunction

function Trig_looooooooop_Actions takes nothing returns nothing
    local unit target = GetSpellTargetUnit()
    call UnitDamageTargetBJ( target, GetSpellTargetUnit(), 100.00, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_DEATH )
    call TriggerSleepAction( 2 )
    call UnitDamageTargetBJ( target, GetSpellTargetUnit(), 100.00, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_DEATH )
    call TriggerSleepAction( 2 )
    call UnitDamageTargetBJ( target, GetSpellTargetUnit(), 100.00, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_DEATH )
    call TriggerSleepAction( 2 )
endfunction




The problem appears to be that WE can't detect the Target of ability being cast after waiting seconds. So maybe only jass can help here with some locals, but i dont know jass well so can you please write it for me.

Thank you in advance.
Wewso :D
 
Use timers, not waits, for DoTs. You will need to attach the data to the timer somehow - just use gamecache, it is the easiest way.
 
Try this
Code:
function Trig_looooooooop_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A007'
endfunction

function Trig_looooooooop_Actions takes nothing returns nothing
    local unit target = GetSpellTargetUnit()
    local unit caster = GetTriggerUnit()
    call UnitDamageTarget( caster, target, 100.00, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS)
    call TriggerSleepAction( 2. )
    call UnitDamageTarget( caster, target, 100.00, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS)
    call TriggerSleepAction( 2. )
    call UnitDamageTarget( caster, target, 100.00, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS)
endfunction
 
i used this for my DoT and i havent seen any problems with it yet so

Code:
For each (Integer A) from 1 to 3, do (Actions)
    Loop - Actions
        Unit - Cause ImpaleUser to damage ImpaleTarg, dealing (1.00 x (Real((Agility of ImpaleUser (Exclude bonuses))))) damage of attack type Hero and damage type Enhanced
        Special Effect - Create a special effect attached to the chest of ImpaleTarg using Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
        Set DoTSFX = (Last created special effect)
        Wait 1.00 seconds
        Special Effect - Destroy DoTSFX

just change the Integer A to 1 to 6 and change the wait to 3, and it shud do ## damage every 3 seconds 6 times over (3x6=18 ^^). u can ignore the SFX stuff if you wish.
 
i used this for my DoT and i havent seen any problems with it yet so

Code:
For each (Integer A) from 1 to 3, do (Actions)
    Loop - Actions
        Unit - Cause ImpaleUser to damage ImpaleTarg, dealing (1.00 x (Real((Agility of ImpaleUser (Exclude bonuses))))) damage of attack type Hero and damage type Enhanced
        Special Effect - Create a special effect attached to the chest of ImpaleTarg using Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
        Set DoTSFX = (Last created special effect)
        Wait 1.00 seconds
        Special Effect - Destroy DoTSFX

just change the Integer A to 1 to 6 and change the wait to 3, and it shud do ## damage every 3 seconds 6 times over (3x6=18 ^^). u can ignore the SFX stuff if you wish.


This needs globals which means that I wont be able to use more than one at a time.:(
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top