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

How to trigger permanent Immolation?

Status
Not open for further replies.

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
I think u just need to add a buff to ur unit when it learns that skill. Then add it to a unit group. After that, create a periodic trigger to pick every unit in that unit group, then deal damage to the nearby enemies. U can setup everything for ur spell (Damage, AOE, etc).
 
Level 11
Joined
Oct 11, 2012
Messages
711
I think u just need to add a buff to ur unit when it learns that skill. Then add it to a unit group. After that, create a periodic trigger to pick every unit in that unit group, then deal damage to the nearby enemies. U can setup everything for ur spell (Damage, AOE, etc).

Thanks a lot. I did something like this and it seemed to work.
JASS:
function Trig_XG_001 takes nothing returns boolean
    return(IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(gg_unit_Hblm_0002)))
endfunction
function Trig_XG_Actions takes nothing returns nothing
    local group g
    local unit u
    local location p
    local real a = I2R(GetUnitAbilityLevel(gg_unit_Hblm_0002,'A353'))*50.+300.
    set p = GetUnitLoc(gg_unit_Hblm_0002)
    set g = GetUnitsInRangeOfLocMatching(a, p,Condition(function Trig_XG_001))
    set u = FirstOfGroup(g) 
    loop
        exitwhen u==null
        set u = FirstOfGroup(g)
        call UnitDamageTarget(gg_unit_Hblm_0002,u,I2R(GetHeroInt(gg_unit_Hblm_0002,false)),true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_DEMOLITION,WEAPON_TYPE_WHOKNOWS)
        call GroupRemoveUnit(g,u)
    endloop 
    call DestroyGroup(g)
    call RemoveLocation(p)
    set g = null
    set u = null
    set p = null
endfunction

//===========================================================================
function InitTrig_XG takes nothing returns nothing
    set gg_trg_XG = CreateTrigger()
    call TriggerRegisterTimerEventPeriodic( gg_trg_XG, 1.00 )
    call TriggerAddAction(gg_trg_XG, function Trig_XG_Actions)
endfunction
 
Level 18
Joined
Sep 14, 2012
Messages
3,413
This is better :
JASS:
function Trig_XG_001 takes nothing returns boolean
    return(IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(gg_unit_Hblm_0002)))
endfunction
function Trig_XG_Actions takes nothing returns nothing
    local group g = CreateGroup( )
    local unit u
    local real x = GetUnitX( gg_unit_Hblm_0002 )
    local real y = GetUnitY( gg_unit_Hblm_0002 )
    local real a = I2R(GetUnitAbilityLevel(gg_unit_Hblm_0002,'A353'))*50.+300.
    call GroupEnumUnitsInRange( g, x, y, a, Condition( function Trig_XG_001 ) )
    loop
        set u = FirstOfGroup( g )
        exitwhen u==null
        call UnitDamageTarget(gg_unit_Hblm_0002,u,I2R(GetHeroInt(gg_unit_Hblm_0002,false)),true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_DEMOLITION, null)
        call GroupRemoveUnit(g,u)
    endloop 
    call DestroyGroup(g)
    set g = null
endfunction

//===========================================================================
function InitTrig_XG takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterTimerEvent( t, 1.00, true )
    call TriggerAddAction(t, function Trig_XG_Actions)
    set t = null
endfunction
 
Level 16
Joined
Dec 15, 2011
Messages
1,423
This is better :
JASS:
function Trig_XG_001 takes nothing returns boolean
    return(IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(gg_unit_Hblm_0002)))
endfunction
function Trig_XG_Actions takes nothing returns nothing
    local group g
    local unit u
    local real x = GetUnitX( gg_unit_Hblm_0002 )
    local real y = GetUnitY( gg_unit_Hblm_0002 )
    local real a = I2R(GetUnitAbilityLevel(gg_unit_Hblm_0002,'A353'))*50.+300.
    call GroupEnumUnitsInRange( g, x, y, a, Condition( function Trig_XG_001 ) )
    loop
        set u = FirstOfGroup( g )
        exitwhen u==null
        call UnitDamageTarget(gg_unit_Hblm_0002,u,I2R(GetHeroInt(gg_unit_Hblm_0002,false)),true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_DEMOLITION,WEAPON_TYPE_WHOKNOWS)
        call GroupRemoveUnit(g,u)
    endloop 
    call DestroyGroup(g)
    set g = null
    set u = null
endfunction

//===========================================================================
function InitTrig_XG takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterTimerEvent( t, 1.00, true )
    call TriggerAddAction(t, function Trig_XG_Actions)
    set t = null
endfunction

Your code won't work because group g is never created.

Fix'd below.

JASS:
function Trig_XG_Conditions takes nothing returns boolean
    local group g = CreateGroup()
    local unit u
    local real r = I2R(GetHeroInt(gg_unit_Hblm_0002, false))
    local player p = GetOwningPlayer(gg_unit_Hblm_0002)

    call GroupEnumUnitsInRange(g, GetUnitX(gg_unit_Hblm_0002), GetUnitY(gg_unit_Hblm_0002), I2R(GetUnitAbilityLevel(gg_unit_Hblm_0002,'A353'))*50.+300., null)

    loop
        set u = FirstOfGroup(g)
        exitwhen u == null

        if IsUnitEnemy(u, p) then
            call UnitDamageTarget(gg_unit_Hblm_0002, u, r, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_DEMOLITION, null)
        endif
        
        call GroupRemoveUnit(g, u)
    endloop
    
    call DestroyGroup(g)

    // u doesn't need to be nulled because the loop stops when u == null
    set g = null
    
    return false
endfunction

//===========================================================================
function InitTrig_XG takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterTimerEvent(t, 1.00, true)
    call TriggerAddCondition(t, function Trig_XG_Conditions)
    set t = null
endfunction
 
Status
Not open for further replies.
Top