That would work fine for a one-off sequence, but since I'm having several of these on the map, it would be pretty bad to have to manually put in walk sequences into the .HSS file for each one.
I ended up actually not using pathfinding and instead went with a "breadcrumb" zone method, where the hero looks for an adjacent tile with the breadcrumb, removes the breadcrumb from the current spot, and moves to the adjacent spot.
Here's the working code if anyone's curious.
Code: global variable (400, raccoon detecting)
plotscript, raccoon detect, begin
variable (tile x, tile y, radius)
raccoon detecting := true
radius := 3
for (tile x, hero x(me)--radius, hero x(me)+radius) do (
for (tile y, hero y(me)--radius, hero y(me)+radius) do (
if (read zone (zone:Raccoon path marker, tile x, tile y) &&
npc at spot (tile x, tile y) == false) then (
create npc (npc:Path marker, tile x, tile y)
play sound (3)
wait (5)
)
)
)
raccoon detecting := false
end
plotscript, use raccoon path marker, arg, ref, begin
variable (tile x, tile y)
delete npc (ref)
suspend player
suspend hero walls
raccoon detecting := true
## Put 'breadcrumbs' on the hidden path
for (tile x, hero x(me)--9, hero x(me)+9) do (
for (tile y, hero y(me)--6, hero y(me)+6) do (
if (read zone (zone:Raccoon path, tile x, tile y)) then (
write zone (zone:Raccoon breadcrumbs, tile x, tile y, true)
)
)
)
## Follow & remove the breadcrumbs by looking for adjacent zone
while (true) do (
if (read zone (zone:Raccoon breadcrumbs, hero x(me), hero y(me)--1)) then ( ## Up
passage step (up)
) elseif (read zone (zone:Raccoon breadcrumbs, hero x(me)+1, hero y(me))) then ( ## Right
passage step (right)
) elseif (read zone (zone:Raccoon breadcrumbs, hero x(me), hero y(me)+1)) then ( ## Down
passage step (down)
) elseif (read zone (zone:Raccoon breadcrumbs, hero x(me)--1, hero y(me))) then ( ## Left
passage step (left)
) else ( ## No more breadcrumbs, step away from the path
walk hero (me, hero direction(me), 1)
wait for hero
resume player
resume hero walls
raccoon detecting := false
exit script
)
)
subscript, passage step, dir, begin
write zone (zone:Raccoon breadcrumbs, hero x(me), hero y(me), false)
walk hero (me, dir, 1)
wait for hero
end
end