| 04-10-2009, 02:17 PM | #1 |
How would I detect if a given point is boundary? |
| 04-10-2009, 02:22 PM | #2 |
JASS:function IsTerrainBoundary takes real x, real y returns boolean return IsTerrainPathable( x, y, PATHING_TYPE_ANY ) endfunction |
| 04-10-2009, 04:10 PM | #3 |
JASS:scope Block initializer Init private function Conditions takes nothing returns boolean return IsUnitInGroup(GetTriggerUnit(),Submerge) endfunction private function Actions takes nothing returns nothing local unit u = GetTriggerUnit() local unit t local real x local real y call BJDebugMsg("started") if GetOrderTargetUnit() == null then set x = GetOrderPointX() set y = GetOrderPointY() if IsTerrainPathable(x,y,PATHING_TYPE_ANY) == false then call IssueImmediateOrder(u,"stop") endif else set t = GetEventTargetUnit() set x = GetUnitX(t) set y = GetUnitY(t) if IsTerrainPathable(x,y,PATHING_TYPE_ANY) == false then call IssueImmediateOrder(u,"stop") endif endif endfunction //=========================================================================== private function Init takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER ) call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER ) call TriggerAddAction( t, function Actions ) endfunction endscope Failed. |
| 04-10-2009, 04:52 PM | #4 |
not == false IsTerrainPathable returns opposite ... look at my first post :) |
| 04-11-2009, 01:35 AM | #5 |
JASS:scope Block initializer Init private function Conditions takes nothing returns boolean return IsUnitInGroup(GetTriggerUnit(),Submerge) endfunction function IsTerrainBoundary takes real x, real y returns boolean return IsTerrainPathable( x, y, PATHING_TYPE_ANY ) endfunction private function Actions takes nothing returns nothing local unit u = GetTriggerUnit() local unit t local real x local real y if GetOrderTargetUnit() == null then set x = GetOrderPointX() set y = GetOrderPointY() if IsTerrainBoundary(x,y) == true then call PauseUnit(u,true) call IssueImmediateOrder(u,"stop") call PauseUnit(u,false) call BJDebugMsg("started") endif else set t = GetEventTargetUnit() set x = GetUnitX(t) set y = GetUnitY(t) if IsTerrainBoundary(x,y) == true then call PauseUnit(u,true) call IssueImmediateOrder(u,"stop") call BJDebugMsg("started") call PauseUnit(u,false) endif endif endfunction //=========================================================================== private function Init takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER ) call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER ) call TriggerAddAction( t, function Actions ) endfunction endscope |
| 04-11-2009, 03:42 AM | #6 |
So does it work? |
| 04-11-2009, 04:15 AM | #7 |
no |
