jaynabonne wrote:The library will find the shortest path from source to target. If there are multiple paths from one place to another, it just finds the first, shortest one. (If that's what you're asking.)
The sample app shows a sort of GPS mode, where at each step, it computes the shortest path and tells you what the next direction is. If you deviate from that and move such a new path is shorter, then you'll get the path instead.
Let me know if I answered your question.
<function name="StepNPCTowardRoom" parameters="npc, targetroom">
<![CDATA[
list = PathLib_GetPath(npc.parent, targetroom)
if (list <> null) {
exit = list[0]
npc.parent = exit.to
}
]]>
</function>
<function name="StepNPCTowardRoom" parameters="npc, targetroom">
<![CDATA[
if (npc.parent <> targetroom) {
list = PathLib_GetPath(npc.parent, targetroom)
if (list <> null) {
exit = list[0]
npc.parent = exit.to
}
}
]]>
</function>