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.

Need to make an NPC move to a spot

This is a simple question and I've found a few topics that came close to answering this for me, but not quite.

I'm trying to make an NPC who wanders around randomly, run to a spot when the player hits action on another fixed event. It's a table, and when the player hits action on the table the NPC is suppose to run to the other side of the table (just one spot, not dependant on where the player is).

I figure this is easy with a script, but I don't know how to do that. I figured out how to set a move route for the NPC when I hit the table, but there are no options to move toward a spot (like an invisible event on the otherside of the table)... only move toward the player.

Please help! :)
 
You're right, there's no move toward spot in the Move Route commands. If the NPC is going to end up on the spot, though, there's no reason why you can't set it manually (ie, move left; move left; move left; move up; move right; end at the spot).

If you're having a hard time with that because the hero might be standing in his way, you could probably set the NPC's move route to the "through" option for the duration of his little run.

If that's not what you want, it is possible to do with variables and coordinates and stuff.
 
Because your NPC is moving randomly, then to get it from an unknown spot to a specific spot is harder, You'll need to use varaiables and some math. You'll have to store the NPCs X and Y into varaiables, then figure out, based on the X,Y of the target location, how many tiles up or down and left or right it should move. The problem I see is with obsticals. Your gonna have to add some error handlers.

Much eaisier to do the classic fade out/fade in
 
I'm getting "OK" using variables (just started using RMXP about a week ago), although if it requires scripting then I'm pretty much lost.

For the time being, I can have the NPC restricted to a smaller square area with no obsticles... so how would i go about starting to use variables to direct their movement toward a spot along one side of the square area?

It's not integral to the game that I do it this way, I could probably just fix the NPC a be done with it, but I'd just like to learn how to do this is all.

Thanks for the help so far guys.
 

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