HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Immolation destroying destructible ... ?

12-17-2008, 02:33 PM#1
abriko
Is there a way for immolation spells to kill the destructibles ?
12-17-2008, 03:10 PM#2
moyack
Hmmm, no I think you should trigger that part...
12-17-2008, 03:36 PM#3
abriko
humm, that could be hard, it's a unit's spell and player could have several units of this type :/
How i could do it ? With a timer ?
12-17-2008, 03:52 PM#4
moyack
It can be done with one timer controlling all unit instances...

The spell has a buff?? in which spell is based on?? if so, I think I can do the code for you...
12-17-2008, 04:02 PM#5
abriko
The spell is based on permanent immolation. The unit the the Satellite strike ( if you know my map ). If you could do it, that is just great :)
12-18-2008, 01:27 AM#6
Pyrogasm
You could cast a modified Death & Decay on the unit's location every 0.10 second or something like that.
12-18-2008, 01:30 AM#7
moyack
Ok, this is the spell. Just create a new trigger, call it properly, and set the rawcodes to the Spell and Buff. This spell will use the fire effect defined by the buff.

Requires Table. and JNGP to be implemented. If you don't want to use it, just tell me and I'll do it independent.

Collapse Immolation2:
// ================================================================= \\
// Custom Immolation modifier spell, so it targets destructables too \\
// Request by Abriko, by moyack. 2008.                               \\
// ================================================================= \\
// Requires Table to work...                                         \\
// ================================================================= \\
scope Immolation2 initializer init

// Configuration Part...
globals
    private constant integer SpellID = 'AEi2' //Spell based on Immolation
    private constant integer BuffID = 'BEim' //Immolation buff, please base it on the immolation buff.
    private constant real dt = 1.
endglobals

private constant function DamageRate takes integer level returns real
    return 10. + 5. * (level - 1)
endfunction

private constant function AOE takes integer level returns real
    return 160.
endfunction
// End configuration Part...

private struct data
    static HandleTable T
    static group G
    static rect R
    static unit U

    unit c
    boolean flag = false
    
    static method Start takes unit c returns nothing
        local data D = data.allocate()
        set D.c = c
        call GroupAddUnit(data.G, c)
        set data.T[c] = integer(D)
    endmethod
    
    method onDestroy takes nothing returns nothing
        call GroupRemoveUnit(data.G, .c)
        call data.T.flush(.c)
    endmethod
endstruct

private function GetLivingDestructables takes nothing returns boolean
    return GetDestructableLife(GetFilterDestructable()) > 0.405
endfunction 

private function BurnDestructables takes nothing returns nothing
    local destructable d = GetEnumDestructable()
    call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(BuffID, EFFECT_TYPE_SPECIAL, 0), GetWidgetX(d), GetWidgetY(d)))
    call UnitDamageTarget(data.U, d, DamageRate(GetUnitAbilityLevel(data.U, SpellID)) * dt, false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)
    set d = null
endfunction

private function CheckStatus takes nothing returns nothing
    local unit u = GetEnumUnit()
    local data D = data( data.T[u] )
    if not D.flag and GetUnitAbilityLevel(u, BuffID) > 0 then
        set D.flag = true
    endif
    if D.flag and GetUnitAbilityLevel(u, BuffID) > 0 then
        call SetRect(data.R, GetUnitX(u) - AOE(GetUnitAbilityLevel(u, SpellID)), GetUnitY(u) - AOE(GetUnitAbilityLevel(u, SpellID)), GetUnitX(u) + AOE(GetUnitAbilityLevel(u, SpellID)), GetUnitY(u) + AOE(GetUnitAbilityLevel(u, SpellID))) 
        set data.U = u
        call EnumDestructablesInRect(data.R, Condition(function GetLivingDestructables), function BurnDestructables)
    endif
    if D.flag and GetUnitAbilityLevel(u, BuffID) < 1 then
        call D.destroy()
    endif
    set u = null
endfunction

private function Loop takes nothing returns nothing
    call ForGroup(data.G, function CheckStatus)
endfunction

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == SpellID
endfunction

private function Actions takes nothing returns nothing
    if not IsUnitInGroup(GetTriggerUnit(), data.G) then
        call data.Start(GetTriggerUnit())
    endif
endfunction

//===========================================================================
private function init takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Conditions ) )
    call TriggerAddAction( t, function Actions )
    set t = null
    set data.T = HandleTable.create()
    set data.G = CreateGroup()
    set data.R = Rect(0,0,1,1)
    call TimerStart(CreateTimer(), dt, true, function Loop)
endfunction

endscope
12-18-2008, 03:22 PM#8
abriko
Thank you very much, i'll try it :D
12-18-2008, 04:26 PM#9
cohadar
Collapse JASS:
call SetRect(data.R, GetUnitX(u) - AOE(GetUnitAbilityLevel(u, SpellID)), GetUnitY(u) - AOE(GetUnitAbilityLevel(u, SpellID)), GetUnitX(u) + AOE(GetUnitAbilityLevel(u, SpellID)), GetUnitY(u) + AOE(GetUnitAbilityLevel(u, SpellID)))
hahahaha.
12-18-2008, 04:28 PM#10
Rising_Dusk
I am a firm believer in using local variables to shorten code. Anyways, this seems to have more to do with triggers now, so I will move it over to the proper forum.
12-18-2008, 04:57 PM#11
Zerzax
I'd recommend using MoveRectTo if the range isn't variable. My guess is it's less expensive.
12-18-2008, 05:45 PM#12
moyack
Quote:
Originally Posted by Zerzax
I'd recommend using MoveRectTo if the range isn't variable. My guess is it's less expensive.
Ohh yes, I agree with you. I just did it in that way because the AOE is a variable in the immolation spell (AKA for the sake of configurability), but yes, if it's constant, I'd set it as a constant global variable and simplify it in the Rect positioning... If abriko doesn't need that configuration, I can simplify it :)

Quote:
hahahaha.
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA... what's so funny??