• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

[JASS] Dot Bug(trigger doesnt execute)

Status
Not open for further replies.
Level 10
Joined
Feb 20, 2008
Messages
448
heres my problem, the trigger doesnt execute

what i tried:
changing ability hitself Made with Channel
added chat message in trigger itself to see if it run : nothing appear, if i remove all variable , triggers work and goes on

tryed with multiple kind of effect and condition and events, so only things i think its maybe the dot system itself...... i dont know jass enought to be able to fix it or see whats the problem!!à

ill give rep for help ^^

JASS:
library DOT initializer Init
//DOT system current version 1.1 - Personally updated by Wizardum
private keyword Data

globals
    private constant real interval = 0.05
    private timer tim
    private Data array dat
    private integer total = 0
    group DOTunits
endglobals

private function Loop takes nothing returns nothing
    local Data d
    local integer i = 0
    local real array r
    
    loop
        exitwhen i >= total
        set d = dat[i]
        
        set r[1] = d.dmg * d.dur
        set r[2] = d.heal * d.dur
        set r[3] = GetWidgetLife( d.target )
        
        if r[3] < 0.405 then
            set d.dmgcount = r[1]
            set d.healcount = r[2]
        endif
        
        set d.counter = d.counter + interval
        if d.counter >= d.icheck then
            set d.counter = 0.
            if d.dmgcount < r[1] or d.healcount < r[2] then
                set d.dmgcount = d.dmgcount + d.dmg
                set d.healcount = d.healcount + d.heal
                call SetWidgetLife( d.target, GetWidgetLife( d.target) + d.heal )
                call UnitDamageTarget( d.source, d.target, d.dmg, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null )
                call DestroyEffect( AddSpecialEffectTarget( d.insEffect, d.target, d.attach ) )
            else
                call DestroyEffect( d.effectOT )
                set d.effectOT = null
                set d.source = null
                set d.target = null
                
                call d.destroy( )
                set total = total - 1
                set dat[i] = dat[total]
            endif
        endif
        
        set i = i + 1
    endloop
                
    if total == 0 then
        call PauseTimer( tim )
    endif
endfunction

private struct Data
    unit source
    unit target
    real dmg
    real heal
    real dur
    real icheck
    string insEffect
    effect effectOT
    string attach
    
    real counter
    real dmgcount
    real healcount
    
    static method Create takes unit source, unit target, real dmg, real heal, real dur, real icheck, string insEffect, effect effectOT, string attach returns nothing
        local Data d = Data.allocate( )
        
        set d.source = source
        set d.target = target
        set d.dmg = dmg / dur / icheck
        set d.heal = heal / dur / icheck
        set d.dur = dur
        set d.icheck = icheck
        set d.insEffect = insEffect
        set d.effectOT = effectOT
        if attach == "" then
            set d.attach = "chest"
        else
            set d.attach = attach
        endif
        set d.counter = 0.
        set d.dmgcount = 0.
        set d.healcount = 0.
        call GroupAddUnit( DOTunits, d.target )
        if total == 0 then
            call TimerStart( tim, interval, true, function Loop )
        endif
        
        set dat[total] = d
        set total = total + 1
    endmethod
endstruct

function DamageAttach takes unit source, unit target, real totaldmg, real duration, real intervalcheck, string insEffect, string effectOT, string attach returns nothing
    local effect e 
    if not IsUnitInGroup( target, DOTunits ) then
        set e = AddSpecialEffectTarget( effectOT, target, attach )
        call Data.Create( source, target, totaldmg, 0., duration, intervalcheck, insEffect, e, attach )
        set e = null
    endif
endfunction

function HealAttach takes unit target, real totalheal, real duration, real intervalcheck, string insEffect, string effectOT, string attach returns nothing
    local effect e 
    if not IsUnitInGroup( target, DOTunits ) then
        set e = AddSpecialEffectTarget( effectOT, target, attach )
        call Data.Create(  null, target, 0., totalheal, duration, intervalcheck, insEffect, e, attach )
        set e = null
    endif
endfunction
private function Init takes nothing returns nothing
    set tim = CreateTimer( )
endfunction

endlibrary

the code
  • Suiton suiron Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Suiton Suiron no jutsu
    • Actions
      • Set DOT_Source = (Casting unit)
      • Set DOT_Target = (Target unit of ability being cast)
      • Set DOT_Dmg = (0.50 x ((Real((Level of (Ability being cast) for (Casting unit)))) x ((Real((Strength of (Casting unit) (Exclude bonuses)))) + 25.00)))
      • Set DOT_Duration = 5.00
      • Set DOT_Interval = 1.00
      • Set DOT_Effect = "SeaAura.mdl"
      • Set DOT_AttachedEffect = <Empty String>
      • Set DOT_AttachPoint = "chest"
      • Custom script: call DamageAttach( udg_DOT_Source, udg_DOT_Target, udg_DOT_Dmg, udg_DOT_Duration, udg_DOT_Interval, udg_DOT_Effect, udg_DOT_AttachedEffect, udg_DOT_AttachPoint )
      • Game - Display to (All players) the text: WORKED ?
 
Try this system of mine, you can call it all in 1 line.

JASS:
library dotStack
    private struct dotDat
        unit source
        unit target
        integer dps
        integer length
        string fx
        method onCreate takes nothing returns nothing
            set this.source=null
            set this.target=null
            set this.dps=0
            set this.dps=1
            set this.fx=""
        endmethod
    endstruct
    
    globals
        private constant real REPEATTIME=.5 //How often the periodic damage runs. DPS will automatically update.
        private dotDat array dotDB
        private integer dbIndex=-1
        private timer time=CreateTimer()
    endglobals
    
    private function p takes nothing returns nothing
        local dotDat tempDat
        local integer index=0
        local effect fx
        loop
            exitwhen index>dbIndex
            set tempDat=dotDB[index]
            set fx=AddSpecialEffect(tempDat.fx,GetUnitX(tempDat.target),GetUnitY(tempDat.target))
            call DestroyEffect(fx)
            call UnitDamageTarget(tempDat.source,tempDat.target,tempDat.dps*REPEATTIME,true,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
            set tempDat.length=tempDat.length-1
            if tempDat.length<1 or GetWidgetLife(tempDat.target)<1 then
                call tempDat.destroy()
                set dotDB[index]=dotDB[dbIndex]
                set dbIndex=dbIndex-1
                if dbIndex==-1 then
                    call PauseTimer(time)
                endif
            endif
            set index=index+1
        endloop
    endfunction
        
    function addDot takes unit source, unit target, integer dps, integer length, string fx returns nothing
        local dotDat tempDat=dotDat.create()
        set tempDat.source=source
        set tempDat.target=target
        set tempDat.dps=dps
        set tempDat.length=length
        set tempDat.fx=fx
        set dbIndex=dbIndex+1
        set dotDB[dbIndex]=tempDat
        if dbIndex==0 then
            call TimerStart(time,REPEATTIME,true,function p)
        endif
    endfunction
endlibrary

and call it like this:

JASS:
call addDot(GetSpellAbilityUnit(),GetSpellTargetUnit(),.5*((GetUnitAbilityLevel(GetSpellAbilityUnit(),GetSpellAbilityId()))*GetHeroStr(GetSpellAbilityUnit(),false)+25),5,"SeaAura.mdl")
 
Level 10
Joined
Feb 20, 2008
Messages
448
Your system seems Good, can i change interval ? i see the dmg will stend for 5 sec, but can i change interval within the call ?, i saw the duration as 5 sec but interval o_O

and is theres anything wrong in my librairy ? o_O would being nice to know, cuz my friend who made it is kinda of lost like me o_O

and ur call is wrong, my Vjass tell me we cannot convert real to integer >.>
 
You can simply change the interval globally, and the dps will automatically balance itself out (for example if interval is .1, the damage you say will be multiplied by .1 every iteration)

For that error, put R2I() around

JASS:
.5*((GetUnitAbilityLevel(GetSpellAbilityUnit(),GetSpellAbilityId()))*GetHeroStr(GetSpellAbilityUnit(),false)+25)

so it becomes

JASS:
R2I(.5*((GetUnitAbilityLevel(GetSpellAbilityUnit(),GetSpellAbilityId()))*GetHeroStr(GetSpellAbilityUnit(),false)+25))

That should fix it.
 
Level 10
Joined
Feb 20, 2008
Messages
448
well we going far, i tryed other system i stil nothing appear o_O nothing .... not even dmg >.< ......i use imported file wich i can assure its not corrupt.....

i did this in jass thought it would work o_O i dont know jass alot o_O ....im noob jasser <,<lol

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

function Trig_Test_Dot_Actions takes nothing returns nothing
    local unit A = GetSpellAbilityUnit()
    local unit B = GetOrderTargetUnit()
    local real D = 500
    local real T = 5
    local attacktype AT = ATTACK_TYPE_MAGIC
    local damagetype DT = DAMAGE_TYPE_LIGHTNING
    local string Ex = "SeaAura.mdl"
    local string ExAttach = "origin"
    call DamageOverTimeEx( A , B , D , T , AT , DT , Ex , ExAttach ) // It will deal 100 damage each seccond, 10 damage each 0.1 secconds and 1 damage each 0.01 secconds ^^
    set A = null
    set B = null
    set AT = null
    set DT = null
    set Ex = null
    set ExAttach = null
endfunction

//===========================================================================
function InitTrig_Test_Dot takes nothing returns nothing
    set gg_trg_Test_Dot = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Test_Dot,EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Test_Dot, Condition( function Trig_Test_Dot_Conditions ) )
    call TriggerAddAction( gg_trg_Test_Dot, function Trig_Test_Dot_Actions )
endfunction
 
Last edited:
Level 10
Joined
Feb 20, 2008
Messages
448
hmmmm i Used Dynati Dot ansd its work now >.> but i stil prefered my old system

so i made this trigger thats work with First post trigger ... dont work do i did something wrong ?

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


function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    //Here you set the unit source, so if unit being damaged dies, he will receive experience and the player gold (in case it's a creep)
    local unit caster = GetTriggerUnit( )
    //Here you set the unit which will suffer damage over time
    local unit target = GetSpellTargetUnit( )
    //here you set the total damage you wish to deal
    local real damage = 100.
    //here is the duration of the effect on the target
    local real duration = 8.00
    //this is the interval, which means if it's value is 1, it will deal damage every second, if it's 2 it will damage every 2 seconds, and so on.
    local real interval = 1.
    //This is the normal effect, it will be created every time damage is done and then disappears
    local string instanteffect = "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl"
    //This is an attached effect that will appear in the beginning of the effect, and will disappear when all the damage has been dealt
    local string attacheffect = "Abilities\\Spells\\Orc\\Voodoo\\VoodooAuraTarget.mdl"
    //if you only want one of these two types of effects, just write this " " in the one you don't want
    //this is the attachment point where the effects will appear on the body of the unit. 
    //If you leave it empty, it will automaticaly set it to the attachment point "chest"
    local string attachpoint = "hand" + "right"
    
    call DamageAttach( caster, target, damage, duration, interval, instanteffect, attacheffect, attachpoint )
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_001, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Untitled_Trigger_001, Condition( function Trig_Untitled_Trigger_001_Conditions ) )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
 
Status
Not open for further replies.
Top