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.

Eventing Help: NPC Move Routes

Eventing question: RPGXP.
I have a few NPC events whom you speak to where most of which walk away after you speak with them. But since this NPC has a random move route, I can't tell where it will be when I would like it to move to a certain location. Another problem is that since they can be approached by multiple directions, a set move route can be easily blocked if they speak to them from the direction I planned on moving them to.
I am aware of checking event and player position via variables, but since it's random, I believe I would have to check for every possible location the event would randomly walk to, right? Then accordingly make a custom move route from that location.
Is there an easier way?

Any help/suggestions is appreciated.
 
There are a few options, wich include: Surround the NPC with graphics, or, Using conditional branches to check what direction it is being talked to and then just add the move route per direction.

If you don't know what i mean, i could whip up some pictures for you.
 

Croda

Sponsor

Kaleidx":2k36xuor said:
Eventing question: RPGXP.
I have a few NPC events whom you speak to where most of which walk away after you speak with them. But since this NPC has a random move route, I can't tell where it will be when I would like it to move to a certain location.
Do you want they go to a particular point or just escape the screen by any border of the map ? Cause there is an easy solution.

Another problem is that since they can be approached by multiple directions, a set move route can be easily blocked if they speak to them from the direction I planned on moving them to.

Use a Move through/Ghost mode (or watever it is called) to make them go through your hero and they won't be blocked. It works fine and some professional RPG use this. This is like the NPC walk just near you.

You can also move the first case with a diagonal direction like "Up-left". It never be blocked this way. ;)


Those solutions are the most usefull and quick to make I've found.
 
feralninja":3kqqj9tm said:
There are a few options, wich include: Surround the NPC with graphics, or, Using conditional branches to check what direction it is being talked to and then just add the move route per direction.

I would like to keep the NPC moving randomly so it simply won't work being surrounded by graphics. But since the movement is random and there may be obstacles in the way, would the second option work? Stressing that the NPC movement is random.

Croda":3kqqj9tm said:
Do you want they go to a particular point or just escape the screen by any border of the map ? Cause there is an easy solution.

There are actually a few instances where player meets said NPC and I simply wouldn't be able to tell if the point was on-screen or not. Would I simply need tons of conditional branches?


Croda":3kqqj9tm said:
Use a Move through/Ghost mode (or watever it is called) to make them go through your hero and they won't be blocked. It works fine and some professional RPG use this. This is like the NPC walk just near you.

You can also move the first case with a diagonal direction like "Up-left". It never be blocked this way. ;)

I actually did consider using Through as the best option to my knowledge, but didn't think of the clever "Up-Left" movement! I could definately use that.
Otherwise, can't think of how else to make these NPCs move to a specific location from random points.
 

Croda

Sponsor

Would I simply need tons of conditional branches?
The baddest thing to do. Long and not free of bugs.

Can you draw a sketch of you map with the number of npc and the location points you want they go to ? It will help to see what you really want.
 
Yeah, sure.
Heres a quick mockup:

layout.png

Talking to the NPCs should send them back to the fenced area.
 
How about something like this:

Event Page 1
Code:
Movement Type: Random
Trigger: Action Button

@>Text: You talk to the NPC
@>Control Self Switch: A =ON

Event Page 2
Code:
Condition: Self Switch A is ON
Trigger: Parallel Process

@>Control Variables: [0001] = This event's Map X
@>Control Variables: [0002] = This event's Map Y
@>Conditional Branch: Variable [0002] < 5
   @>Set Move Route: This event
    :                       : $>Move Down
   @>
  : Branch End
@>Conditional Branch: Variable [0002] > 5
   @>Set Move Route: This event
    :                       : $>Move Up
   @>
  : Branch End
@>Conditional Branch: Variable [0001] < 9
   @>Set Move Route: This event
    :                       : $>Move Right
   @>
  : Branch End
@>Conditional Branch: Variable [0001] > 9
   @>Set Move Route: This event
    :                       : $>Move Left
   @>
  : Branch End
@>Conditional Branch: Variable [0001] == 9
  @>Conditional Branch: Variable [0002] == 5
    @>Set Move Route: This event
     :                       : $>Move Up
     :                       : $>Move Up
     :                       : $>Move Up
     :                       : $>Move Up
     :                       : $>Move Up
    @>Wait for Move's Completion
    @>Control Self Switch: B =ON
    @>
    : Branch End
  : Branch End

Event Page 3
Code:
Condition: Self Switch B is ON
Movement Type: Random

On page 2, you may want to make the last Move route (5 Move Ups) different for each event. That way they won't stack up.
 

Croda

Sponsor

Unka Josh : you haven't read what he wants I think. The npc got to go to a specific place.

Brewmeister : it seems it could work but you have to make it be "go through" events or solid tile cause it can be blocked this way.
 
Unka Josh":8htpt9fw said:
If all you want is to have the NPC move away from the player, one of the Set Move Route options is "Move Away From Player."

I actually would like the NPC to move to a specific location. So even if Move Away From Player wasn't random, I'd still need to check for the NPC's random location.

@Brewmeister: Man that confused me. :p I'll try it out and will make it a Through, just in case and see if it doesn't make it too silly looking.

Thanks!
 
If you just make sure that there is a possible path to the destination, i.e. there are no map objects that could trap the NPC, it will work.
For example, if you put one of your trees right next to the fence, an NPC could wander behind the tree & get trapped.

It will try to go toward the tile 5, 9 either using X or Y moves, then once it's there it moves into the pen.
Even if it runs into an event, it will keep going once the other event moves, or try the other direction to get around it.
The one thing it won't do is move AWAY from the destination tile to get around something.

So, as long as a path is available, you should not need to set 'through' on any of the events. And in your screendump I don't see any traps.

Be Well
 
I see what you're trying to do... the character has to herd up all the wandering... things. It's ugly, but if all else fails, you could just destroy the NPC and recreate one in the pen that is stationary (taking care to give each beasty its own unique location to "respawn" in).
 

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