You have to use the JASS function in Custom script.
What is JASS?
Edit: I converted the trigger and added your function now it looks like this:
function Trig_Summon_Cobra_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0FT' ) ) then
return false
endif
return true
endfunction
function Trig_Summon_Cobra_Func008C takes nothing returns boolean
if ( not ( udg_Integer == 1 ) ) then
return false
endif
return true
endfunction
function Trig_Summon_Cobra_Func009C takes nothing returns boolean
if ( not ( udg_Integer == 2 ) ) then
return false
endif
return true
endfunction
function Trig_Summon_Cobra_Func010C takes nothing returns boolean
if ( not ( udg_Integer == 3 ) ) then
return false
endif
return true
endfunction
function Trig_Summon_Cobra_Func011C takes nothing returns boolean
if ( not ( udg_Integer == 4 ) ) then
return false
endif
return true
endfunction
function Trig_Summon_Cobra_Actions takes nothing returns nothing
set udg_A = GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))
set udg_EAbility_level[udg_A] = GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetTriggerUnit())
set udg_p = GetSpellTargetLoc()
set udg_real1 = GetLocationX(udg_p)
set udg_real2 = GetLocationY(udg_p)
call RemoveLocation (udg_p)
set udg_Integer = udg_EAbility_level[udg_A]
if ( Trig_Summon_Cobra_Func008C() ) then
set udg_ut = 'o001'
else
endif
if ( Trig_Summon_Cobra_Func009C() ) then
set udg_ut = 'o002'
else
endif
if ( Trig_Summon_Cobra_Func010C() ) then
set udg_ut = 'o003'
else
endif
if ( Trig_Summon_Cobra_Func011C() ) then
set udg_ut = 'o000'
else
endif
// create caster
call CreateNUnitsAtLoc( 1, udg_ut, ConvertedPlayer(udg_A), Location(udg_real1, udg_real2), GetUnitFacing(GetTriggerUnit()) )
call UnitApplyTimedLifeBJ( 40.00, 'BTLF', GetLastCreatedUnit() )
call UnitAddTypeBJ( UNIT_TYPE_SUMMONED, GetLastCreatedUnit() )
call SetUnitPropWindow( GetLastCreatedUnit(), 0.00 )
endfunction
//===========================================================================
function InitTrig_Summon_Cobra takes nothing returns nothing
set gg_trg_Summon_Cobra = CreateTrigger( )
call DisableTrigger( gg_trg_Summon_Cobra )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Summon_Cobra, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Summon_Cobra, Condition( function Trig_Summon_Cobra_Conditions ) )
call TriggerAddAction( gg_trg_Summon_Cobra, function Trig_Summon_Cobra_Actions )
endfunction
It works!!! +rep, thanks and I will tell you something funny: serpent wards are uncastable upon water by default so I had to make new skill cause of my special map.
Peace.