• 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 >> height offset

Status
Not open for further replies.
Level 4
Joined
Nov 9, 2005
Messages
113
I'm making an FPS and I'd like to know if there is a way
of making an action like this:
camera - set player 1's camera height offset to current Z of unit + 120
The Z of unit means it's current height in the game, like on a hill or something.
I didn't find anything like that. Without it the camera will go through higher terrain.
 
Level 10
Joined
Jul 14, 2004
Messages
463
It pans following the terrain, but if the unit runs down a hill and behind the terrain is higher than in front of it, the camera will go through.
I think you'll have to do it with regions, yes. But I think there may be a JASS function to get the z value of a point in terrain or another object, you should try a search for it at first.
 
Level 4
Joined
Nov 9, 2005
Messages
113
:? I have never used JASS scripst. How do I paste it as a trigger?
I know that there is a function to use a custom script, but how do you exatly have to do it?
 
Level 10
Joined
Jul 14, 2004
Messages
463
Just use "general - custom script" and you can put a line in directly into the map's JASS script.
So for use in triggers, do it like that:
-make a variable of type location (e.g. 'UnitLoc') and a variable of real (e.g. 'LocZ')
-use 'set variable‘ to set the location 'UnitLoc' to the unit's current position
-insert a 'custom script' action and enter the following text:
Code:
set udg_LocZ=GetLocationZ(udg_UnitLoc)

You should remember that global variables (those you can make with the graphical user interface) always have the prefix 'udg_' if you use them in JASS script.
 
Level 4
Joined
Nov 9, 2005
Messages
113
"set udg_LocZ=GetLocationZ(udg_UnitLoc)"
Is this all? Cuz in other scripts you always see 'call ...'
Sure it works? Well, I'm gonna try it.
Great thanks for helping me with the script trigger, Waldbär.
 
Level 4
Joined
Nov 9, 2005
Messages
113
It looked like it was working, but when you walk into lower terrain the camera goes down too much and when
you get in higher terrain the camera goes UP too much. I see that the units used in the script are different to
the ones in WC3. ...!?...No...impossible...
What's wrong?
 
Level 10
Joined
Jul 14, 2004
Messages
463
This line doesn't need a call because you don't call a special action, but you only set a variable to a function's return value, like you can do it with GUI e.g. for "set unitvariable = (Last created unit)", the only difference is that this z-function isn't available in GUI.

If you react to the z-Value like you said in the first post, of course it doesn't work because the camera's z-Value depends on the terrain and your absolute z-Value you got from the function doesn't. If you only want what you described with this action, just change the camera's z in the camera layer of the main editor window.
I think your problem is different, because you have to adjust the camera's perspective depending on the unit is either going up or down, don't you?
 
Level 4
Joined
Nov 9, 2005
Messages
113
Waldbär said:
This line doesn't need a call because you don't call a special action, but you only set a variable to a function's return value, like you can do it with GUI e.g. for "set unitvariable = (Last created unit)", the only difference is that this z-function isn't available in GUI.
cool..cool...
Waldbär said:
I think your problem is different, because you have to adjust the camera's perspective depending on the unit is either going up or down, don't you?
(Perspective?! Nah... Height.) Well summat like that.
the camera's height must be changed to a lil more than the unit's current height.
Like when she(the ninja) goes up a hill the camera doesn't get so close to the ground.

The first trigger was like this:
E: - every 0.01"
C: - none
A: - set p1's camera height offset to 120

This went through higher terrain as I told you.

The second trigger was like this (I used different triggers for each action):
E: - every 0.01"
C: - none
A: - set UnitLoc = position unit
- set udg_LocZ=GetLocationZ(udg_UnitLoc)
- set p1's camera height offset to ZLoc + 120

And should have worked, but when I went higher the camera went to high and when I went lower the cam went to low.

Well, I don't really know whats wrong, unless I triggered something wrong. I shall try again.
 
Status
Not open for further replies.
Top