Hello,
I am trying to get npcs to walk from one point to another but remember their map location if the player leaves and comes back.
Ex. Player comes into map. Npc leaves their home and heads towards the store. Npc takes 5 steps while Player is on this map. Player leaves the map and comes back Npc is 5 steps away from their house and still walking the correct path to the store.
I have 3 scripts I downloaded from this website.
Pathfinding script by:Theo
Remember Event Position by:Shaz.
and this one roninator2 made me in a forum
# roninator2
# events can move on top of other events that are below character.
class Game_CharacterBase
def collide_with_events?(x, y)
$game_map.events_xy_nt(x, y).any? do |event|
event.normal_priority? || (self.is_a?(Game_Event) && event.normal_priority?)
end
end
end
Both of these scripts work as intended but when put together it doesn't. The pathfinding wants to walk the character from point a to point b before saving the new position. Which isn't what I want.
I am very new to scripting and I haven't touched rpg maker since high school so I'm quite rusty with the program. Any help is appreciated.
*SOLVED!
I found a work around to have a character move like how I wanted.
You make a new event (maybe out of bounds) as a parallel process. and input these into it.
Add script line -> $game_map.events[enter the id of your event].save_pos()
then you add -> wait 60 frames
Done! It's that simple of a fix. I just wasn't using my brain fully.
I am trying to get npcs to walk from one point to another but remember their map location if the player leaves and comes back.
Ex. Player comes into map. Npc leaves their home and heads towards the store. Npc takes 5 steps while Player is on this map. Player leaves the map and comes back Npc is 5 steps away from their house and still walking the correct path to the store.
I have 3 scripts I downloaded from this website.
Pathfinding script by:Theo
Remember Event Position by:Shaz.
and this one roninator2 made me in a forum
# roninator2
# events can move on top of other events that are below character.
class Game_CharacterBase
def collide_with_events?(x, y)
$game_map.events_xy_nt(x, y).any? do |event|
event.normal_priority? || (self.is_a?(Game_Event) && event.normal_priority?)
end
end
end
Both of these scripts work as intended but when put together it doesn't. The pathfinding wants to walk the character from point a to point b before saving the new position. Which isn't what I want.
I am very new to scripting and I haven't touched rpg maker since high school so I'm quite rusty with the program. Any help is appreciated.
*SOLVED!
I found a work around to have a character move like how I wanted.
You make a new event (maybe out of bounds) as a parallel process. and input these into it.
Add script line -> $game_map.events[enter the id of your event].save_pos()
then you add -> wait 60 frames
Done! It's that simple of a fix. I just wasn't using my brain fully.