The quest for npc behavior

Danatoth

Regular
Regular
Joined
May 19, 2023
Messages
130
Reaction score
71
First Language
English
Primarily Uses
RMMV
I've been working on the basics for an open world rpg, and have gotten a time system implemented. The time will change variables based on hour, minute, and second in game so I have those to use. The quest now is to use these to make faux behavior for npcs.

Since npcs aren't actually objects in rpg maker, it brings up a lot of challenges. The only way I could think of doing it is having a condition on the event that once a time variable hour = X then it runs the event. The event conditional branch checks to see if variable second < 2 seconds or so, so that it only runs at exactly that time, then makes a movement event to where it's supposed to be. Time that exactly, then flick a switch at the end of the event which turns on a new event where the npc went. Making it appear as though the npc moved to a new location.

I think this should work in theory, but is extremely time consuming and is going to add a ton of work to the game considering how many npcs there are. Can anyone else think of any other solutions?
 

gstv87

Regular
Regular
Joined
Oct 20, 2015
Messages
3,275
Reaction score
2,447
First Language
Spanish
Primarily Uses
RMVXA
two games to study: Half-Life 2, and TES: Oblivion.
look up information on their NPC systems, and you'll find the answer.
I'm not gonna detail all of it here.... read their documentation or watch a gameplay and you'll see the techniques.
 
Last edited:

coyotecraft

Mythographer
Regular
Joined
Mar 13, 2012
Messages
502
Reaction score
275
First Language
English
Primarily Uses
N/A
I've certainly thought about making an entire clockwork town where NPCs follow schedules. Opening and closing shops, visit pubs, go home, repeat.

Long ago I made a way-point system. Or maybe I called it a Fire-Drill. Basically I had a 1 common event that could direct all NPCs to the exit no matter where they were.

I think I would do something similar and keep the NPC's behavioral controls as a common event. So it's all in one place. I would still have to copy and paste an NPC event around to different maps, but their only event command would be to call common event "NPC - Name" for instructions.
 

Danatoth

Regular
Regular
Joined
May 19, 2023
Messages
130
Reaction score
71
First Language
English
Primarily Uses
RMMV
two games to study: Half-Life 2, and TES:oblivion.
look up information on their NPC systems, and you'll find the answer.
I'm not gonna detail all of it here.... read their documentation or watch a gameplay and you'll see the techniques.
Events aren't objects in rpg maker, so you cannot program them like you would in other games.
Long ago I made a way-point system. Or maybe I called it a Fire-Drill. Basically I had a 1 common event that could direct all NPCs to the exit no matter where they were.

I think I would do something similar and keep the NPC's behavioral controls as a common event. So it's all in one place. I would still have to copy and paste an NPC event around to different maps, but their only event command would be to call common event "NPC - Name" for instructions.
Ah, this is pretty interesting using common events to direct npcs. I'd be interesting in looking at that code, but to have them do tasks etc, while being able to be interacted with would still take multiple events. And having npcs move on maps that you aren't on. It's scrambling my brain trying to figure out how to get it to work. It might actually be impossible in rpg maker.
 

gstv87

Regular
Regular
Joined
Oct 20, 2015
Messages
3,275
Reaction score
2,447
First Language
Spanish
Primarily Uses
RMVXA
Events aren't objects in rpg maker, so you cannot program them like you would in other games.
<.<
>.>
uhmm.... what?

so, my time system and my NPC control system, that I made, based on those games I mentioned, that is contained within the files I uploaded to the internet 5 years ago, do not exist? and I've been delusional all this time?

this is THE image I took, from that system, to explain that system to another user here, 4 years ago.
I'm grabbing events from the map, that don't exist in the editor!
nuevo-1.jpg
 
Last edited:

Danatoth

Regular
Regular
Joined
May 19, 2023
Messages
130
Reaction score
71
First Language
English
Primarily Uses
RMMV
<.<
>.>
uhmm.... what?

so, my time system and my NPC control system, that I made, based on those games I mentioned, that is contained within the files I uploaded to the internet 5 years ago, do not exist? and I've been delusional all this time?
Npcs cannot move from 1 map to another in rpg maker, you can only make them look like they did. So you can't have an npc walk to a door, leave the map and the event actually move to another map. The whole point of this thread is to try to figure out ways to make it seem like this 1 event is moving around between areas and doing things. You can have an npc move to a door at X time, but that event can't actually move to the next map, you can only make it look like the event did, and that's what I'm trying to figure out.

(btw I'm very familiar with elder scrolls modding as I've modded both skyrim and oblivion, and understand how to use npc ai packages to make daily routines in the creation kit - but it doesn't work and cannot work the same in rpg maker)
 

gstv87

Regular
Regular
Joined
Oct 20, 2015
Messages
3,275
Reaction score
2,447
First Language
Spanish
Primarily Uses
RMVXA
seem like this 1 event is moving around
yes.
exactly.
that's the solution.

if you know they can't go from one map to another, and you know they must be made to look like they do... what's the question here?
every map is the same structure!: if NPCs can't move from [map] to [map], and in every [map] they move around, then have them move around.... period.
them "being here" or "there", is the perception of the player.
 

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,153
Reaction score
16,960
First Language
English
Primarily Uses
RMMV
The player will only see them moving if they happen to be at the same place on the map as your NPC at the time you want them to move.

I don't use a time system, but I do have NPCs that appear at different places at different points in the game. I just use switches or variables to determine whether the NPC should be on a particular map at this point. If they shouldn't be, they aren't. I don't make it so they're there and the player sees them move off the map.
 

Danatoth

Regular
Regular
Joined
May 19, 2023
Messages
130
Reaction score
71
First Language
English
Primarily Uses
RMMV
The player will only see them moving if they happen to be at the same place on the map as your NPC at the time you want them to move.
Yup, and for 99.9% of the game it will look normal. But the first time you start seeing npcs popping in and out of existence, it's ruined. I'm thinking this might be too time consuming to do, and I might just have to do what morrowind does...nothing, except lock merchant doors at night lol.
 

AquaEcho

Script Kitty
Regular
Joined
Sep 20, 2021
Messages
1,693
Reaction score
1,166
First Language
English
Primarily Uses
RMMV
Doesn't every Harvest Moon/Story of Seasons game do this? The characters never pop out of nowhere, it's always from a map edge or doorway.

I would think you would just have event pages with switches activated by the hour of the day that made them take a move route to a door or map edge, then selfswitched to a blank sprite page to hide the sprite or unspawn it if you're using an event spawner once they reached their destination. That way, even if they're "late" to their destination (because you got in their way, for example) they won't disappear until theyre actually at it.
 
Last edited:

AquaEcho

Script Kitty
Regular
Joined
Sep 20, 2021
Messages
1,693
Reaction score
1,166
First Language
English
Primarily Uses
RMMV
@AquaEcho literally Oblivion.
Maybe? I never really looked at it. Harvest Moon's NPC schedules system might be better to study since it's close to RPG Maker's map and event structure and has been around since the 90s.
 

Danatoth

Regular
Regular
Joined
May 19, 2023
Messages
130
Reaction score
71
First Language
English
Primarily Uses
RMMV
I would think you would just have event pages with switches activated by the hour of the day that made them take a move route to a door or map edge, then selfswitched to a blank sprite page to hide the sprite or unspawn it if you're using an event spawner once they reached their destination. That way, even if they're "late" to their destination (because you got in their way, for example) they won't disappear until theyre actually at it.
Yes, that's what my original post was suggesting. I think that the only unnatural thing about this is that you wouldn't be able to talk to any npc that was going "in-between" areas. I think to do this accurately, I'd need to use @coyotecraft's idea for using a master common event that triggers all npc actions. I'm guessing just a giant list of conditional branches for exact times that will trigger switches for the npcs, and have it run every few seconds. The problem with this is that even with something as low as 100 npcs, that would end up being hundreds upon hundreds of conditional branches...

@AquaEcho literally Oblivion.
No, oblivion uses AI packages to do this. Ai packages are bound to the npcs themselves which are actual objects in oblivion and can move between cells, unlike in morrowind where npcs could not move between cells. The way the creation kit creates npc routines in skyrim and oblivion is completely different. There is no "making the npc disappear and starting a new event in the new location" as the npcs in these games are actual game objects, so they can move between cells.

In oblivion you literally have markers you put down where you tell the npc where to go at X time and do X ai package and it follows the nav mesh there by itself through cells. There is no "faking it" like you have to do with rpg maker where you load different events for this effect.
 

AquaEcho

Script Kitty
Regular
Joined
Sep 20, 2021
Messages
1,693
Reaction score
1,166
First Language
English
Primarily Uses
RMMV
think that the only unnatural thing about this is that you wouldn't be able to talk to any npc that was going "in-between" areas.
You can't talk to them when they disappear at a door or map edge (you would have to meet them on the next map) but you should be able to talk to them while they're walking to their destination.
 

Danatoth

Regular
Regular
Joined
May 19, 2023
Messages
130
Reaction score
71
First Language
English
Primarily Uses
RMMV
You can't talk to them when they disappear at a door or map edge (you would have to meet them on the next map) but you should be able to talk to them while they're walking to their destination.
Maybe I'm missing something. You could talk to them if you had the movement route the autonomous movement, but if you used that how would you flip a switch at the end when they reached their destination? And if you used a normal movement route, well you wouldn't be able to talk to them either.
 

gstv87

Regular
Regular
Joined
Oct 20, 2015
Messages
3,275
Reaction score
2,447
First Language
Spanish
Primarily Uses
RMVXA
There is no "faking it"
and yet, if you follow the NPC to another location, they'll start from the closest transition point if "coming" from there (AKA, the closest door), OR, from the middle of the room if "already there".

WHICH MEANS! you can fake the same behavior in RM by writing down each NPC routine to the smallest time increment (in your case, minutes, because seconds would be overkill) and putting them where they should be at that minute.
if you're following an NPC into a tavern from the outside, the moment you go in, the NPC would be AT the door, making their way to sit down at a table.
at which table they will remain until the next increment where they'd be set to "being AT the tavern" (proper), so if and when you enter the tavern during that time frame, they would appear already at the table, not at the door and moving to it.
being "at" the tavern is both "entering tavern", and "sitting at the table".
if there's a split needed between the action, split it.
you have the time fractioned down already, so USE it.... if you won't do that, make the fractions into hours.
if hours are also irrelevant, fraction by sun stage just like in antiquity before clocks were invented: dawn, morning, noon, afternoon, sundown, evening, midnight.
*that* is exactly what I do, on top of a hidden hour:minute system, that would look out of place in a setting with no clocks!
 

Danatoth

Regular
Regular
Joined
May 19, 2023
Messages
130
Reaction score
71
First Language
English
Primarily Uses
RMMV
and yet, if you follow the NPC to another location, they'll start from the closest transition point if "coming" from there (AKA, the closest door), OR, from the middle of the room if "already there".

WHICH MEANS! you can fake the same behavior in RM by writing down each NPC routine to the smallest time increment (in your case, minutes, because seconds would be overkill) and putting them where they should be at that minute.
if you're following an NPC into a tavern from the outside, the moment you go in, the NPC would be AT the door, making their way to sit down at a table.
at which table they will remain until the next increment where they'd be set to "being AT the tavern" (proper), so if and when you enter the tavern during that time frame, they would appear already at the table, not at the door and moving to it.
being "at" the tavern is both "entering tavern", and "sitting at the table".
if there's a split needed between the action, split it.
you have the time fractioned down already, so USE it.... if you won't do that, make the fractions into hours.
if hours are also irrelevant, fraction by sun stage just like in antiquity before clocks were invented: dawn, morning, noon, afternoon, sundown, evening, midnight.
*that* is exactly what I do, on top of a hidden hour:minute system, that would look out of place in a setting with no clocks!
Yeah, that's what I said in the original post lol. I laid that out, and then was seeing if there was a better method that I might have missed.


The hard part is going to be organizing how exactly to call all those events. Since you can't have an exact variable as a condition in rpg maker mv, I can't just have the npc perform X when the time variabl = whatever since the only option is ≥. So the only way I can think of doing this is having it so instead it will be a switch to do those things. Then have a parallel common event running at all times that has conditional branches that turn on a switch representing X hour. This is the least convoluted way I can think of it personally.
 

RCXGaming

Champion of Brightmoon Tor
Regular
Joined
Jan 4, 2019
Messages
1,014
Reaction score
2,663
First Language
English
Primarily Uses
RMMV
Yeah, that's what I said in the original post lol. I laid that out, and then was seeing if there was a better method that I might have missed.


The hard part is going to be organizing how exactly to call all those events. Since you can't have an exact variable as a condition in rpg maker mv, I can't just have the npc perform X when the time variabl = whatever since the only option is ≥. So the only way I can think of doing this is having it so instead it will be a switch to do those things. Then have a parallel common event running at all times that has conditional branches that turn on a switch representing X hour. This is the least convoluted way I can think of it personally.

Yes you can. Victor's Event Conditions (regardless if we're talking MV or Ace) allows you to set specific conditions beyond just the database applied ones using javascript comments. EX. A variable needs to be exactly 1, not 1 or above. (Though you'd need the bugfix in my thread to make it work properly)

Visual example:
bandicam 2023-06-06 01-41-10-732.png

But if you want to do it without plugins then I dunno how to help beyond what's already been stated.
 
Last edited:

Danatoth

Regular
Regular
Joined
May 19, 2023
Messages
130
Reaction score
71
First Language
English
Primarily Uses
RMMV
Yes you can. Victor's Event Conditions (regardless if we're talking MV or Ace) allows you to set specific conditions beyond just the database applied ones using javascript comments. EX. A variable needs to be exactly 1, not 1 or above. (Though you'd need the bugfix in my thread to make it work properly)

Visual example:
View attachment 264374

But if you want to do it without plugins then I dunno how to help beyond what's already been stated.
Awesome, this is perfect - thanks~
 

AquaEcho

Script Kitty
Regular
Joined
Sep 20, 2021
Messages
1,693
Reaction score
1,166
First Language
English
Primarily Uses
RMMV
Yes you can. Victor's Event Conditions (regardless if we're talking MV or Ace) allows you to set specific conditions beyond just the database applied ones using javascript comments. EX. A variable needs to be exactly 1, not 1 or above. (Though you'd need the bugfix in my thread to make it work properly)
You can also do this with Yanfly Advance Switches and Variables, which lets you make a switch a JavaScript evaluation of anything you want.
Maybe I'm missing something. You could talk to them if you had the movement route the autonomous movement, but if you used that how would you flip a switch at the end when they reached their destination?
You can set a self switch in a move route using
$gameSelfSwitches.setValue([$gameMap.mapId(), this._eventId, 'A'], true)

You can also remotely set a self switch from another event with
$gameSelfSwitches.setValue([mapNumber, eventNumber, 'A'], true);
 

Latest Threads

Latest Posts

Latest Profile Posts

I was thinking about how funny it'd be if there was an 80's action movie parody based off of RPG Maker starring a protagonist called Sergeant John RPGMaker.
Come and join me shortly for Throwback Thursday, where I'll be continuing with Grim Fandango! https://twitch.tv/trihanstreams
Hi guys do yall like the new way im going to do battle sprites? It dosnt actoully matter what you think im doing it this way anyway but uhm hey1!!!!!!!!!!!!!!!1!!!!11111!!!
Painfull Spirite.png
Papercut bat i think.png
Short cutscene test. Didn't add the dialogues yet because I wanted to make sure this animation idea worked.

Forum statistics

Threads
134,880
Messages
1,251,541
Members
177,682
Latest member
Sisyo011
Top