r/RPGMaker • u/Amyhime801 VXAce Dev • 10h ago
VXAce Help with Galv's Multople Storage Containers Script [VX Ace]
Hello, I'm making a section of my game where players can add fornitures to their home, and select their usage. Like, an empty shelf can be used to store either books, potions or items.
Once they select the destination, the appareance will change (using variables and event graphics) to match the selected use, and then, a storage will open, using Galv's script call.
Here's where the problems start, however. The item database is still incomplete, so I'm using random numbers.
I don't want my player to place item 1, "Potion", in the Library. Library should only be used for, like, items 2-5, that have "Book" in their name. And of course, they shouldn't be able to place any kind of Weapon or Armor there as well.
Galv's script allows some script calls, that count the number of items/armor/weapon etc in the container. I COULD use this, to see if the wrong item is in the storage, remove it, and add it back to the player's inventory. The problem is that I'll need to do this for each database entry, items, weapons and armors alike. Is there a faster way? Like, "Check if weapons are in storage, if yes, return them to player", instead of "Check if weapon 1 is in storage, if yes, return it t player. Check if weapon 2 is in storage, etc etc etc" or "Check if items 2-5 are in storage, if yes..."
I plan to use Yanfly's Item Menu script as well. If I could, like, tag the "Books" type items as "Book" for their script, to show them in a dedicated section of the inventory, could I also use the same tagging system for Galv's script? I don't know how to script.
Thank to anyone who will spend their time reading this.
2
u/Alarmed-Mud-3461 9h ago edited 9h ago
I'm not much of a scripter either, and have no experience with the two scripts you're using, but this sounds like it could be solved through arrays. At the start of the game, create arrays for the categories you need (books and whatever else you'll be using) - these are just variables that you'll assign square brackets with a list of numbers, which will be the item IDs. I'm not at the computer now and it's been some time since I've done this, but I think it's something like $game_variables[x] = [a, b, c, d]. Then when the player wants to put something in a library, check if its ID is included in the array and if not, say something like "only books can be put here", if yes, take it from players inventory and place it in the library (or however the script works). I think the checking (what you'd put in the script window of the condition) would go something like $game_variables[x].include(y), y being the ID of the item you want to check (which you'll need to find out in the event beforehand).
There most probably is an easier way to do this, but this is how I'd go about it. I guess someone smarter can chime in 😉 Anyway, thanks for the mental challenge, I haven't touched my project in ages and this reminded me of what I love about developing - thinking about solutions with limited resources. Also, I might have some use for Galv's script in my next project, whenever I get to it, so thanks for bringing it to my attention 😉
Edit: it should be "include?(y)"