• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to make this AOE DoT spell?

Status
Not open for further replies.
Level 11
Joined
Oct 11, 2012
Messages
711
I would like to make an AOE DoT spell like the following:
Five units within a certain range of the spell target unit (including the spell target unit or not does not matter) will be infected by the spell, and they will lose HP every second until they die. Upon their death, doom guards will be spawned at those locations

Any idea guys? I do not want to use spells like "Doom" or "Parasite", etc., because they cannot cause damage to spell immune unit. Thanks a lot.
 
Level 11
Joined
Oct 11, 2012
Messages
711
After it has been casted on the unit to keep from a long DOt spell removing the classification for a long period of time unless you want that effect.

Yeah, you are right. But I am using a loop to pick up units in a group to get the AOE effect, so I am not sure how to set the duration of the DoT for each unit

Edit: I understand what you mean now, lol Thanks a lot, dimf!
 
Level 11
Joined
Oct 11, 2012
Messages
711
You use a counter to tell when to remove the unit from the group.
I do not think its possible to do that or donno how to do it.. my code is like this:
JASS:
function Trig_aszd1_Actions takes nothing returns nothing 
    local unit caster = GetTriggerUnit()
    local unit target = GetSpellTargetUnit()   
    local integer i = 1
    local location ltarget = GetUnitLoc(target)
    local group g
    local unit u
    local unit dum                                               
    set g = GetUnitsInRangeOfLocAll(800.00, ltarget)
    set u = FirstOfGroup(g) 
    loop
        exitwhen i > 5
        set u = FirstOfGroup(g)  
        call CreateNUnitsAtLoc(1,'n024',GetOwningPlayer(caster),ltarget,bj_UNIT_FACING)
        set dum = bj_lastCreatedUnit
        call UnitApplyTimedLife(dum,'BHwe',1.)
        if (IsUnitEnemy(u,GetOwningPlayer(caster))==true)then
            if (IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE) != true)then 
                call IssueTargetOrder(dum,"doom",u)
            else
                call UnitRemoveType(u,UNIT_TYPE_MAGIC_IMMUNE)
                call IssueTargetOrder(dum,"doom",u)
                call UnitAddType(u,UNIT_TYPE_MAGIC_IMMUNE)
            endif
        endif
        call GroupRemoveUnit(g,u)
        set i = i + 1
    endloop
    call DestroyGroup(g)
    call RemoveLocation(ltarget)
    set ltarget = null
    set caster = null
    set target = null
    set g = null
    set u = null
    set dum = null
endfunction
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
Again show your whole trigger when asking for help.
Again never use locations in jass use x/y values.
don't use create unit at location.
don't use == true or != true.
This is also an instant spell so counters are useless.

JASS:
function Trig_aszd1_Actions takes nothing returns nothing 
    local unit caster = GetTriggerUnit()
    local unit target = GetSpellTargetUnit()   
    local integer p = GetPlayerId( GetTriggerPlayer())
    local integer i = 1
    local real x = GetUnitX(target)
    local real y = GetUnitY(target)
    local group g = CreateGroup()
    local unit u
    local unit dum
    call GroupEnumUnitsInRange( g, x, y, 800.00, null)
    loop
        exitwhen i > 5
        set u = FirstOfGroup(g)  
        set dum = CreateUnit( Player( p), 'n024', x, y, 0.00)
        call UnitApplyTimedLife( dum, 'BHwe', 1.00)
        if IsUnitEnemy( u, Player( p))then
            if not IsUnitType( u, UNIT_TYPE_MAGIC_IMMUNE) then 
                call IssueTargetOrder(dum,"doom",u)
            else
                call UnitRemoveType(u,UNIT_TYPE_MAGIC_IMMUNE)
                call IssueTargetOrder(dum,"doom",u)
                call UnitAddType(u,UNIT_TYPE_MAGIC_IMMUNE)
            endif
        endif
        call GroupRemoveUnit( g, u)
        set i = i + 1
    endloop
    call DestroyGroup(g)
    set caster = null
    set target = null
    set g = null
    set u = null
    set dum = null
endfunction
 
Level 11
Joined
Oct 11, 2012
Messages
711
Again show your whole trigger when asking for help.
Again never use locations in jass use x/y values.
don't use create unit at location.
don't use == true or != true.
This is also an instant spell so counters are useless.

JASS:
function Trig_aszd1_Actions takes nothing returns nothing 
    local unit caster = GetTriggerUnit()
    local unit target = GetSpellTargetUnit()   
    local integer p = GetPlayerId( GetTriggerPlayer())
    local integer i = 1
    local real x = GetUnitX(target)
    local real y = GetUnitY(target)
    local group g = CreateGroup()
    local unit u
    local unit dum
    call GroupEnumUnitsInRange( g, x, y, 800.00, null)
    loop
        exitwhen i > 5
        set u = FirstOfGroup(g)  
        set dum = CreateUnit( Player( p), 'n024', x, y, 0.00)
        call UnitApplyTimedLife( dum, 'BHwe', 1.00)
        if IsUnitEnemy( u, Player( p))then
            if not IsUnitType( u, UNIT_TYPE_MAGIC_IMMUNE) then 
                call IssueTargetOrder(dum,"doom",u)
            else
                call UnitRemoveType(u,UNIT_TYPE_MAGIC_IMMUNE)
                call IssueTargetOrder(dum,"doom",u)
                call UnitAddType(u,UNIT_TYPE_MAGIC_IMMUNE)
            endif
        endif
        call GroupRemoveUnit( g, u)
        set i = i + 1
    endloop
    call DestroyGroup(g)
    set caster = null
    set target = null
    set g = null
    set u = null
    set dum = null
endfunction

Lessons learned... Thanks. I could only think of this instant spell to achieve what I want.. sad :ogre_frown:

Edit: actually I want to deal periodic damage in JASS, by using UnitDamageTarget,, but unable to do that
 
Status
Not open for further replies.
Top