|
发表于 2010-1-1 16:30:43
|
显示全部楼层
相关变量的声明没有加上。
[jass]
function Trig_BuyHero_Conditions takes nothing returns boolean
integer SheepPigId = GetUnitTypeId(GetSoldUnit())
return SheepPigId == SheepId or SheepPigId ==PigId
endfunction
function Trig_BuyHero_Actions takes nothing returns boolean
unit SheepPig = GetSoldUnit()
local player Owner = GetOwningPlayer(SheepPig)
local integer SheepPigId = GetUnitTypeId(SheepPig)
if SheepPigId == SheepId then
call SetUnitPosition(SheepPig,LightStartX,LightStartY)
call PanCameraToTimedForPlayer(Owner, LightStartX,LightStartY,1.0)
SheepNum++
if SheepNum == LightHeroNumMax then
RemoveUnitFromStock(LightBase,SheepId)
endif
endif
if SheepPigId ==PigId then
call SetUnitPosition(SheepPig,DarkStartX,DarkStartY)
call PanCameraToTimedForPlayer(Owner , DarkStartX,DarkStartY,1.0)
PigNum++
if PigNum == DarkHeroNumMax then
RemoveUnitFromStock(DarkBase,PigId)
endif
endif
TriggerRegisterUnitInRange(SelectionTrigger, SheepPig,SelRadius,null )
set SheepPig = null
set Owner = null
return false
endfunction
//===========================================================================
function InitBuyHero takes nothing returns nothing
call TriggerRegisterPlayerUnitEvent(gg_trg_BuyHero,Player(5), EVENT_PLAYER_UNIT_SELL,null )
call TriggerRegisterPlayerUnitEvent(gg_trg_BuyHero,Player(11), EVENT_PLAYER_UNIT_SELL,null )
call TriggerAddCondition( gg_trg_BuyHero, Condition( function Trig_BuyHero_Conditions ) )
call TriggerAddAction( gg_trg_BuyHero, function Trig_BuyHero_Actions )
endfunction[/jass] |
|