Potion Scripting
Overview
In Fateful Remedies, the player needs to give potions to customers in order to prepare them for an oncoming war. Without the potions or any potions spawning the game cannot work and the customers are doomed, so in this section I describe how the potions are spawned in and how the game makes them.
Potion Process
Generation and Giving
The first step we had to deal with was how potions got spawned in. Initially we had a crafting system but... that didn't work out very well, so the system we used for generating the potions of Fateful Remedies was procedural generation.
Set Up (Part 1)
Blank Canvas
Before they're spawned in, all our potion scripts usually look like this logic wise. They're like blank canvases in a way, their only real purpose is to wait until a capable enough artist is able to supply it with meaning. Only the artist in this instance is the potion creator script and the paint is the stats and variables.
Set Up (Part 2)
Random Constructor
After checking if it's present in the game controller, it's this function that determines what the stats to each potion is and how much it should alter one or two of a given customer's stats (the four stats are Body, Intellect, Charisma, and Tranquility) when given.
Set Up (Part 3)
Setting of Potions
After the constructor has done its thing, all that's left is to set the potions stats when they're spawned in. This function determines this by checking the primary stat (or at least when "Body" is the primary stat from this section of the function) to see what its corresponding potion is.
Logic: giving potions
Once a patron is done explaining their problem, and a potion needs to be given, the following script fires off when the player selects a potion. Each one shares the same capability to alter customer stats, with the only thing staying consistent amidst randomization being the primary stat and tag. Once a potion is given, it alters its targets stats immediately making them prepared for whatever problem they need taken care of.
End Result
The Appointments In action
In Fateful Remedies, you help your customers by listening to their problems and giving them a potion that best suits their needs. While they're hidden when the customer explains their problem, the potions are still there and waiting to be used to set the customer's stats according to the player's selected potion type.