- Joined
- Feb 3, 2009
- Messages
- 3,292
The spell basicaly does: When any unit targets the Paladin, which is set to the variable udg_DefCaster then a dummy is created, it gains the spell that was used, and casts it right back at the DefUser. Everything works exept for the part when it should cast the spell on the DefUser.
Don't mind all the BJs and stuff, i just need the trigger to work, i know the coding sucks with all the BJs, but it's nothing that i'll put on hive, it's for my map...
The spell works as it should exept for the part when the dummy should cast the spell on DefUser.
Don't mind all the BJs and stuff, i just need the trigger to work, i know the coding sucks with all the BJs, but it's nothing that i'll put on hive, it's for my map...
JASS:
function Trig_Attack_Deflection_Conditions takes nothing returns boolean
if ( not ( GetSpellTargetUnit() == udg_DefCaster ) ) then
return false
endif
return true
endfunction
function Trig_Attack_Deflection_Actions takes nothing returns nothing
local unit DefUser = GetTriggerUnit()
local integer DefSpell = GetSpellAbilityId()
local unit DefDummy
local unit DefCaster = udg_DefCaster
set DefDummy = CreateUnitAtLoc( GetOwningPlayer(DefCaster), 'h004', GetUnitLoc(DefCaster), bj_UNIT_FACING )
call UnitAddAbility(DefDummy, DefSpell)
call SetUnitAbilityLevelSwapped(DefSpell, DefDummy, GetUnitAbilityLevelSwapped(DefSpell, DefUser) )
call IssueTargetOrderById(DefDummy, DefSpell, DefUser)
call UnitApplyTimedLifeBJ( 5.00, 'BTLF', DefDummy )
set DefUser = null
set DefDummy = null
set DefCaster = null
endfunction
//===========================================================================
function InitTrig_Attack_Deflection takes nothing returns nothing
local trigger gg_trg_Attack_Deflection = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Attack_Deflection, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Attack_Deflection, Condition( function Trig_Attack_Deflection_Conditions ) )
call TriggerAddAction( gg_trg_Attack_Deflection, function Trig_Attack_Deflection_Actions )
endfunction
The spell works as it should exept for the part when the dummy should cast the spell on DefUser.