- Joined
- Aug 15, 2007
- Messages
- 11
Hello all,
I'm trying to detect whether or not an Amphibious unit is on water. I've scoured the forums, and came up with this:
Just to emphasize - I have hardly any idea what I'm doing here, as JASS is completely alien to me. I understand that this function will take an x and an y of a spot on the map and determine whether or not that spot is indeed water, but I'm getting all sorts of errors -- the "Expected a name" one being the most prominent one.
What I want is to have this function check if a specified unit is currently floating on water, and return a boolean so I can use the GUI to do whatever it is I want to do. JASS purists will undoubtably disagree with that last part, but I'd prefer to stick to things I understand -- it's just that I haven't been able to find an efficient way of doing this in the GUI, so I have no choice.
Can anyone help me out? Thanks in advance.
Edit: I suppose I should clarify that I want to call this function using "Custom Script".
Edit 2: If at all possible, it would be even better if it would only return true when said unit is floating over deep water.
I'm trying to detect whether or not an Amphibious unit is on water. I've scoured the forums, and came up with this:
JASS:
function IsPointWater takes real x, real y returns nothing
if ( not IsTerrainPathable(x,y,PATHING_TYPE_FLOATABILITY) == true ) then
set udg_NAGAONWATER = true
else
set udg_NAGAONWATER = false
endif
endfunction
Just to emphasize - I have hardly any idea what I'm doing here, as JASS is completely alien to me. I understand that this function will take an x and an y of a spot on the map and determine whether or not that spot is indeed water, but I'm getting all sorts of errors -- the "Expected a name" one being the most prominent one.
What I want is to have this function check if a specified unit is currently floating on water, and return a boolean so I can use the GUI to do whatever it is I want to do. JASS purists will undoubtably disagree with that last part, but I'd prefer to stick to things I understand -- it's just that I haven't been able to find an efficient way of doing this in the GUI, so I have no choice.
Can anyone help me out? Thanks in advance.
Edit: I suppose I should clarify that I want to call this function using "Custom Script".
Edit 2: If at all possible, it would be even better if it would only return true when said unit is floating over deep water.