Feature Mechanic: The Picnic Basket (Menu)


This post will be about what I've done to make this specific feature and a bit about what inspired it. I'll do my best to recount some of the programming decisions I made prior to the current build, which will at the very least feature some pictures.

Inspiration

If you've ever played Tales of Destiny on the PS2, or even Tales of Graces, you would recognize this as being based on the 'Food Sack' and 'Eleth Mixer' features from those games. The 'Picnic Basket' operates much more like the Food Sack where you can equip special straps that trigger effects in battle. You could equip a certain amount at a time, but overtime the sack would...I guess evolve, because they just keep changing into different bags with no other explanation. If anything, the game only ever explains how the sack can make these dishes on the fly and yet some would "rather do their own cooking".  Still, it was a nice little feature that worked and I wanted to incorporate it here as a form of magic tool that can generate food (albeit not 'as' good as the real thing).


Function

As with the Food Sack, the Picnic Basket requires Food Tags that are found throughout the game and can be equipped so long as you have the room. They are divided into different types; one for HP, TP, Status, Boost, Revival, and Special.

  • HP and TP tags are alike, where they restore after reaching a certain percentage.
  • Status tags remove a status ailment when activated while restoring some health.
  • Boost tags can either increase certain stats at the start of battle, or boost resistance against certain elements while restoring HP.
  • Revival tags can revive a party member(s) after their health drops to 0, while also restoring a certain amount of health. Usually takes up a lot of food to use.
  • Special tags can have unique effects or even a combination of the other tags.

All tags require Food to use. Any time a tag activates, it increases the maximum amount of food you can have by a small amount. Once that value reaches a certain amount, it automatically turns into another basket which increases the number of slots your basket has. Naturally, when one type of tag activates, others of that same type cannot activate for the rest of the battle (i.e. only one HP tag can activate over another that hasn't activated). Tags go in order from top to bottom, which is something I needed to work out in the code.


Coding

So, first and foremost is that I'm using mostly Yanfly Engine plugins for this game. Being alone, I tend to rely on pre-built plugins that I can work with and as I play around with them, I end up learning to optimize certain aspects. In the above picture, you will notice I have multiple Common Events for the same food items in a row. That is because of the plugin I'm using, "Common Event Menu", puts up a list of all the Common Events that are needed for this menu. And because the picnic basket keeps adding slots, I have to take into account which event is displayed.

For instance, the very first Rice Ball event has comments that display what text appears while hovering over the food item. The individual slots will display a name stored in their respective variables. With four slots shown, I have to take into account that the basket will change. As such, each Rice Ball event goes up in slot count.



Now, when you actually select the Rice Ball in the menu, the game will check to see if it's equipped to a slot or not. If it is, it'll ask to remove it from any of the slots it's in. Otherwise, you get to choose which slot it goes in and it'll even replace what was in their prior. Now, as part of me learning to optimize and condense code, before it was set up like this I actually had each event contain condition checks for every single food tag programmed for each slot it has to check. And I mean...every single food tag! It was hectic, and it took up a lot of space and memory. Any time I would save the project, it would take a bit to save because of how many of these events had rows upon rows of code to process! Then I learned that if I set a condition to check for each slot for the desired food tag, I could cut out all the excess waste and it would make saving and loading far faster.

For example, the condition I have to check each slot would go like this: $gameVariables.value(24) == "Rice Ball" || $gameVariables.value(25) == "Rice Ball" || and so on. Finding even one in a slot triggers the "True" condition commands. Otherwise, it just goes into the "Else" condition commands.

At present, I have about 50 tags implemented into the game.  That's a lot of repeated slots needed, and I'm hoping this is the only menu that will require this many repeats. I would like to include menus for an Item Book and a Monster Book at some point. Every database has a max of 2000 entries, and currently I have used around 450. I'm confident that I'll at least be able to do both of these after ensuring all the artes in the game work with the action sequences they have. And who knows? Maybe I'll learn something that will further condense these so I don't need to take up a lot of space.

References

Get Tales of Naturia

Leave a comment

Log in with itch.io to leave a comment.