• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] Need to put together small script about Zvalues

Status
Not open for further replies.
Level 2
Joined
Jun 16, 2009
Messages
9
The only thing I could find on detecting height of units on land, was this.
JASS:
library GetUnitZ

globals
        private location tempLocation = Location(0., 0.)
endglobals

function GetTerrainZ takes real x, real y returns real
        call MoveLocation(tempLocation, x, y)
        return GetLocationZ(tempLocation)
endfunction

What I need to know, is what do I do with this little script? What do I need to change and what do I add to it to make it work. And most importantly, Does it even do what I'm looking for? :ugly:

I need to detect how High or how Low a unit is, if a unit is below my water table by a certain ammount, I want him to slow down (waist deep) but if he is above his head, I want him to take damage.

Code:
if zvalue of triggering unit >= X giveability slowmovement
and
Code:
if zvalue of triggering unit >= X giveability drowning


I also had an idea about detecting how steep a hill was, and if its a rediculous angle making the unit not able to climb it and force them to turn around.. so something like..
Code:
 if zvalue of triggering unit >= X move triggeringunit towards facing degrees of unit -180 degrees




I would love for someone to atleast give me some advice on what to do, if theres some sort of template map or script somewhere else I should refer to.

if a kind soul tosses a script to me, please explain what values I need to change to make the script work correctly for detecting a unit, and perhaps even a way to implement it if needed. :)
 
Level 9
Joined
Jul 3, 2008
Messages
495
The
JASS:
GetLocationZ()
script can cause desync in multiplayer.

And the reason why it can, is because not every player run wc3 at max
graphic quality. So if you run the script in multiplayer and one player use
low quality and another high. - it will cause desync.

But wc3 is so old, so who dont run it at high?

(else just make a msg at the start of the game telling the players to run it at high)
 
Level 2
Joined
Jun 16, 2009
Messages
9
is there some sort of work around I can use that wont cause desyncs?

I would hate to have a desync problem in a Wilderness Survival map :/ (They tend to be fairly long and highly team based)

Even if its GUI (which I dont think has a way of doing it)
or even a combination between the two, I just need to get this sorted out for my map, and will consider putting the generator out as a resource as well. [:
 
Status
Not open for further replies.
Top