Difference between revisions of "FindPathExplanation"

From The Battle for Wesnoth Wiki
(Illustration of [find_path]'s results, with image hotlinked from Github)
 
Line 1: Line 1:
 
An illustrated example of the '''[[InternalActionsWML#.5Bfind_path.5D|[find_path]]]''' WML tag's results.
 
An illustrated example of the '''[[InternalActionsWML#.5Bfind_path.5D|[find_path]]]''' WML tag's results.
  
https://user-images.githubusercontent.com/101462/61628440-92323280-ac82-11e9-87b3-a6fc4e5442cc.png
+
[[File:Find-path-demo.png]]
  
 
Imagine an Elvish Scout standing on the Player 1 start, this unit has 9MP and needs 3MP for each shallow water tile, so it can reach every village without needing a multi-turn move.
 
Imagine an Elvish Scout standing on the Player 1 start, this unit has 9MP and needs 3MP for each shallow water tile, so it can reach every village without needing a multi-turn move.

Revision as of 11:49, 22 July 2019

An illustrated example of the [find_path] WML tag's results.

Find-path-demo.png

Imagine an Elvish Scout standing on the Player 1 start, this unit has 9MP and needs 3MP for each shallow water tile, so it can reach every village without needing a multi-turn move.

If [find_path] is used with a terrain filter that matches villages, each of these villages might be considered to be the "nearest":

  • "lake" is 3 hexes, 7 MP and 4 steps away
  • "spur" is 5 hexes, 5 MP and 6 steps away
  • "u_turn" is 2 hexes, 8 MP and 9 steps away

The hexes is best explained by the U-turn village - although it needs a lot of movement points, the village is only 2 hexes away from Player 1's start.

The steps is the length of the path.step array, which always includes the starting hex.