• 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] Stacking Dot/Hot

Status
Not open for further replies.
Level 11
Joined
Apr 6, 2008
Messages
760
how can i make an effective stack (the more i cast it the more effect it will do)

e.g

JASS:
call UnitDamageTarget(u,t,dmg*Stacks)

i can do the H2I version but it wont be MUI

Edit:

what about this?

JASS:
struct Data
unit caster
unit target

real duration
integer stacks

static integer array Ar
static integer Total = 0
static timer Time = CreateTimer()

  //stuff
endstruct

functon OnCast takes nothing returns boolean
    local Data Dat
    local unit u
    local unit t
    local integer i = 0    
    local boolean Match = false 
   
    if GetSpellAbilityId()==Abil_id then
        set u = GetTriggerUnit()
        set t = GetSpellTargetUnit()
        
        loop //here we check if any struct have the same caster and target
            exitwhen i >= Dat.Total or Match
            set Dat = Dat.Ar[i]
            if Dat.target == t and Dat.caster == u then //if there is a match
                 if Dat.stacks < Max_Stacks then //check if we can stack it more
                     set Dat.stacks = Dat.stacks + 1 
                 endif
                 set Dat.duration = Max_Duration //set the duration too full again
                 set Match = true //set the boolean true, meaning that we have found a match
            endif
            set i = i + 1
        endloop
        
        if not Match then //if we didnt find a match we create a new struct
              set Dat = Data.create(u,t)
        endif

        set u = null
        set t = null
    endif

    return false
endfunction
 
Last edited:
Level 12
Joined
Apr 27, 2008
Messages
1,228
This depend on the effect you want to achieve.

You can:
Make it so that each instance of the dot is independent and it deals a preset damage over time.
Make it so that when a unit(user) applies a dot on a unit that is still under the effect of a dot from the the user the duration is reset and the damage is increased.
Make it so that when any unit applies the dot(i.e with the same spell) to a unit under the effect of that dot, the duration is reset and the damage is increased.
 
Status
Not open for further replies.
Top