tuxemon.event.actions.pathfind module

final class tuxemon.event.actions.pathfind.PathfindAction(npc_slug, tile_pos_x, tile_pos_y)[source]

Bases: EventAction

Pathfind the player / npc to the given location.

This action blocks until the destination is reached.

Script usage

pathfind <npc_slug>
Script parameters:

npc_slug – Either “player” or npc slug name (e.g. “npc_maple”).

  • npc_slug (str) –

  • tile_pos_x (int) –

  • tile_pos_y (int) –

name: ClassVar[str] = 'pathfind'
npc_slug: str

Called only once, when the action is started.

For all actions, you will need to override this method.

For actions that only need to run one frame you can simply put all the code here. If the action will need to run over several frames, you can init your action here, then override the update method.

Return type:


tile_pos_x: int
tile_pos_y: int

Called once per frame while action is running.

It is also called on the first frame when EventAction is started.

If you do not override this, then the action will stop after it is started, and live for only one frame.

If you do override this, then this method will be run every frame until EventAction.stop() is called. If you do not ever call stop(), then this action will block all others in the list and will continue to run until the parent EventEngine is stopped.

Return type: