• 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.

[JASS] GetLocationZ() does not change for cliffs

Status
Not open for further replies.
Hi guys,

I was just about to update my missile engine and I found out that GetLocationZ() does not take care of the cliffs.

If I throw an unit to the target and there is a cliff on the way, it still says the height is the same.

If you want I will attach my missile engine and you will see what I mean.

Basically:
Start + Target location have same cliff level.
Put a cliff which is on the way.
Throw a missile to the target.
Print the Z-Value of GetLocationZ all the time.

Wonder why it never goes +64. (+1 clifflevel)
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
GetLocationZ() does detect cliffs. You must be doing something wrong if it's not working. I've made several missile systems, and a physics engine, and I have never encountered issues with cliffs. And I'm not using the functions for cliff levels.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Not really sure what you mean by "abusing" vJass... if you're using GetLocationZ then it works whether you're using cliffs or raise/lower terrain.

Print the Z-Value of GetLocationZ all the time.

Wonder why it never goes +64. (+1 clifflevel)

Depending on your current level, it will go from (lets use your numbers) 64 and rapidly decrease from 64 to either 0 or -64 depending on the height of a cliff (I forget, its one or the other) and then stay steady and then rapidly incline. Can I see the code you're using to print the location Z?

They did this on purpose to allow doodads to be placed "on" cliffs with at least a little bit of realism. Open the doodads layer and zoom in on a cliff, move your mouse perpendicular across the cliff and you can see this in action.

They are simply placed on the location Z of the terrain point that they are placed on. The cliff level does not make the height go from 0 to X in an instant, its a fairly quick but gradual incline. You can see the same effect if you set a flying unit with 0 height. It not possible to move a unit to a point that is lower than the terrain.
 
I give up.
Could someone please check what's wrong with my missile engine?

I have module MissileUnitTarget and MissileLocTarget, and they both use MissileMovement.

When I have a struct UnitTargetMissile and give it the MissileUnitTarget module it also triggers the initialization of MissileLocTarget.

Please check the attached map.

Second thing is, why does the unit not have proper flight height on water cliffs? On land everything seems to be fine.

View attachment PS_UP_v.0.1.8.w3x
 
If you throw the missile to a target and it's in shallow water, it makes weird spikes (when its on the cliffs) and also the Target Point Missile somehow triggers the UnitTargetCleanup method, but its only declared in MissileUnitTarget module and the missile of my spell does NOT have the module (thus firing the null struct deallocation).
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
I can't actually modify your map to test anything since my version of JNGP doesn't support some things in your code, but I suspect it isn't actually a code issue. Movement type "foot" on your dummy sets it on the ground assuming 0 fly height--even if the ground is underwater--whereas GetLocationZ considers water to be ground. "Hover" would fix this specific issue (since the unit will use the water level as the ground level as well), but would make fly height mess up around cliffs. I don't recall any good solution.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
It doesn't matter what you use to set the fly height, sorry if my post was unclear; what I mean is that for a given unit with 0 fly height and move type "foot", it will be underwater since it measures from the ground underneath the water (and 50 fly height would be 50 above that, etc), whereas GetLocationZ (and move types "hover"/"fly") measure from the top of the water as 0. It's easy to test if this is in fact the problem since changing your dummy's move type to "hover" should fix the display issues over water (but cause different ones over cliffs, so don't expect this to be a miracle fix).

And yeah, the issue with JNGP is presumably that mine is super outdated from back when I actually used to mod wc3, but I can't really be bothered to update it at this point.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
When I set my dummy (in my Projectiles library) to movement type "Hover" (as well as doing the Raven Form thing) it seems to fix the display glitch over water.

I don't think this has anything to do with vJass though.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
When I set my dummy (in my Projectiles library) to movement type "Hover" (as well as doing the Raven Form thing) it seems to fix the display glitch over water.

I don't think this has anything to do with vJass though.
Of course not; it has to do with the fact that the unit move type considers the ground to be in a different place than GetLocationZ does.
 
Status
Not open for further replies.
Top