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

Is Point Reachable 1.0.2

This bundle is marked as pending. It has not been reviewed by a staff member yet.
Disclaimer: Everything here is based on my interpretation.

What does it do?
This system takes advantage of some of Wc3's own pathfinding to calculate if a point is reachable which has two limitations.
Limitation 1: Can only check if a point is reachable for ground units with less than 32 collision size
Limitation 2: Has limited "range" to find a path. If a path exists but can't be found, it returns false

How does it works?
It's based on the instant (like Berserk) ability Call To Arms. When casting Call To Arms, a unit will try to find a path to the closest Town Hall and if it can't be found the unit won't react, in contrast to the regular pathfinding where the unit attempts to reach its destination, even if a path doesn't exist.

The system in detail
1) The unit Transmitter (1) is moved to the starting point and Reciever (2) to the ending point.
2) The facing of Transmitter (1) is manipulated to avoid false negatives that occur when the Transmitter (1) is near and facing Reciever (2) when ordered to cast Call To Arms. This also avoids Transmitter (1) from morphing and morphing is a waste of resources.
3) Transmitter (1) issues Call To Arms.
4) If Transmitter (1) has the order militia, the point is reachable and the ability Move is removed and re-added from Transmitter (1), which appears to reset the units pathfinding calculations.
  • Is Point Reachable System
    • Events
    • Conditions
    • Actions
      • -------- Moves Transmitter (1) to the starting point and Reciever (2) to the ending point --------
      • Custom script: local real x1 = GetLocationX(udg_IPR_Point[1])
      • Custom script: local real y1 = GetLocationY(udg_IPR_Point[1])
      • Custom script: local real x2 = GetLocationX(udg_IPR_Point[2])
      • Custom script: local real y2 = GetLocationY(udg_IPR_Point[2])
      • Custom script: call SetUnitX(udg_IPR_Unit[1], x1)
      • Custom script: call SetUnitY(udg_IPR_Unit[1], y1)
      • Custom script: call SetUnitX(udg_IPR_Unit[2], x2)
      • Custom script: call SetUnitY(udg_IPR_Unit[2], y2)
      • -------- Avoids false negatives when starting point and ending point are close --------
      • Custom script: call BlzSetUnitFacingEx(udg_IPR_Unit[1], Atan2(y1 - y2, x1 - x2) * 57.3)
      • -------- If Transmitter (1) has order militia, the end point is reachable --------
      • Custom script: call IssueImmediateOrderById(udg_IPR_Unit[1], 852072)
      • Custom script: if GetUnitCurrentOrder(udg_IPR_Unit[1]) == 852072 then
      • Custom script: set udg_IPR_IsPointReachable = true
      • -------- Improves performance for reachable points --------
      • Custom script: call BlzUnitDisableAbility(udg_IPR_Unit[1], 'Amov', true, false)
      • Custom script: call BlzUnitDisableAbility(udg_IPR_Unit[1], 'Amov', false, false)
      • Custom script: else
      • Custom script: set udg_IPR_IsPointReachable = false
      • Custom script: endif
      • Custom script: call RemoveLocation(udg_IPR_Point[1])
      • Custom script: call RemoveLocation(udg_IPR_Point[2])

How to import?
1. Copy the units Transmitter (1) and Reciever (2) to your map
2. Copy the abilities Call To Arms (Transmitter) and Call To Arms (Reciever) to your map
3. Make sure the units Transmitter (1) and Reciever (2) has their corresponding Call To Arms ablities and that the ability Call To Arms (Transmitter) has the correct Normal Form Unit

4. Copy the Category Is Point Reachable 1.0.2 [Duckfarter] to your map
5. Set IPR_UnitType[1] as Transmitter (1) and IPR_UnitType[2] as Reciever (2) in the trigger Init Is Point Reachable

How to use?
1) Set IPR_Point[1] as the starting point
2) Set IPR_Point[2] as the ending point
3) Run Is Point Reachable System
4) IPR_IsPointReachable is True if reachable
  • Demo 1
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(smart))
    • Actions
      • -------- How to use: --------
      • -------- 1) Set IPR_Point[1] as the starting point --------
      • -------- 2) Set IPR_Point[2] as the ending point --------
      • -------- 3) Run Is Point Reachable System --------
      • -------- 4) IPR_IsPointReachable is True if reachable --------
      • Set VariableSet IPR_Point[1] = (Position of (Triggering unit))
      • Set VariableSet IPR_Point[2] = (Target point of issued order)
      • Trigger - Run Is Point Reachable System <gen> (ignoring conditions)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IPR_IsPointReachable Equal to True
        • Then - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: Point is |cff00ff00...
        • Else - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: Point is |cffff0000...
Previews
Contents

Is Point Reachable GUI 1.0.2 (Map)

Level 20
Joined
Feb 27, 2019
Messages
599
20 years later some fresh faced hobbiest discovers a filthy, unwashed hack to calculate if a unit can path in a single frame. Impressive work master duck farter, may you keep huffing those farts.
Thanks for the heartwarming fart comment.
What is the 32-collision-size-limit based on? Is that hard-coded into the Call to Arms ability?

Would it also be possible to detect the direction the dummy is trying to move to get to the target point?
Ive tried to increase the less than 32 collision size limit but havnt been able to so Id say its hardcoded.

Not possible to detect the direction the dummy is trying to move as far as I know.
 
Top