• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Camera Script

Status
Not open for further replies.
Level 3
Joined
Aug 22, 2009
Messages
51
Hi,
i managed to make a 3rd camera view wich goes up and down when the unit is going up or down with it,
i am using this jass script to disable the auto z movement, and just place it at the height i wish, as you can see:
JASS:
function SetCameraZ takes real z returns nothing
    set z = GetCameraField(CAMERA_FIELD_ZOFFSET)+z-GetCameraTargetPositionZ()
    call SetCameraField(CAMERA_FIELD_ZOFFSET,z,- 0.01)
    call SetCameraField(CAMERA_FIELD_ZOFFSET,z,0.01)
endfunction

  • Custom script: call SetCameraZ (udg_CameraHeight)
now the problem i can't set different players different Z heights, how can i change it so it will work with different z for different players, let's say the Variable Z will be with 6 arrays, named CameraZ[1~6].
 
Level 12
Joined
Jul 27, 2008
Messages
1,181
Pass a player then use GetLocalPlayer. Quick edit of what you got:
JASS:
function SetCameraZ takes real newCameraZ, player changedPlayer returns nothing

    if GetLocalPlayer() ==  changedPlayer then
        set newCameraZ = GetCameraField(CAMERA_FIELD_ZOFFSET)+newCameraZ-GetCameraTargetPositionZ()
    endif
    
    call SetCameraField(CAMERA_FIELD_ZOFFSET,newCameraZ,- 0.01)
    call SetCameraField(CAMERA_FIELD_ZOFFSET,newCameraZ,0.01)
endfunction
PS. Also changed the variable names, I like seeing good, explanatory names.
 
Status
Not open for further replies.
Top