1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  4. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  5. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Do you have good ideas for new contests? If so, please open new threads in the Contest Submission sub-forum to discuss them.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Water Check

Discussion in 'World Editor Help Zone' started by Duhcake, Feb 21, 2009.

  1. Duhcake

    Duhcake

    Joined:
    Oct 13, 2008
    Messages:
    287
    Resources:
    0
    Resources:
    0
    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]
     
  2. Restor

    Restor

    Joined:
    Mar 26, 2005
    Messages:
    728
    Resources:
    0
    Resources:
    0
    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
     
  3. Saishy

    Saishy

    Joined:
    Mar 23, 2008
    Messages:
    947
    Resources:
    0
    Resources:
    0
    I think you can check terrain pathable
     
  4. Shyhalu

    Shyhalu

    Joined:
    Mar 20, 2008
    Messages:
    207
    Resources:
    0
    Resources:
    0
    Code (vJASS):
    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


     
     
  5. Duhcake

    Duhcake

    Joined:
    Oct 13, 2008
    Messages:
    287
    Resources:
    0
    Resources:
    0
    I don't think i can do it with Jass... Well thanks for help anyways :]
     
  6. Saishy

    Saishy

    Joined:
    Mar 23, 2008
    Messages:
    947
    Resources:
    0
    Resources:
    0
    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.
     
  7. CrueIIntentions

    CrueIIntentions

    Joined:
    Jun 7, 2008
    Messages:
    440
    Resources:
    0
    Resources:
    0
    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.
     
  8. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    WTF cant we check terrain level in GUI ?
    we must be able to like terrain hight level is lower than 0
     
  9. Saishy

    Saishy

    Joined:
    Mar 23, 2008
    Messages:
    947
    Resources:
    0
    Resources:
    0
    but you can have water in mountains...
     
  10. -Berz-

    -Berz-

    Joined:
    Mar 5, 2008
    Messages:
    3,203
    Resources:
    123
    Icons:
    111
    Packs:
    1
    Skins:
    1
    Spells:
    10
    Resources:
    123
    • (Terrain pathing at <your point> of type Floatability is off) Equal to False


    This condition will check if the point is located on water.
     
  11. Saishy

    Saishy

    Joined:
    Mar 23, 2008
    Messages:
    947
    Resources:
    0
    Resources:
    0
    why double negative?
     
  12. Archangel_Tidusx

    Archangel_Tidusx

    Joined:
    Feb 24, 2007
    Messages:
    1,080
    Resources:
    9
    Models:
    1
    Icons:
    4
    Maps:
    4
    Resources:
    9
    Its not really double negative. It's like saying
    your unit cannot float is equal to false.

    that rules out whether or not the unit is on water.
     
  13. -Berz-

    -Berz-

    Joined:
    Mar 5, 2008
    Messages:
    3,203
    Resources:
    123
    Icons:
    111
    Packs:
    1
    Skins:
    1
    Spells:
    10
    Resources:
    123
    It works for my spell, why shouldn't it work for his trigger, its the same thing.
     
  14. Lord_BoNes

    Lord_BoNes

    Joined:
    Sep 5, 2007
    Messages:
    264
    Resources:
    0
    Resources:
    0
    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).
     
  15. Archangel_Tidusx

    Archangel_Tidusx

    Joined:
    Feb 24, 2007
    Messages:
    1,080
    Resources:
    9
    Models:
    1
    Icons:
    4
    Maps:
    4
    Resources:
    9
    Good idea, but sometimes people (like me) decrease the level under deep water.
    _____________________________________________
    |_____Shallow water______________|
    ....|_____ Deep water ____|..
    ......|_Even Deeper__|
     
  16. Duhcake

    Duhcake

    Joined:
    Oct 13, 2008
    Messages:
    287
    Resources:
    0
    Resources:
    0
    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 :]
     
  17. Archangel_Tidusx

    Archangel_Tidusx

    Joined:
    Feb 24, 2007
    Messages:
    1,080
    Resources:
    9
    Models:
    1
    Icons:
    4
    Maps:
    4
    Resources:
    9
    I think the best way would be the floatability check.
    All the other ways seem to be specific to certain situations.