- Joined
- Jul 10, 2007
- Messages
- 6,306
public method update takes nothing returns nothing
local unit u = GetUnitById(this)
local real e
set prevXc[this] = GetUnitX(u)
set prevYc[this] = GetUnitY(u)
call MoveLocation(loc, prevXc[this], prevYc[this])
set e = GetLocationZ(loc)
set cliffElevationc[this] = prevZc[this]-e
set prevZc[this] = e
endmethod
I implemented a similar system in Shadows of Everwood and ran into your problem.
The system that I wrote used point-order, though.
My fix was to create an offset from the targeted position by around 32-33 so that I could compare the z-slope between the unit and targeted position with the z-slope between the targeted position and the offset. Based on the result I could determine if the unit was approaching a cliff, trying to walk up on a cliff or approaching a hole etc.
It's not perfect but kinda works![]()
That would fail with destructables/doodads present, would it not?
Also, what kind of overhead is incurred by checking points around a unit.
@D4RK_G4ND4LF
Your solution was close, but you forgot about the +-64. If you had thought of that, I woulda done it ; P.