OK, not as trigger-dependent as you other resources, I see, so not much could be improved. Here's what it looks like using Spell System:
function Trig_Pocket_Matrix_Actions takes nothing returns boolean
local unit u = udg_Spell__Target
local unit PM_UNIT = null
local integer ID = 0
call ShowUnit(u, false)
if IsUnitType(u, UNIT_TYPE_FLYING) then
set ID = 'tpof'
else
set ID = 'tpou'
endif
set PM_UNIT = CreateUnitAtLoc(GetOwningPlayer(u), ID, udg_Spell__TargetPoint, 270)
call SetUnitFlyHeight(PM_UNIT, GetUnitFlyHeight(u), 0)
set ID = GetUnitUserData(PM_UNIT)
set udg_PM_Source[ID] = u
if IsUnitType(u, UNIT_TYPE_HERO) then
call UnitApplyTimedLife(PM_UNIT, 'BTLF', 2.5)
else
call UnitApplyTimedLife(PM_UNIT, 'BTLF', 5)
endif
set u = null
set PM_UNIT = null
return false
endfunction
//===========================================================================
function InitTrig_Pocket_Matrix takes nothing returns nothing
set udg_Spell__Trigger_OnEffect = CreateTrigger()
call TriggerAddCondition(udg_Spell__Trigger_OnEffect, Filter(function Trig_Pocket_Matrix_Actions))
set udg_Spell__Ability = 'tpoc'
call TriggerExecute(gg_trg_Spell_System)
call TriggerAddCondition(udg_Spell__Trigger_OnEffect, Filter(function Trig_Pocket_Matrix_Actions))
endfunction