| 03-14-2008, 09:06 AM | #1 |
Hi, i'm starting to make a map and i was wondering is there a way for my units to stop when they go on ashenvale stones like if it was cliffs. i tried a little already but i don't find any way to make it works ... Thanks. |
| 03-14-2008, 10:22 AM | #2 |
Either place pathing blockers, or do something like this: JASS:scope Stop globals group Group location Loc rect Rectangle=bj_mapInitialPlayableArea endglobals function C takes nothing returns boolean return GetUnitState(GetEnumUnit(), UNIT_STATE_LIFE)<=0 and GetTerrainType(GetLocationX(Loc),GetLocationY(Loc))=='Arck' endfunction function S takes nothing returns nothing set Loc=GetUnitLoc(GetEnumUnit()) if (C()) then call IssueImmediateOrder(GetEnumUnit(),"stop") else endif call RemoveLocation(Loc) call DestroyGroup(Group) endfunction function UG takes nothing returns nothing call GetUnitsInRectMatching(Rectangle,null) call ForGroup(Group,function S) endfunction function InitTrig takes nothing returns nothing local trigger t=CreateTrigger() call TriggerRegisterTimerEventPeriodic(t,0.05) call TriggerAddAction(t,function UG) endfunction endscope |
| 03-14-2008, 12:56 PM | #3 |
I'd recommend pathing blockers. It's much cleaner when units attempt to walk around the terrain impediment than stop because they ran into it. |
| 03-14-2008, 10:25 PM | #4 |
You could also use the pathmapper external tool to make all tiles of a certain type unpathable. The easiest way to get this tool is with the Jass NewGen pack. To set a tile to unpathable with this tool, just put this line in your map header in the trigger editor: //! external PathMapper Vrck 2 | (this example makes village rocks unpathable, you should replace Vrck with your tile type) Note that, at least in my experience, tiles set to unpathable this way can not be made pathable again ingame by using destructibles like bridges or invisible platforms. |
