- Joined
- Mar 23, 2008
- Messages
- 942
I think this trigger is running two times or at least, when I use the spell on terrain, appear two units and double inferno spell.
JASS:
scope Ginto initializer InitTrig_Ginto
globals
private player tplayer
endglobals
function Trig_Ginto_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 'A03T')
endfunction
private function IsEnemy takes nothing returns boolean
return ( (IsUnitEnemy(GetFilterUnit(), tplayer)) and GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0.449 )
endfunction
function Trig_Ginto_Actions takes nothing returns nothing
local unit tempunit
local unit cage
local unit caster
local group tgroup = CreateGroup()
local real tpx
local real tpy
local real tr
local real tx
local real ty
local location tloc
set tplayer = GetOwningPlayer(GetTriggerUnit())
if ( IsUnitAliveBJ(GetSpellTargetUnit()) and IsUnitEnemy(GetSpellTargetUnit(), tplayer) ) then
set tpx = GetUnitX(GetSpellTargetUnit())
set tpy = GetUnitY(GetSpellTargetUnit())
set tempunit = GetSpellTargetUnit()
set cage = CreateUnit(tplayer, 'h00Y', tpx, tpy, 90.00)
set caster = CreateUnit(tplayer, 'h00B', tpx, tpy, 90.00)
call UnitApplyTimedLife(cage, 'BTLF', 1.00)
call UnitApplyTimedLife(caster, 'BTLF', 1.00)
call SetUnitAbilityLevel(caster, 'A03U', 1)
call IssueTargetOrder(caster, "firebolt", tempunit)
call SetUnitVertexColorBJ( tempunit, 100, 100, 100, 100.00 )
call SetUnitVertexColorBJ( cage, 40, 40, 100, 10.00 )
call PolledWait2(1.00)
call SetUnitVertexColorBJ( tempunit, 100, 100, 100, 0.00 )
else
set tloc = GetSpellTargetLoc()
set tpx = GetLocationX(tloc)
set tpy = GetLocationY(tloc)
call RemoveLocation(tloc)
if (GetSpellTargetUnit() != GetTriggerUnit()) then
set caster = CreateUnit(tplayer, 'h00E', tpx, tpy, 90.00)
call IssuePointOrder(caster, "dreadlordinferno", tpx, tpy)
call UnitApplyTimedLife(caster, 'BTLF', 1.00)
set cage = CreateUnit(tplayer, 'h010', tpx, tpy, GetRandomReal(0,360))
call SetUnitVertexColorBJ( cage, 5, 5, 90, 60.00 )
call UnitApplyTimedLife(cage, 'BTLF', 1.00)
else
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl", tpx, tpy))
call GroupEnumUnitsInRange(tgroup, tpx, tpy, 350, Condition(function IsEnemy))
set caster = GetTriggerUnit()
loop
set tempunit = FirstOfGroup(tgroup)
exitwhen tempunit == null
set tx = GetUnitX(tempunit)
set ty = GetUnitY(tempunit)
set tr = bj_RADTODEG * Atan2(ty - tpy, tx - tpx)
call KnockbackTarget(caster, tempunit, tr, 200, 10, false, false, false)
call GroupRemoveUnit(tgroup, tempunit)
endloop
call DestroyGroup(tgroup)
endif
endif
set tempunit = null
set cage = null
set caster = null
endfunction
//===========================================================================
function InitTrig_Ginto takes nothing returns nothing
set gg_trg_Ginto = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ginto, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Ginto, Condition( function Trig_Ginto_Conditions ) )
call TriggerAddAction( gg_trg_Ginto, function Trig_Ginto_Actions )
endfunction
endscope