- Joined
- Nov 13, 2006
- Messages
- 1,814
in most of time i used this
but seems this work aswell in splayer
here i thing still not desync but maybe somewhere else can where i add value to a variable array like for player 1, udg_CameraType[1=player number]=1, can disconect to player 2 coz there udg_CameraType[1=player number] still =0?
or no till i use array what another player dont touch?
if no then the another question, what happen if i use normal variable instead variable arrray like if GetLocalPlayer do action then udg_CameraType=1 endif
so basically if each player can have different value in same global variable
so i can use this in most of place where i must check 12 player and modify variable or its desync if example player 2 dont get when player 1 variable is modified?
JASS:
function Trig_Camera_Periodic_Actions takes nothing returns nothing
local integer i = 0
local integer maxp = 11
local player p
local location loc
local unit u
loop
exitwhen i > maxp
set p = Player(i)
set u = udg_SelectedUnit[i]
set loc = GetUnitLoc(u)
if ( udg_CameraType[i] == 1 and GetPlayerController(p) == MAP_CONTROL_USER ) then
if (GetLocalPlayer() == p) then
call SetCameraField(CAMERA_FIELD_ROTATION, GetUnitFacing(u), 1)
call SetCameraField(CAMERA_FIELD_FARZ, 50000, 1)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, udg_AngleOfAttack[i], 1)
call PanCameraToTimedWithZ (GetLocationX(loc),GetLocationY(loc),150+GetUnitFlyHeight(u)+GetLocationZ(loc),0.15)
endif
endif
set i = i + 1
endloop
call RemoveLocation(loc)
set p = null
set loc = null
set u = null
endfunction
but seems this work aswell in splayer
JASS:
function Trig_Camera_Periodic1_Actions takes nothing returns nothing
local player p = GetLocalPlayer()
local integer i = GetPlayerId(p)
local location loc
local real z
local unit u
if udg_CameraType[i] == 1 then
set u = udg_SelectedUnit[GetPlayerId(p)]
set loc = GetUnitLoc(u)
call SetCameraField(CAMERA_FIELD_ROTATION, GetUnitFacing(u), 1)
call SetCameraField(CAMERA_FIELD_FARZ, 50000, 1)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, udg_AngleOfAttack[i], 1)
call PanCameraToTimedWithZ (GetLocationX(loc),GetLocationY(loc),150+GetUnitFlyHeight(u)+GetLocationZ(loc),0.15)
call RemoveLocation(loc)
endif
set p = null
set loc = null
set u = null
endfunction
here i thing still not desync but maybe somewhere else can where i add value to a variable array like for player 1, udg_CameraType[1=player number]=1, can disconect to player 2 coz there udg_CameraType[1=player number] still =0?
or no till i use array what another player dont touch?
if no then the another question, what happen if i use normal variable instead variable arrray like if GetLocalPlayer do action then udg_CameraType=1 endif
so basically if each player can have different value in same global variable
so i can use this in most of place where i must check 12 player and modify variable or its desync if example player 2 dont get when player 1 variable is modified?