HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Improved trigger spell, any ways to make it better?

06-10-2006, 02:03 AM#1
darkwulfv
This is just an improvemnt I made to my Hot Ice spell (those of you who've seen some of my other posts know what I'm talking about) Nothing drastic, I just want to see if there is any way to improve it? (performance, cleaner trigger, etc.)

Collapse JASS:
function Hot_Ice_Conditions takes nothing returns boolean
   return GetSpellAbilityId() == 'A003'
endfunction

function Hot_Ice_Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local location l = GetSpellTargetLoc()
    local unit u = GetTriggerUnit()
    local unit tu = GetSpellTargetUnit()
    local player p = GetTriggerPlayer()
    local unit lcu = GetLastCreatedUnit()
    local effect SFX1 = AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitterBlue\\TownBurningFireEmitterBlue.mdl", l)
    local effect SFX2 = AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", l)   
    call UnitDamageTarget( u, tu, 250., true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS)
    call CreateNUnitsAtLocFacingLocBJ( 1, 'h001', p, l, l )
    call IssueTargetOrderBJ( lcu, "thunderbolt", tu)
    call TimerStart(t, 5., false, null) 
    loop
        exitwhen (TimerGetRemaining(t) == 0.)
        call UnitDamageTarget( u, tu, 35., true, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS)
        call PolledWait(1.0)
    endloop
    call DestroyTimer(t)
    call DestroyEffect(SFX1)
    call DestroyEffect(SFX2)
    call RemoveLocation(l)
    call KillUnit(lcu)
    set t = null
    set SFX1 = null
    set SFX2 = null
    set l = null    
    set tu = null
    set u = null
    set p = null
    set lcu = null
endfunction

//===========================================================================
function InitTrig_Hot_Ice takes nothing returns nothing
    set gg_trg_Hot_Ice = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Hot_Ice, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Hot_Ice, Condition( function Hot_Ice_Conditions ) )
    call TriggerAddAction( gg_trg_Hot_Ice, function Hot_Ice_Actions )
endfunction

06-10-2006, 03:37 AM#2
Vexorian
Collapse JASS:
function Hot_Ice_Conditions takes nothing returns boolean
   return GetSpellAbilityId() == 'A003'
endfunction

function Hot_Ice_Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local location l = GetSpellTargetLoc()
    local unit u = GetTriggerUnit()
    local unit tu = GetSpellTargetUnit()
    local player p = GetOwningPlayer(tu) //There is no triggering player in this event, GetTriggerPlayer() would always return Player(0)
    local unit lcu //it didn't have any sense before 
    local effect SFX1 = AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitterBlue\\TownBurningFireEmitterBlue.mdl", l)
    local effect SFX2 = AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", l)   
    call UnitDamageTarget( u, tu, 250., true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS)
    set lcu=CreateUnitAtLoc( p, 'h001', l , 0 )
    call IssueTargetOrder( lcu, "thunderbolt", tu) //BJ ..
    call TimerStart(t, 5., false, null) 
    loop
        exitwhen (TimerGetRemaining(t) == 0.)
        call UnitDamageTarget( u, tu, 35., true, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS)
        call PolledWait(1.0)
    endloop
    call DestroyTimer(t)
    call DestroyEffect(SFX1)
    call DestroyEffect(SFX2)
    call RemoveLocation(l)
    call KillUnit(lcu)
    set t = null
    set SFX1 = null
    set SFX2 = null
    set l = null    
    set tu = null
    set u = null
    set p = null
    set lcu = null
endfunction
06-10-2006, 03:57 AM#3
darkwulfv
wait wait wait. lcu is last created unit. I wasn't sure what to set it as, if it was to be a variable. If it doesn't have to be, I can remove it easily. I just wasn't sure. Do I remove the BJ from IssueTargetOrder? And I won't be needing the player variable anymore.

EDIT: Here's a fixed up version:
Collapse JASS:
function Hot_Ice_Conditions takes nothing returns boolean
   return GetSpellAbilityId() == 'A003'
endfunction

function Hot_Ice_Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local location l = GetSpellTargetLoc()
    local unit u = GetTriggerUnit()
    local unit tu = GetSpellTargetUnit()
    local unit lcu
    local effect SFX1 = AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitterBlue\\TownBurningFireEmitterBlue.mdl", l)
    local effect SFX2 = AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", l)   
    call UnitDamageTarget( u, tu, 250., true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS)
    call CreateNUnitsAtLocFacingLocBJ( 1, 'h001', Player(PLAYER_NEUTRAL_AGGRESSIVE), l, l )
    set lcu = GetLastCreatedUnit()
    call IssueTargetOrder( lcu, "thunderbolt", tu)
    call TimerStart(t, 5., false, null) 
    loop
        exitwhen (TimerGetRemaining(t) == 0.)
        call UnitDamageTarget( u, tu, 35., true, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS)
        call PolledWait(1.0)
    endloop
    call DestroyTimer(t)
    call DestroyEffect(SFX1)
    call DestroyEffect(SFX2)
    call RemoveLocation(l)
    call KillUnit(lcu)
    set t = null
    set SFX1 = null
    set SFX2 = null
    set l = null    
    set tu = null
    set u = null
    set lcu = null
endfunction

//===========================================================================
function InitTrig_Hot_Ice takes nothing returns nothing
    set gg_trg_Hot_Ice = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Hot_Ice, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Hot_Ice, Condition( function Hot_Ice_Conditions ) )
    call TriggerAddAction( gg_trg_Hot_Ice, function Hot_Ice_Actions )
endfunction
06-10-2006, 04:00 AM#4
Vexorian
The way it was before it was removing whatever (last created unit) was when someone casted the spell. So if you had a trigger that created a footman and just after that trigger executes someone casts this spell it would remove the footman
06-10-2006, 04:17 AM#5
darkwulfv
so the way i have it now is ok?
06-10-2006, 08:32 AM#6
The)TideHunter(
Your using GetSpellTargetLoc and GetSpellTargetUnit, any ability can only target either, not both.
If your targeting a unit with your ability, to get the loc, just do GetUnitLoc(GetTriggerUnit())

If your tageting a location, you'll have to have a local group, and pick all units with about a 2.5 radius if the targeted location
06-10-2006, 10:54 AM#7
blu_da_noob
Spells such as shockwave/impale/carrion swarm can target a unit or a location on the ground, so that could be valid.
06-10-2006, 12:21 PM#8
The)TideHunter(
With spells like that, you actually target the ground, if the unit moves once you target it, it will still target the ground, and not try and aim at the unit.

Im not sure how will this goes in the Trigger editor though, you might be right, but i would expect it to be still 1 target
06-10-2006, 01:58 PM#9
darkwulfv
is the spelltargetloc the one with the unit summoned? Becuase it doesnt need to be on the unit. I tested it loike 5 times, and it works perfect. The fire is a little off but I can't complain. The spell works to what i want it to.
06-10-2006, 03:45 PM#10
Captain Griffen
Quote:
Originally Posted by The)TideHunter(
With spells like that, you actually target the ground, if the unit moves once you target it, it will still target the ground, and not try and aim at the unit.

Not true. If you target a unit, and issue the order, if the unit moves, it will still target the unit.