Hello, these days I started working on tavern management game. And immediately faced the very first problem, how do i make random customers appear each day?
What first came to my mind is generating random variables in the beginning of each workday. If the variable customer 1 = 1, then the event customer 1 is on. But this lacks versatility. What if I want customer 1 to be a different person and order different food each time? How do I implement that?
The number of customers depends on the tavern level and the customer depends on the tavern reputation. Do I need to create every single possible scenario or there is easier way to do it? My logistics are not logisting...
It's a little hard to give advice without any clue as to how you've started to set this up so far - screenshots of events go a long way.
But generally speaking, you could do something like this...
Control Variables -> variable 1 -> random value
- Conditional Branch -> variable 1 = 3
- - Show Text "Hi, it's darvarq again! Hmm, today I'd like..."
- Conditional Branch -> variable 1 = 4
- - Show Text "I'm Turan, thought I'd try out your tavern. I'll have..."
Control Variables -> variable 2 -> random value
- Conditional Branch -> variable 2 = 1
- - Show Text "Some stew."
- Conditional Branch -> variable 2 = 2
- - Show Text "The fried liver soufflé!"
I'd use the Math.random() function, an event spawner and arrays or switch cases of possible things the customers could order or say.
I am sure there are a lot of ways to approach this. What I would try are things that I have already experimented with and made various tutorials for.
For instance, you can have Events that aren't on your map (tavern) and you can randomly place any of those events that you want, under any conditions you want, whenever you want.
Each of those Events that you randomly decide to move to the map can have multiple pages with different sprites (different people). Imagine 10 Events with 10 pages each with different sprites.
And as previously mentioned, you can use arrays to store strings of text and randomly pick what customers say and order.
My one big question is how much do you already know how to do? Are you comfortable with Variables, Switches, Conditional Branches, Arrays, etc.?
Thanks to everyone there is some progress on my test project. First I downloaded Galv's Event Spawner. On the first screenshot is the event that starts the shift, depending on the tavern level it starts common event for every guest. The common events create random variable and use it to spawn npc to the respective location for every customer. Then every npc generates another random variable for what order to make.
This pretty much solves the problem. I can create another common events that spawn more customers when the fame increases and whatever other conditions I decide to implement in the future.
I don't know how to use Arrays and functions, if what I made can be improved I'm happy to hear.