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

DOT passive (not orb!)

Status
Not open for further replies.
Level 6
Joined
Mar 2, 2013
Messages
127
no, poison doesn't work D:
If i were to trigger it, how would i set it up o_o

  • Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to (==) Baraggan
    • Actions
I'm not sure how I would make it for multiple units. trigger damages the attacked unit 3 times(once every second).

Ex. Baraggan(attacker) attacks 1 units, then quickly swaps to another. The first unit would still have the trigger going for him, and the trigger would start for unit 2 as well.
 
I made this a few years ago, but you're welcome to use it:

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

To instantiate a DoT, just:

call addDot(GetEventDamageSource(),GetTriggerUnit(),<dps>,<duration>,"")

You'll also need a damage detection system.
 
Status
Not open for further replies.
Top