A few weeks ago I featured Yanfly’s gab bar script as a Friday script, and I issued three levels of challenges:
Set up a common event parallel process that, every five minutes, chooses a random party member and has them say a catch phrase unique to that party member.
As above, but add a variety of catch phrases for each member, and have one chosen at random.
As above, but instead of a catch phrase, create a dialogue between two present party members.
As it turns out, I do something like this in Vidar! So to answer this challenge, I thought I’d walk you through the process as I did it.
In one of the quests in Vidar, it’s possible for various ghosts in the ice cave to join your party (to a maximum of 3). There’s no combat in Vidar, so “joining your party” really just means following you along until you bring them to a specific location. But while they’re along for the ride, boy are they chatty. Every 30 seconds, someone from the conga line will offer some tidbit (the goal of which is to feed the player story information without disrupting the game).
Within RPG Maker’s “game interpreter” class, I added a new function called ghost_gab. This gets called every 30 seconds as long as the quest is active, with a common event.
ghost_gab itself does a few things. First, it creates an array of gabber actor IDs in the party. Then it chooses one at random. Using a case statement, we can set the variable “string” depending on which gabber was chosen. We have an actor id (chosen_gabber), we have a string (string), and we can pass both of these to Yanfly’s script to have a random ghost gab his catch phrase at us.
From here, it’s two very simple steps to add a variety of catchphrases. First, in the case statement, make an array of possible strings for each gabber. Then, set the string to one chosen at random (using .sample)
Now, once a gabber is chosen, the case statement gives us a list of all possible things they can say. We grab one at random, and pass it to Yanfly’s script.
Here, things get complicated. First, each gabber needs two arrays. One which is the same as in the intermediate challenge, a list of solo lines. The second is an array of arrays, each one containing 1) the other ghost’s ID, 2) the first line of dialogue, 3) the second line of dialogue. Got all that? Let’s take a look at the merchant’s:
Next, the ghost_gab function needs to know which two arrays we’re dealing with. So, in our case statement, we say something like:
We grab a random one from the double_gab_array as we did before, with sample. In Vidar, I have some additional restrictions: you won’t see the same gab twice, and solo gabs go in order, so as to better tell a story. So when a grab one from the single_gab_array, I just want the first in line:
Next we need to see if the double_gab can be called. We ask if it exists (it won’t if all of the double gabs for our chosen gabber have been played once already). We also ask if the dialogue partner is in the party. If both conditions are satisfied, we play the double gab.
If not, we play the single gab.
And that’s how we coax the ghosts in Vidar to share their story. Sometimes, with each other.