创造一个单位 移动到哪里的 触发..
为什么这个触发保存是会出错... 请教各位高手了..
我是新手. 不懂哪里有错误.
哪里造成的错误,导致无法保存
function Trig_Begin_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit aim
local unit localunit
local real x
local real y
local real angle
local location pos
if(GetUnitTypeId(caster) != 'Hmkg')then
set spellid = GetSpellAbilityId()
if(spellid == 'A004')then
set aim = GetSpellTargetUnit()
set x = GetUnitX(caster)
set y = GetUnitY(caster)
if(aim == null)then
set pos = GetSpellTargetLoc()
set angle = Atan2(GetLocationY(pos) - y,GetLocationX(pos) - x)
call RemoveLocation(pos)
set pos = null
else
set angle = Atan2(GetUnitY(aim) - y,GetUnitX(aim) - x)
set aim = null
endif
set localunit = CreateUnit(playerid,'nskk',x,y,angle)
call SetUnitPathing( localunit, false )
call IssuePointOrder( localunit, "move", GetUnitX(localunit) + 800 * Cos(angle),GetUnitY(localunit) + 800 * Sin(angle) )
call SetUnitFlyHeight( localunit, 100.00, 100.00 )
call UnitRemoveAbility( localunit, 'Amrf' )
endif
set caster = null
endfunction
//===========================================================================
function InitTrig_Begin takes nothing returns nothing
set gg_trg_Begin = CreateTrigger()
set udg_indexA = 0
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Begin,Player(udg_indexA),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
set udg_indexA = udg_indexA + 1
exitwhen udg_indexA > 11
endloop
call TriggerAddAction(gg_trg_Begin,function Trig_Begin_Actions)
endfunction |