Save-Point
GET STEPS FOR PATHFINDING - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: GET STEPS FOR PATHFINDING (/thread-6144.html)



GET STEPS FOR PATHFINDING - DerVVulfman - 08-24-2016

GET STEPS FOR PATHFINDING
Version: 1.0


Introduction
If anyone used Near Fantastica's Pathfinding system, they may have noticed that the 'Wait Till Move Completion' event had no effect. You could try to figure out some arbitrary wait time from when a character was to move from point A to point B, but you were usually just guessing.... until now.

This little add-on for Near Fantastica's original pathfinding script will obtain how many steps that was calculated by the system. Using that, you can make some sort of wait count system based on the actual steps taken!

Again, this is for Near Fantastica's version 1 pathfinding script found HERE


Script
The Script

Instructions
Insert this script below Near Fantastica's original.

In an event code, you can create something like this:
Code:
@>Script:  $game_player.find_path(4,3)
@>Wait: 1 frame(s)
@>Script:  $game_variables[9] =
:      :  $game_player.get_path_steps
@loop
  @>Conditional Branch: Variable [0009] <= 0
    @>Break Loop
    @>
  : Branch End
  @>Wait 3 frame(s)
  @>Control Variables: [0009] -= 1
  @>
: Repeat Above

Might be a little odd, but I made a loop that counted down from the recently acquired steps. Each time it looped, it waited 3 frames until the counter ran out. During that time, my character ran from wherever he was until map coordinate (4/3).

A simpler way would be if you made a WAIT method that could just input the delay as WAIT(variable in frames) Tongue sticking out


Compatibility
For RMXP and version 1 of Near's Pathfinding.


Credits and Thanks
Near Fantastica of course.