Here's a port of the pathfinding sub used in my rail engine. It's always been pretty basic, but very functional for getting out of blocked conditions in Fel.
dofile("tm_subs_collection5.lua")
function TM_Pathfind(xdest, ydest, zdest)
local max_retry = 3
local retry = 0
if UO.CursKind == 0 then
max_retry = 8
end
local complete = false
while not complete do
UO.Pathfind(xdest,ydest,zdest)
local timer = TM_SecondTimer:New{duration = 8}
local move_again = false
while not move_again and not complete do
repeat
local tempx = math.abs(xdest - UO.CharPosX)
local tempy = math.abs(ydest - UO.CharPosY)
local tempz = math.abs(zdest - UO.CharPosZ)
if (tempx > 1 or tempy > 1 or tempz > 1) and (timer:Check() == false) then
break
end
if (tempx == 1 or tempy == 1) and UO.CursKind == 0 and UO.Stamina ~= UO.MaxStam then
UO.Move(xdest, ydest, 2, 1000)
break
end
if timer:Check() == true then
retry = retry + 1
if retry <= max_retry then
move_again = true
break
end
return true
else
complete = true
break
end
until false
end
end
return false
end
---------------------------------------------------------------
---------------------------------------------------------------
---------------------------------------------------------------
TM_Pathfind(1006,430,-63)
TM_Pathfind(1006,436,-63)
TM_Pathfind(1013,436,-63)
TM_Pathfind(1013,430,-63)
pause()
Note: requires tm_subs_collection5.lua and you need to save this file to a lua file before you run it. I've also attached the file.