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

Water Check

Status
Not open for further replies.
Level 7
Joined
Oct 13, 2008
Messages
300
Meh, Didn't figure any better title, But to the point, Is there any way to check of you're unit is standing on water with trigger's? Simple question would be likely answered with simple answer? x]
 
Level 12
Joined
Mar 26, 2005
Messages
790
I know one option


Condition:Terrain Type Comparision- Terrain type of possition of triggering unit equal to XY terrain


But you must have all the water with the same tileset and nowhere else can be the same tile
 
Level 6
Joined
Mar 20, 2008
Messages
208
JASS:
function IsPointWater takes real x, real y returns boolean
    return IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) and not(IsTerrainPathable(x,y,PATHING_TYPE_AMPHIBIOUSPATHING))
endfunction

function IsPointWaterLoc takes location loc returns boolean
    return IsPointWater(GetLocationX(loc),GetLocationY(loc))
endfunction
 
Level 12
Joined
Mar 23, 2008
Messages
942
I don't think i can do it with Jass... Well thanks for help anyways :]

Oh my god...

Okay, don't give up...
Create a new variable (CTRL + B) named Bool and make it a boolean type.
Create a new variable (CTRL + B) named temppoint and make it a Point type.

copy our friend jass trigger and paste in the map header (inside triggers, is the first trigger named equally your map name, it have a map as icon, inside have nothing)

now inside the trigger you want for the spell do:

  • AFF
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to YOUR ABILITY!
    • Actions
      • Set temppoint = (Target point of ability being cast)
      • Custom Script: set udg_Bool = IsPointWaterLoc(udg_temppoint)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Bool Equal to True
        • Then - Actions
          • -------- DO YOUR ACTIONS HERE! --------
        • Else - Actions
      • Custom Script: call RemoveLocation(udg_temppoint)
I shouldn't be doing this, since you gave up.
But never give up again.
 
Level 9
Joined
Jun 7, 2008
Messages
440
You could also do regions for all your water areas:
  • Events
    • Unit - a unit enters Water1
    • Unit - a unit enters Water2
    • ------ Ect. for however many water regions you have ------
  • Conditions
  • Actions
    • Game - Display to (all players) the message: OH MY GOD! DON'T GIVE UP! HE'S ON WATER!
It may get a little tricky if you have many corners. But patience and determination, and you'll get it. As well, it helps if you go read a JASS tutorial, as GUI is a little limited when it comes to triggering.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
WTF cant we check terrain level in GUI ?
we must be able to like terrain hight level is lower than 0
 
Level 6
Joined
Sep 5, 2007
Messages
264
Only for deep water:
Make two dummy units, one that is amphibious, one that's not, both with 0 collision... create them both on the same spot, do a SetUnitPosition(unit, spot_x, spot_y) for both of them (to force an update), and check if they are both still on the same spot... if not, then it MUST be over deep water (if the terrain was cliffs or something, the update would still move them to the same spot, just not the original place).
 
Only for deep water:
Make two dummy units, one that is amphibious, one that's not, both with 0 collision... create them both on the same spot, do a SetUnitPosition(unit, spot_x, spot_y) for both of them (to force an update), and check if they are both still on the same spot... if not, then it MUST be over deep water (if the terrain was cliffs or something, the update would still move them to the same spot, just not the original place).
Good idea, but sometimes people (like me) decrease the level under deep water.
_____________________________________________
|_____Shallow water______________|
....|_____ Deep water ____|..
......|_Even Deeper__|
 
Level 7
Joined
Oct 13, 2008
Messages
300
Well, Do these work if the water level isn't created with cliff's, Cause i made the water level by creating the map with swallow water, And heighened the terrain at some spot's so it would look nicer... Gotta try out some of those, Thanks again for helping me out :]
 
Well, Do these work if the water level isn't created with cliff's, Cause i made the water level by creating the map with swallow water, And heighened the terrain at some spot's so it would look nicer... Gotta try out some of those, Thanks again for helping me out :]

I think the best way would be the floatability check.
All the other ways seem to be specific to certain situations.
 
Status
Not open for further replies.
Top