• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Camera

Level 26
Joined
Sep 7, 2018
Messages
543
Code:
function AdjustLocalCameraSettings_Distance takes player p, real r returns nothing
    if LocalPlayer==p then //camera
        call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,r,0)
        call SetCameraField(CAMERA_FIELD_FARZ,100000,0)
        call SetCameraDefaultHeight(0,r)
        call SetCameraDefaultHeight(1,r-150.*1)
        call SetCameraDefaultHeight(2,r-150.*2)
        call SetCameraDefaultHeight(3,r-150.*3)
        call SetCameraDefaultHeight(4,r-150.*4)
        call SetCameraDefaultHeight(5,r-150.*5)
    endif
endfunction

function ChangeCamDistance takes nothing returns nothing
    local real r=S2R(SubString(GetEventPlayerChatString(),5,15))
    local real minN=0.99
    local real minD=1650
    if bj_isSinglePlayer then
        set minN=0.5
        set minD=825
    endif
    call SetCameraField(CAMERA_FIELD_FARZ,100000000,0)
    if r<=minN then
        call AdjustLocalCameraSettings_Distance(LocalPlayer,2475)
        call Error(LocalPlayer,"Incorrect multiplier, camera changed to default.")
    elseif r>minN and r<=5 then
        call AdjustLocalCameraSettings_Distance(LocalPlayer,1650*r)
    elseif r>=minD and r<=8250 then
        call AdjustLocalCameraSettings_Distance(LocalPlayer,r)
    else 
        call Error(LocalPlayer,"Incorrect camera distance.")
    endif
endfunction
Top