| 05-02-2008, 02:03 PM | #1 |
Is there a way to execute triggers or functions written in jass before the map is actually saved? My problem is: I use an edited miscdata.txt for making high cliffs. The problem is just that these "cliffs" dont have any collision/pathing so i wrote a function that disables the walkability pathing on each location that is too steep. The function: JASS:function CreatePathingLines takes nothing returns nothing local real r1 local real r2 call MoveLocation(Loc, PathX - 32, PathY) set r1 = GetLocationZ(Loc) call MoveLocation(Loc, PathX + 32, PathY) set r1 = GetLocationZ(Loc)-r1 call MoveLocation(Loc, PathX, PathY - 32) set r2 = GetLocationZ(Loc) call MoveLocation(Loc, PathX, PathY + 32) set r2 = GetLocationZ(Loc)-r2 if r1 < 0 then // = TerrainZ difference of two locations to the left and right of the current location (this is basically the same as RAbs(r1)) set r1 = -r1 endif if r2 < 0 then // = TerrainZ difference of two locations above and below the current location set r2 = -r2 endif if r1 > 32 or r2 > 32 then call SetTerrainPathable(PathX, PathY, PATHING_TYPE_WALKABILITY, false) endif if PathX == PathXMax then if PathY == PathYMax then call PauseTimer(GetExpiredTimer()) call DestroyTimer(GetExpiredTimer()) call BJDebugMsg("Rect " + I2S(udg_PathCount) + " done.") set udg_PathCount = udg_PathCount+1 call TriggerExecute(gg_trg_InitPathing) endif set PathY = PathY-32 set PathX = PathXMin call PingMinimap(PathX, PathY, 0.1) // just for visualization else set PathX = PathX+32 endif endfunction function CreatePathing takes rect whichRect returns nothing local timer t = CreateTimer() set PathX = GetRectMinX(whichRect) set PathY = GetRectMaxY(whichRect) set PathXMin = GetRectMinX(whichRect) set PathXMax = GetRectMaxX(whichRect) set PathYMax = GetRectMinY(whichRect) call BJDebugMsg("Creating Pathing...") call TimerStart(t, 0, true, function CreatePathingLines) endfunction This function works flawlessly but as you can imagine it takes some time (my map is about 32k x 32k). Currently it takes about one minute for the whole map to be "pathed" and it decreases the FPS considerably. Furthermore changing the pathing ingame kinda screws up the units' path finding. So on solution would be be to just run that script in the editor BEFORE saving the map. Is there any way to do so? I really don't wanna go back to placing pathing blockers manually on each cliff. This just takes ages :\ |
| 05-03-2008, 02:05 AM | #2 | |
Quote:
Or you could just use a jasshelper external... |
| 05-03-2008, 04:27 PM | #3 |
That might actually work... if I just just knew how to do any of those things :D However while trying to find out more about that external stuff I found that PathMapper external usable with jasshelper. This will work out too as all of my cliffs are using the same tile anyway. So thanks for your help :) |
