Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Npc to walk to event when within radius

How do I get an npc to walk to where another event is from anywhere on the map

I want an npc to run too a door and then disappear as if the npc went through the door..
 
You can navigate a character point-by-point using a web of waypoints. Basically when a character reaches a certain coordinate it's told to turn a specific direction and walk forward towards the next point.
waypoints_zpsa47da05e.png~original

You'll be mapping out an Escape route using a common event. Like this:
Route_zps7784d3c0.png~original

You make a conditonal branch with a script call:
[$game_map.events[@event_id].x,$game_map.events[@event_id].y] == [X, Y]
The red X & Y will be the waypoint coordinate. In the map editor(in event mode) placing the cursor on a tile will display the x and y coordinate in the corner of the screen; thats what you'll be using.
Then you just add a set move route for this event: Turn whatever direction you want and step forward. It's important that you have "repeat action" and "skip if cannot move" selected so the character doesn't just stop.
It looks like a lot of work but it's really easy to layout.
The Beauty of this is because the route is a common event any event can follow it independently and simultaneously anywhere on the map. There's no one starting point, only an end destination. The character's event page will need to be parallel process, with a random movement. If you placed your waypoints strategically it'll only take a few step before the character steps on a waypoint and sets off. The movement can be interrupted by switching to another event page, so add whatever extra conditions you need to the the escape route
character_zps7d7767e0.png~original


I'm sure this could be developed further to use a variable destination. So events could navigate to any point in a maze like map.
Actually waylines would be more effective instead of waypoints.
 
The Beauty of this is because the route is a common event any event can follow it independently and simultaneously anywhere on the map. There's no one starting point, only an end destination.
Coyote you just taught me something I never realised about RPG Maker. That's fantastic, and dead useful, thanks.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top