• 🏆 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!

[Trigger] Camera Height of Unit

Status
Not open for further replies.
Level 4
Joined
Jun 25, 2008
Messages
67
Hey, could someone help me create a trigger that will get the height of the unit, lock the camera to them, etc. Because, right now i have a map with very low, up to very high height, and whenever i climb up the ladder, the camera is wayyyy too low, thank you
 
Level 7
Joined
Oct 14, 2008
Messages
340
JASS:
function SetCameraFieldForPlayer (player whichPlayer, camerafield whichField, real value, real duration) returns nothing
the "camera field" you want is CAMERA_FIELD_ZOFFSET, and value is the height of your camera.. duration being how long it takes to pan to that height.

or..

  • Camera - Set Player 1 (Red)'s camera Far Z to X over 0.00 seconds
hope this helps.
 
Nightmare-, get the action Maximilianx and Berbanog gave you. In the place of Far Z/Height Offset respectively, you will get other options as well, e.g. Angle of Attack. All these fix your camera standard settings, the way you want them set up.
Now, there is a Jass function, that restores the camera, if the units is moving on high-leveled grounds, e.g. a big hill. To fix the camera up in this case, do this:
  • Set Loc1 = (Position of (your unit here))
  • Custom script: set udg_Z_Camera = GetLocationZ(udg_Loc1)
  • Camera - Set (Owner of (Your unit here))'s camera Height Offset to ((Z_Camera) + 100)
  • Custom script: call RemoveLocation (udg_Loc1)
The "100" value above is a prefix height offset you will decide how much it will be.

In case you seek for flying height modifications, do this:
  • Camera - Set (Owner of (Your unit here))'s camera Height Offset to ((Flying height of (Your unit here)) + 100)
"100" has the same role as above; it can be any number you want.

If it has to do with destructibles, I think the Occlusion Height is what you want (but I really am not sure).
 
Level 2
Joined
Mar 25, 2008
Messages
11
Well, i'm having sort of the same problem. I got a 3rd cam and i want my camera to follow my character when he moves up on mountains and other hights. Would be thankful if someone could help me with this! :eek:
 
Level 4
Joined
Jun 25, 2008
Messages
67
Alright, so I set up the trigger like Pharaoh told me. Although whenever I try to start the game, I get a compile error for

Custom Script: set udg_Z_Camera = GetLocationZ(udg_Loc1)

and I have the time set to every .05 seconds of game
Is there anything I am doing wrong?
Thanks!
 
Level 4
Joined
Jun 25, 2008
Messages
67
  • Camera Fix
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set Loc1 = (Position of Blood Mage 0015 <gen>)
      • Custom script: set udg_Z_Camera = GetLocationZ(udg_Loc1)
      • Camera - Set (Owner of Blood Mage 0015 <gen>)'s camera Height Offset to ((Height Offset of Z_Camera) + 100.00) over 0.00 seconds
      • Custom script: call RemoveLocation (udg_Loc1)
So, some things I might have done wrong is in
Camera - Set (Owner of Blood Mage 0015 <gen>)'s camera Height Offset to ((Height Offset of Z_Camera) + 100.00) over 0.00 seconds
there is 2 height offsets
and the Z_Camera is a Camera Object variable and the Loc1 is a point variable, is that right?
 
Status
Not open for further replies.
Top