Support Forum

Number of searched nodes in an If statement

How would I get the number of searched nodes to use in an if statement so when it turns to 0 I can end the turn in a turn based game. The reasoning is that the turn is ended when the follower object gets to the position of the pointer but it gets blocked by an unwalkable surface if the pointer is on that surface. But If I misunderstood the message and if there’s a better way they are welcome.

Hi

I do not really understand what you are asking. Do you think you could elaborate a bit?

I am looking to get the number of searched nodes into a seperate variable for an if statement.

Hi

The number of searched nodes is stored in the Path.searchedNodes field: https://arongranberg.com/astar/docs/path.html#searchedNodes, however it is an internal method. I really don’t think that field will do what you think it does though. The number of searched nodes is an implementation detail of the A* algorithm, not usually something you rely on for game logic.