|
[codes=jass]function CtrlCameraForUnit takes unit ua,player p returns nothing
call Debug("CtrlCameraForUnit")
if (GetLocalPlayer() == p) then
call ClearSelection()
call SelectUnit(ua,true)
call PanCameraToTimed( GetUnitX(CHero),GetUnitY(CHero), 0 )
endif
endfunction
function ReplaceUnitByItemId takes unit ua,integer ItemIdA,integer ItemIdB returns item
local integer i = 0
local item x
loop
set x = UnitItemInSlot(ua, i)
if (x != null) and (GetItemTypeId(x) == ItemIdA) then
call RemoveItem(x)
call UnitAddItemToSlotById(ua,ItemIdB,i)
set x =UnitItemInSlot(ua,i)
set i = 6
endif
set i = i + 1
exitwhen i > 5
endloop
return x
endfunction
function EnterStarArea_Conditions takes nothing returns nothing
if ( UnitHasItemOfTypeBJ(GetTriggerUnit(), 'rde2') == true ) and ( UnitHasItemOfTypeBJ(GetTriggerUnit(), 'wneg') == true )and XXX[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] >= 1 then
call DisplayTextToForce(MsgInRangePlayers(GetTriggerUnit()), "|CFFFF0000潜伏者:“拥有星之翼的人啊,你将从这里直达星界!”|R" )
call DisplayTextToPlayer( GetOwningPlayer(GetTriggerUnit()), 0, 0, "|Cffffff00你的博士法袍上的装饰物正在散发出群星的光彩。|R" )
set Item = ReplaceUnitByItemId(GetTriggerUnit(),'wneg','ktrm')
call SetUnitPosition( GetTriggerUnit(), GetRectCenterX(gg_rct_StarArea), GetRectCenterY(gg_rct_StarArea) )
call CtrlCameraForUnit(GetTriggerUnit(),GetOwningPlayer(GetTriggerUnit()))
endif
endfunction
//===========================================================================
function InitTrig_EnterStarArea takes nothing returns nothing
set gg_trg_EnterStarArea = CreateTrigger( )
call TriggerRegisterUnitInRangeSimple( gg_trg_EnterStarArea, 256, gg_unit_n003_0573 )
call TriggerAddCondition( gg_trg_EnterStarArea, Condition( function EnterStarArea_Conditions ) )
endfunction
[/codes] |
|