GetMapInfo( x, y ).z V.S.

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Lagoon
Grandmaster Poster
Posts: 118
Joined: Sun Mar 05, 2006 7:25 am

GetMapInfo( x, y ).z V.S.

Post by Lagoon »

Is there any difference between

Code: Select all

GetMapInfo( x, y ).z
and

Code: Select all

GetWorldHeight( x, y )
?

The docs say GetWorldHeight( x, y ) returns "z value of lowest standing height", but about GetMapInfo( x, y ) they only say "z = map height at x,y. Not necessarily the same as GetStandingHeight()" (which is obvious because GetStandingHeight() can return different values for the same x,y coords according to the startz value passed).
Xadhoom
Neophyte Poster
Posts: 30
Joined: Fri May 26, 2006 12:53 am

Post by Xadhoom »

They can be different, i think, if there is a static walkable floor under the map (like those buildings near Yew), but never tested it
Marilla

Post by Marilla »

They are two entirely different functions that serve two entirely different purposes.

GetMapInfo does just what its name suggests and the docs say; returns information about the map at the x, y passed. The .z member returned is the Z level of the map at that location.

GetWorldHeight returns a simple integer value that, as the docs say, indicates the lowest standing height.

GetStandingHeight is still another different thing, that returns a standing height based on the Z you pass to it as the .z member of the return struct.


You have to consider what the docs are saying these functions return, carefully, to see what the difference is. Maybe this will help.

Let's say on your map, at the coords 100, 100, your map tile is water (0x00AA, for example) and it is at -5 z. Let's say you've built a wooden 'stilt' structure in statics that has two storeys; One at 10 z, and the other at 30z.

GetMapInfo(), obviously, would return .z = -5. It also returns the map tile info. NOTE: .z -5 is not a standable location at all!, proving that GetMApInfo().z and GetStandingHeight/GetWorldHeight are not at all necessarily related in the least.

GetWorldHeight would return what the docs say it would return: the lowest, standable height. 10, in this case. If there were no statics at that location at all, GetWorldHeight would return "Nowhere", according to the docs. Note that in neither case, is GetWorldHeight the same as GetMapInfo().z!

GetStandingHeight() with a startz parameter of, say, 40, would return a struct with a .z parameter of 30. GetStandingHeight(), also unlike GetWorldHeight, does not return a simple integer value; It also returns a struct, in this case with a .z and a .multi member.



Of course, there will be times when GetMApInfo().z and GetWorldHeight() will happen to have the same value, because the map happens to be the standing height. But you have to consider carefully what the functions' documentation says it returns otherwise, to know which to use, and when.
Lagoon
Grandmaster Poster
Posts: 118
Joined: Sun Mar 05, 2006 7:25 am

Post by Lagoon »

Thank you very much, a very clean con complete explanation ^_^
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post by Yukiko »

If there were some way to take these explanations and somehow catalogue them somewhere it would be nice.
Post Reply