function Projectile_Set_Conditions takes nothing returns boolean
if ( GetUnitTypeId(GetAttacker()) == 'H00D' ) then
return true
endif
return false
endfunction
function Projectile_Set_Actions takes nothing returns nothing
local unit u = GetAttacker()
local unit u2 = GetTriggerUnit()
local unit lcu
local location la = GetUnitLoc(u)
local location lt = GetUnitLoc(u2)
local location l2 = PolarProjectionBJ(la, 30.00, AngleBetweenPoints (la, lt))
call CreateNUnitsAtLocFacingLocBJ( 1, 'h007', GetOwningPlayer(u), l2, lt )
set lcu = GetLastCreatedUnit()
call RemoveLocation(la)
call RemoveLocation(lt)
call RemoveLocation(l2)
call UnitApplyTimedLife(lcu, 'BHwe', GetRandomReal(0.33, 4.00))
call GroupAddUnitSimple( lcu, udg_projectile_group )
call SaveReal( udg_hastable_projectile, GetHandleId(lcu), 0 , 24 ) //25 is missle speed.
call SaveInteger( udg_hastable_projectile, GetHandleId(lcu), 1, 30 ) //30 is missle damage
call SaveReal( udg_hastable_projectile, GetHandleId(lcu), 2, 50 ) //50 is minimum missle range to hit unit
call SaveStr( udg_hastable_projectile, GetHandleId(lcu), 3, "" ) //"" is Impact effect path.
call SaveInteger( udg_hastable_projectile, GetHandleId(lcu), 4, (GetTerrainVarianceBJ(l2)) ) //Terrain height
call SaveInteger( udg_hastable_projectile, GetHandleId(lcu), 5, 90 ) // Projectile Height
call EnableTrigger( gg_trg_Projectile_Engine )
set u = null
set u2 = null
set lcu = null
set la = null
set lt = null
set l2 = null
endfunction
// INIT
function InitTrig_Projectile_Set takes nothing returns nothing
set gg_trg_Projectile_Set = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Projectile_Set, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Projectile_Set, Condition( function Projectile_Set_Conditions ) )
call TriggerAddAction( gg_trg_Projectile_Set, function Projectile_Set_Actions )
endfunction