Copies someone move route

Could someone help me? (I am new to rgss3)

Well what I need is a script that copies the movement or a certain event.

Example: Given we have two points A and B then Event 1 and 2

Let us say Event 1 found a path starting from A and B. Then I want Event 2 to copy that path.

What I wanna do is that under Event 1 I will create an Event 2 which is like a very fast dot that copies the path of Event 1. More like you are having a line and it shows where you are going.

Thank you very much
What did you use for pathfinding? Most of the pathfinding scripts I see does not store an array containing their move routes, so by that reason, their path cannot be copied. If you do use pathfinding scripts, just call the same pathfinding method for the second event.
What did you use for pathfinding? Most of the pathfinding scripts I see does not store an array containing their move routes, so by that reason, their path cannot be copied. If you do use pathfinding scripts, just call the same pathfinding method for the second event.
I used PathFinding by jet from this link http://forums.rpgmakerweb.com/index.php?/topic/3064-pathfinding/

it is based on A* algorithm(which stores the nodes for the path)
Well, let's try this.

class Game_Character attr_accessor :saved_found_path def save_path(x, y, dist = 0) path = $game_map.find_path(x, y, self.x, self.y, dist).reverse @saved_found_path = path.dup end  

  def execute_saved_path(ev = 0)

    if ev == 0

      src_char = self

    elsif ev < 0

      src_char = $game_player

    else

      src_char = $game_map.events[ev]

    end

    return unless src_char.saved_found_path

    path = src_char.saved_found_path

    if !@move_route.repeat

      @move_route.list.delete_at(@move_route_index)

      @move_route.list.insert(@move_route_index, *path)

      @move_route_index -= 1

    elsif path.length > 0

      process_move_command(path[0])

      @move_route_index -= 1

    end

  end

def find_path_saved(x, y, dist = 0) save_path(x, y, dist) execute_saved_path end end class Game_Interpreter def save_path(x, y, ev = 0, dist = 0) char = get_character(ev) #modified line below (added distance parameter) path = $game_map.find_path(x, y, char.x, char.y, dist) path.reverse! path.push(RPG::MoveCommand.new(0)) char.saved_found_path = path.dup end def execute_saved_path(ev = 0, src_ev = ev, wait = false) char = get_character(ev) src_char = get_character(src_ev) return unless src_char.saved_found_path path = src_char.saved_found_path route = RPG::MoveRoute.new route.list = path route.wait = wait route.skippable = true route.repeat = false char.force_move_route(route) end def find_path_saved(x, y, ev = 0, wait = false, dist = 0) save_path(x, y, ev, dist) execute_saved_path(ev, ev, wait) end end 

To find move path while saving them, use 

find_path_saved in either event page or set move route. The arguments mirror find_path.

To execute saved move path, use

execute_saved_path(event, source_event)in event page, or

execute_saved_path(event)in move route page.

Edit: Fixed some errors.
Thank you gonna try it later when I got home 😮
Wait. It seems that the script formatting in my last post just... exploded.

Here should be the snippet with the proper formatting:

Spoiler
class Game_Character attr_accessor :saved_found_path def save_path(x, y, dist = 0) path = $game_map.find_path(x, y, self.x, self.y, dist).reverse @saved_found_path = path.dup end def execute_saved_path(ev = 0) if ev == 0 src_char = self elsif ev < 0 src_char = $game_player else src_char = $game_map.events[ev] end return unless src_char.saved_found_path path = src_char.saved_found_path if !@move_route.repeat @move_route.list.delete_at(@move_route_index) @move_route.list.insert(@move_route_index, *path) @move_route_index -= 1 elsif path.length > 0 process_move_command(path[0]) @move_route_index -= 1 end end def find_path_saved(x, y, dist = 0) save_path(x, y, dist) execute_saved_path end endclass Game_Interpreter def save_path(x, y, ev = 0, dist = 0) char = get_character(ev) #modified line below (added distance parameter) path = $game_map.find_path(x, y, char.x, char.y, dist) path.reverse! path.push(RPG::MoveCommand.new(0)) char.saved_found_path = path.dup end def execute_saved_path(ev = 0, src_ev = ev, wait = false) char = get_character(ev) src_char = get_character(src_ev) return unless src_char.saved_found_path path = src_char.saved_found_path route = RPG::MoveRoute.new route.list = path route.wait = wait route.skippable = true route.repeat = false char.force_move_route(route) end def find_path_saved(x, y, ev = 0, wait = false, dist = 0) save_path(x, y, ev, dist) execute_saved_path(ev, ev, wait) end end
Hopefully this one won't explode....

Original thread: https://forums.rpgmakerweb.com/threads/copies-someone-move-route.24537/