- Joined
- Aug 27, 2012
- Messages
- 362
Is there a function to get the x and y coordinates of the current location of a player's game camera? Or any method to detect this?
constant native GetCameraTargetPositionX takes nothing returns real
scope UpdateCamHeight initializer OnInit
private function CB takes nothing returns nothing
local real x
local real y
local boolean b = false
if GetLocalPlayer() == GetEnumPlayer() then
set x = GetCameraTargetPositionX()
set y = GetCameraTargetPositionY()
if ((GetRectMinX(gg_rct_Normal_Area) <= x) and (x <= GetRectMaxX(gg_rct_Normal_Area)) and (GetRectMinY(gg_rct_Normal_Area) <= y) and (y <= GetRectMaxY(gg_rct_Normal_Area))) or ((GetRectMinX(gg_rct_Normal_Area_2) <= x) and (x <= GetRectMaxX(gg_rct_Normal_Area_2)) and (GetRectMinY(gg_rct_Normal_Area_2) <= y) and (y <= GetRectMaxY(gg_rct_Normal_Area_2))) or ((GetRectMinX(gg_rct_Normal_Area_3) <= x) and (x <= GetRectMaxX(gg_rct_Normal_Area_3)) and (GetRectMinY(gg_rct_Normal_Area_3) <= y) and (y <= GetRectMaxY(gg_rct_Normal_Area_3))) then
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,2250.,.1)
set b = true
endif
if not b and (GetRectMinX(gg_rct_Lake_Settlement) <= x) and (x <= GetRectMaxX(gg_rct_Lake_Settlement)) and (GetRectMinY(gg_rct_Lake_Settlement) <= y) and (y <= GetRectMaxY(gg_rct_Lake_Settlement)) then
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,3600.,.1)
set b = true
endif
if not b and (GetRectMinX(gg_rct_Mountain_Pass) <= x) and (x <= GetRectMaxX(gg_rct_Mountain_Pass)) and (GetRectMinY(gg_rct_Mountain_Pass) <= y) and (y <= GetRectMaxY(gg_rct_Mountain_Pass)) then
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,3000.,.1)
set b = true
endif
if not b and (GetRectMinX(gg_rct_Mountain_Area) <= x) and (x <= GetRectMaxX(gg_rct_Mountain_Area)) and (GetRectMinY(gg_rct_Mountain_Area) <= y) and (y <= GetRectMaxY(gg_rct_Mountain_Area)) then
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,3000.,.1)
set b = true
endif
if not b then
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,2250.,.1)
endif
endif
endfunction
private function Handler takes nothing returns nothing
call ForForce(bj_FORCE_ALL_PLAYERS,function CB)
endfunction
private function OnInit takes nothing returns nothing
local integer i = 0
call TimerStart(NewTimer(),.03125,true,function Handler)
loop
exitwhen i == 12
if GetLocalPlayer() == Player(i) then
call SetCameraField(CAMERA_FIELD_FARZ,10000.,0.)
endif
set i = i + 1
endloop
endfunction
endscope
loop
exitwhen i == 12
if GetLocalPlayer() == Player(i) then
call SetCameraField(CAMERA_FIELD_FARZ,10000.,0.)
endif
call SetCameraField(CAMERA_FIELD_FARZ,10000.,0.)