- Joined
- Mar 23, 2008
- Messages
- 942
JASS:
function Caladbolg_Conditions takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_Caladbolg))
endfunction
function Caladbolg_Move takes nothing returns nothing
local location sp0
local location sp1
local group tg
local boolexpr b = Condition(function Caladbolg_Conditions)
set sp0 = GetUnitLoc(udg_Caladbolg)
set tg = GetUnitsInRangeOfLocMatching(100.00, sp0, b)
if IsUnitGroupEmptyBJ(tg) == false then
call UnitDamageTarget( udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))], GroupPickRandomUnit(tg), ( 120.00 * I2R(GetUnitUserData(udg_Caladbolg)) ), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null )
call SetUnitUserData( udg_Caladbolg, 0 )
call RemoveUnit( udg_Caladbolg )
set udg_Caladbolg = null
set udg_caladbolgtime = 0
call DisableTrigger( GetTriggeringTrigger() )
call RemoveLocation(sp0)
set sp0 = null
call RemoveLocation(sp1)
set sp1 = null
set b = null
elseif udg_caladbolgtime >= 2000 then
call SetUnitUserData( udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))], 0 )
call RemoveUnit( udg_Caladbolg )
set udg_Caladbolg = null
set udg_caladbolgtime = 0
call DisableTrigger( GetTriggeringTrigger() )
call RemoveLocation(sp0)
set sp0 = null
call RemoveLocation(sp1)
set sp1 = null
set b = null
else
set udg_caladbolgtime = (udg_caladbolgtime + 32)
set sp1 = PolarProjectionBJ(sp0, 32.00, GetUnitFacing(udg_Caladbolg))
call SetUnitPositionLoc( udg_Caladbolg, sp1 )
call RemoveLocation(sp0)
set sp0 = null
call RemoveLocation(sp1)
set sp1 = null
set b = null
endif
endfunction
//===========================================================================
function InitTrig_Caladbolg_Move takes nothing returns nothing
set gg_trg_Caladbolg_Move = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Caladbolg_Move, 0.04 )
call TriggerAddAction( gg_trg_Caladbolg_Move, function Caladbolg_Move )
endfunction
This trigger makes the arrow moves and deals damage if something goes in the way, but if there is a corpse between you and your target, the arrow vanish in the corpse...