- Joined
- Feb 26, 2005
- Messages
- 210
I am working on a customized version of Banish which has a different effect depending on what the spell is cast on. For some reason nothing happens except the first time, and only the first time, there is a brief moment of lag. Otherwise nothing. Please help.
JASS:
function Trig_Banish_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A009' ) ) then
return false
endif
return true
endfunction
function Trig_Banish_Actions takes nothing returns nothing
local location l
local unit u1 = GetSpellAbilityUnit()
local unit u2 = GetSpellTargetUnit()
if GetOwningPlayer(u1) == GetOwningPlayer(u2) and IsUnitType(u2, UNIT_TYPE_HERO) != true then
call UnitAddAbility( u2, 'A00A' )
else
set l = GetUnitLoc(u1)
call CreateNUnitsAtLoc( 1, 'n000', GetOwningPlayer(u1), l, GetUnitFacing(u1) )
call UnitAddAbility( GetLastCreatedUnit(), 'A00C' )
if IsUnitType(GetSpellTargetUnit(), UNIT_TYPE_HERO) == true then
call SetUnitAbilityLevelSwapped( 'A00C', GetLastCreatedUnit(), GetHeroLevel(u2) )
else
call SetUnitAbilityLevelSwapped( 'A00C', GetLastCreatedUnit(), GetHeroLevel(u1) )
endif
call IssueTargetOrderBJ( GetLastCreatedUnit(), "banish", u2 )
endif
call RemoveLocation(l)
endfunction
//===========================================================================
function InitTrig_Banish takes nothing returns nothing
set gg_trg_Banish = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Banish, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Banish, Condition( function Trig_Banish_Conditions ) )
call TriggerAddAction( gg_trg_Banish, function Trig_Banish_Actions )
endfunction
Last edited: