Random NPCs

Hey all! I’m not sure if what I’m looking for is too specific to make in RPGMaker, and I’m not sure if I should switch to a different platform, but I’m having some trouble making random NPCs. Here’s what I’m looking for:

I am trying to make a tavern-management game, where customers are randomly generated and come in at pseudorandom intervals. The way they look, where they sit, and what they want to eat or drink should all be random, and once they’re gone I don’t need to hold onto them any more. Is this possible in VX Ace? I’ve been playing around with switches, but I can’t cover all the cases I want to with them efficiently. I don’t know how to store al of the possibilities in one object or multiples, etc. Is there a way to do this? Or should I switch platforms.

Thanks!
Hey all! I’m not sure if what I’m looking for is too specific to make in RPGMaker, and I’m not sure if I should switch to a different platform, but I’m having some trouble making random NPCs. Here’s what I’m looking for:

I am trying to make a tavern-management game, where customers are randomly generated and come in at pseudorandom intervals. The way they look, where they sit, and what they want to eat or drink should all be random, and once they’re gone I don’t need to hold onto them any more. Is this possible in VX Ace? I’ve been playing around with switches, but I can’t cover all the cases I want to with them efficiently. I don’t know how to store al of the possibilities in one object or multiples, etc. Is there a way to do this? Or should I switch platforms.

Thanks!
It sounds incredibly possible to do with RPG Maker VX Ace. Is there something specific you're having problems with?
Yes. I want customers to be randomized. I can’t seem to randomize their graphic without creating way too many pages so I have an event for every graphic. Also they need to order a random food item. Lastly, they need to sit at a random seat that isn’t taken. My current system has an instance of every graphic for every seat which is getting heavy. Is there a better way?
It sounds incredibly possible to do with RPG Maker VX Ace. Is there something specific you're having problems with?

Yes. I want customers to be randomized. I can’t seem to randomize their graphic without creating way too many pages so I have an event for every graphic. Also they need to order a random food item. Lastly, they need to sit at a random seat that isn’t taken. My current system has an instance of every graphic for every seat which is getting heavy. Is there a better way?
Yes. I want customers to be randomized. I can’t seem to randomize their graphic without creating way too many pages so I have an event for every graphic. Also they need to order a random food item. Lastly, they need to sit at a random seat that isn’t taken. My current system has an instance of every graphic for every seat which is getting heavy. Is there a better way?
Quick clarification: do you want repeating graphics? As in potentially multiple customers onscreen with the same graphic or are you hoping that each graphic can only appear once at a time?
Quick clarification: do you want repeating graphics? As in potentially multiple customers onscreen with the same graphic or are you hoping that each graphic can only appear once at a time?

it’d be alright for them to be duplicates. Two town guards could walk in and both order something at the same time.
it’d be alright for them to be duplicates. Two town guards could walk in and both order something at the same time.
Okay, then, starting with the first thing you listed, randomizing graphics, you could probably do that with only one page aside from any others you need. Try this:
Don't assign any graphic to the customer initially, then, first thing when the event is triggered, use a variable to pick a random number. Then, use a set of conditionals to assign the graphic based on the random number. Would that work for you?
Okay, then, starting with the first thing you listed, randomizing graphics, you could probably do that with only one page aside from any others you need. Try this:
Don't assign any graphic to the customer initially, then, first thing when the event is triggered, use a variable to pick a random number. Then, use a set of conditionals to assign the graphic based on the random number. Would that work for you?

i can’t find a way to assign a graphic in VX Ace. It seems tied to page?
i can’t find a way to assign a graphic in VX Ace. It seems tied to page?
There's a way to do it with move routes. I forget what it's labeled as specifically, but if you start a move route, you should see an option that allows you to change the graphic.
There's a way to do it with move routes. I forget what it's labeled as specifically, but if you start a move route, you should see an option that allows you to change the graphic.
Wow! Thanks so much! Yeah that helps a LOT.
Wow! Thanks so much! Yeah that helps a LOT.
That's what the forums are for. 🙂
Do you want help with the other things too?
That's what the forums are for. 🙂
Do you want help with the other things too?

Well since you’re asking...

move got a number of places they can sit in the tavern. They’re gonna choose a spot to sit that isn’t taken, and then order something. Once you give them what they want they leave. If you take too long, they’ll get upset and leave without paying.

for the chairs, I’m thinking one event (that can now represent any character)for each chair, and have it wait a random amount of time to enter the store, although that might make it feel like large waves come in at sudden moments, which would be undesirable so there may be a better way to do that. If I could have an event randomly pick an open chair from a list that would be nice. maybe just a control variable.

As for them getting upset for waiting to long, I’m thinking wait commands in parallel processes.

that’s the immediate stuff. Lastly, if you have any tip for how I might upgrade the tavern as time goes on so they can purchase more area that would be helpful too!
Well since you’re asking...

move got a number of places they can sit in the tavern. They’re gonna choose a spot to sit that isn’t taken, and then order something. Once you give them what they want they leave. If you take too long, they’ll get upset and leave without paying.

for the chairs, I’m thinking one event (that can now represent any character)for each chair, and have it wait a random amount of time to enter the store, although that might make it feel like large waves come in at sudden moments, which would be undesirable so there may be a better way to do that. If I could have an event randomly pick an open chair from a list that would be nice. maybe just a control variable.

As for them getting upset for waiting to long, I’m thinking wait commands in parallel processes.

that’s the immediate stuff. Lastly, if you have any tip for how I might upgrade the tavern as time goes on so they can purchase more area that would be helpful too!
So, a pretty easy way to determine which chairs are open and which ones are taken already would be easy enough if you just assign each seat to a switch and make that switch trigger as soon as someone starts heading for it. Having them actually choose a chair based on which ones are actually available would be a bit trickier, but still doable. Would you rather have a bit of scripting or the bigger, script-free way?
So, a pretty easy way to determine which chairs are open and which ones are taken already would be easy enough if you just assign each seat to a switch and make that switch trigger as soon as someone starts heading for it. Having them actually choose a chair based on which ones are actually available would be a bit trickier, but still doable. Would you rather have a bit of scripting or the bigger, script-free way?
I am down for scripting!
I am down for scripting!
Cool! It's actually just a scripted conditional, so it should be pretty easy. I don't know how many seats you intend to have, but I'll use 4 in my example.
Set up a loop.
In that loop, set a variable (we'll say it's the first variable, just for simplicity's sake) to a random number between 1 and 4.
Set up a conditional and in the scripts section of the conditional, put
Code:
!$game_switches[$game_variables[1]]
If it returns true, add the script call
Code:
$game_switches[$game_variables[1]] = true
and break the loop. No "else" is necessary. If I haven't messed up anywhere, this should basically choose a random switch between switches 1, 2, 3, and 4, and if the switch is already on (the seat is taken) it will pick another one until it finds one that is open. Then, when it finds one, it will mark the seat as taken (and then you should make the customer walk to that seat to visibly claim it).
If you can't use the first switches and variable 1 and need help adjusting it to meet your specific game, I can help.

Edit: that if I haven't messed up was apparently a big if. It's corrected now, but I've caught a few mistakes now.
Cool! It's actually just a scripted conditional, so it should be pretty easy. I don't know how many seats you intend to have, but I'll use 4 in my example.
Set up a loop.
In that loop, set a variable (we'll say it's the first variable, just for simplicity's sake) to a random number between 1 and 4.
Set up a conditional and in the scripts section of the conditional, put
Code:
!$game_switches[$game_variables[1]]
If it returns true, add the script call
Code:
$game_switches[$game_variables[1]] = true
and break the loop. No "else" is necessary. If I haven't messed up anywhere, this should basically choose a random switch between switches 1, 2, 3, and 4, and if the switch is already on (the seat is taken) it will pick another one until it finds one that is open. Then, when it finds one, it will mark the seat as taken (and then you should make the customer walk to that seat to visibly claim it).
If you can't use the first switches and variable 1 and need help adjusting it to meet your specific game, I can help.

Edit: that if I haven't messed up was apparently a big if. It's corrected now, but I've caught a few mistakes now.

this is very helpful! I now have a randomized character coming in and choosing a random open seat! However, since I chose the graphic randomly, I can’t figure out how to carry that graphic to a new page. I want them to reach the seat and then go to a new page, where they will interact if spoken to, ask for food, and then you can give it to them. Also, I’m not sure how I can get them to correctly remember what food they ordered (that is, if I use a random variable to determine it, but then another NPC comes in and uses the same variable to determine his food, the older patron will now want whatever the new one wants)
Also, I’m not sure how I can get them to correctly remember what food they ordered (that is, if I use a random variable to determine it, but then another NPC comes in and uses the same variable to determine his food, the older patron will now want whatever the new one wants)
You could probably reconcile that one by using a lot of variables and tying each variable to a specific customer. (Which could work well, assuming that you are recycling events)
However, since I chose the graphic randomly, I can’t figure out how to carry that graphic to a new page. I want them to reach the seat and then go to a new page, where they will interact if spoken to, ask for food, and then you can give it to them.
I'm honestly not too sure how to do this either.

Edit:

I think I may have an idea that could work! You won't need this specific page on the event to move anywhere, right?
I have the same problems. I advise you to look for alternatives to xsplit.
I have the same problems. I advise you to look for alternatives to split.
I might just be tired, but could you explain what you mean?

Original thread: https://forums.rpgmakerweb.com/threads/random-npcs.128972/