Name | Type | is_array | initial_value |
Los_que_cambian | group | No | |
Player | player | No | Player00 |
Player_death | player | No | Player08 |
Timer | timer | No | |
Units | group | No | |
Velocidad | real | No |
globals
unit array Enum
group array Neighbour
integer Index_Max=0
endglobals
function Index takes nothing returns nothing
local location l
set Index_Max=Index_Max+1
set Enum[Index_Max]=GetEnumUnit()
call SetUnitUserData(Enum[Index_Max],Index_Max)
set l=GetUnitLoc(Enum[Index_Max])
set Neighbour[Index_Max]=GetUnitsInRangeOfLocAll(190.00,l)
call GroupRemoveUnit(Neighbour[Index_Max],Enum[Index_Max])
call RemoveLocation(l)
set l=null
endfunction
function Trig_Index_units_Actions takes nothing returns nothing
call ForGroup(udg_Units,function Index)
endfunction
//===========================================================================
function InitTrig_Index_units takes nothing returns nothing
set gg_trg_Index_units=CreateTrigger()
call TriggerAddAction(gg_trg_Index_units,function Trig_Index_units_Actions)
endfunction
function Trig_Set_Camera_Actions takes nothing returns nothing
local string s=GetEventPlayerChatString()
if s=="cam 50" then
call SetCameraField(CAMERA_FIELD_ZOFFSET,50.00,0.50)
elseif s=="cam 100" then
call SetCameraField(CAMERA_FIELD_ZOFFSET,100.00,0.50)
elseif s=="cam 200" then
call SetCameraField(CAMERA_FIELD_ZOFFSET,200.00,0.50)
elseif s=="cam 500" then
call SetCameraField(CAMERA_FIELD_ZOFFSET,500.00,0.50)
elseif s=="cam 1000" then
call SetCameraField(CAMERA_FIELD_ZOFFSET,1000.00,0.50)
endif
endfunction
//===========================================================================
function InitTrig_Set_Camera takes nothing returns nothing
set gg_trg_Set_Camera=CreateTrigger()
call TriggerRegisterPlayerChatEvent(gg_trg_Set_Camera,Player(0),"cam",false)
call TriggerAddAction(gg_trg_Set_Camera,function Trig_Set_Camera_Actions)
endfunction
globals
integer TempInt1
integer TempInt2
integer Int
endglobals
function Vecinos takes nothing returns nothing
if GetOwningPlayer(GetEnumUnit())==udg_Player then
set TempInt1=TempInt1+1
else
set TempInt2=TempInt2+1
endif
endfunction
function Actions takes nothing returns nothing
local unit u=GetEnumUnit()
if GetOwningPlayer(u)==udg_Player then
call SetUnitOwner(u,udg_Player_death,true)
else
call SetUnitOwner(u,udg_Player,true)
endif
set u=null
endfunction
function Trig_Period_Actions takes nothing returns nothing
set Int=1
loop
exitwhen Int>Index_Max
set TempInt1=0
set TempInt2=0
call ForGroup(Neighbour[Int],function Vecinos)
if GetOwningPlayer(Enum[Int])==udg_Player then
if TempInt1<2 or TempInt1>3 then
call GroupAddUnit(udg_Los_que_cambian,Enum[Int])
endif
else
if TempInt1==3 then
call GroupAddUnit(udg_Los_que_cambian,Enum[Int])
endif
endif
set Int=Int+1
endloop
call ForGroup(udg_Los_que_cambian,function Actions)
call GroupClear(udg_Los_que_cambian)
endfunction
//===========================================================================
function InitTrig_Period takes nothing returns nothing
set gg_trg_Period=CreateTrigger()
call TriggerRegisterTimerExpireEvent(gg_trg_Period,udg_Timer)
call TriggerAddAction(gg_trg_Period,function Trig_Period_Actions)
endfunction