Trying to make an inventory treasure chest

I really am new to this, though I got this program last year in January, I didn't explore much cause I wanted to get my characters and sprites fleshed out more and was waiting for GCH to come out with it's MV update that they had promised.....Of course we all saw where that went. But that's a different topic. Fact is, I am trying to make an event that would be a treasure chest that has multiple items inside it. And the player can choose to take items or leave them. If they take them it takes it from the inventory and if they leave it, they can come back to it at another time and take the other items if they want.


I can't figure out how to make multiple Else options with the conditional branches. Do I just make another conditional inside the original one in order to do that? I have the 'Else' checked so I get the one, but I can't figure out how to do more then that.


The other thing is, I have been searching and watching tutorials on youtube, there are so many out there, does anyone know of one that would best explain or show how to do what it is I'm wanting to do here? I am not sure what words or phrase to search to find what I'm looking for, as well as most searches pop up the answers for how to do it with VX/Ace not MV and I don't know if the exact same method will work the same on MV. 


Also if this is in the wrong place I apologize. The 'Ask a Question' was the only button I could find to allow me to post anything.
Welcome (back) to the community!


In general, eventing in VX Ace and MV is the same (MV only has a few new event commands/options), so most VX Ace tutorials can be applied to MV as well. Only scripting/plugins and some of the (advanced) damage formula syntax are different.


For your chest question, you can use switches and a series of nested conditional branches to show different options depending on what the player has already taken. I'll give you a few screenshots in a minute, it's easier to show it in the event than to explain 🙂


@Super Shy Gamer Girl  I spent some time putting together a chest with "only" three items, and it's already getting very confusing with the Switch method I'm using. If you want to do this with more items or multiple times in the game, I would advise you to use a different method involving variables and mathematics, but less nested Conditional Branches. Let me know if you want to see that method as well - for me, it's less confusing that this one, but a bit more abstract.


I put everything for the Switch method in a spoiler below because it's really long. Try to understand the way the Conditional Branches are nested inside each other - I put in some comments that say which items are taken, not taken or still unknown at that point in the branches. (Or just take one look at it and say "Other method, please!", that's fine too 🙂 )

Spoiler
I have only made the conditional branches with comments for now, otherwise it was even more confusing, even for me 😛


In this example, the chest contains three items: a potion, a sword and a shield. When you give an item to the player, you will need to turn on a Switch (I called these Switches "Potion taken", "Sword taken" and "Shield taken") so that you can tell later whether the item is still in the chest or has already been taken. You might also need to put a Label at the very end of all the Conditional Branches and jump to that Label from within the Branch after you're done with the "give item to player and turn on Switch" part of each Branch to make sure the other Branches aren't executed.


Anyway, here are the images. It's all on one single event page, but I had to take three shreenshots for all the commands. I also put the commands as text below, maybe that's easier to see.


Chest01.png


Chest02.png


Chest03.png


The same commands written out look like this:

Code:
◆If:Potion taken is OFF
  ◆Comment:Not taken: Potion
  :       :Unknown: Sword, Shield
  ◆If:Sword taken is OFF
    ◆Comment:Not taken: Potion, Sword
    :       :Unknown: Shield
    ◆If:Shield taken is OFF
      ◆Comment:Not taken: Potion, Sword, Shield
      ◆
    :Else
      ◆Comment:Not taken: Potion, Sword
      :       :Taken: Shield
      ◆
    :End
    ◆
  :Else
    ◆Comment:Not taken: Potion
    :       :Taken: Sword
    :       :Unknown: Shield
    ◆If:Shield taken is ON
      ◆Comment:Not taken: Potion
      :       :Taken: Sword, Shield
      ◆
    :Else
      ◆Comment:Not taken: Potion, Shield
      :       :Taken: Sword
      ◆
    :End
    ◆
  :End
  ◆
:Else
  ◆Comment:Taken: Potion
  :       :Unknown: Sword, Shield
  ◆If:Sword taken is ON
    ◆Comment:Taken: Potion, Sword
    :       :Unknown: Shield
    ◆If:Shield taken is ON
      ◆Comment:Taken: Potion, Sword, Shield
      :       : -> The chest is empty!
      ◆
    :Else
      ◆Comment:Not taken: Shield
      :       :Taken: Potion, Sword
      ◆
    :End
    ◆
  :Else
    ◆Comment:Not taken: Sword
    :       :Taken: Potion
    :       :Unknown: Shield
    ◆If:Shield taken is ON
      ◆Comment:Not taken: Sword, Shield
      :       :Taken: Potion
      ◆
    :Else
      ◆Comment:Not taken: Sword
      :       :Taken: Potion, Shield
      ◆
    :End
    ◆
  :End
  ◆
:End

As I said, I wouldn't use this for more than three items, and you can probably see why ... Again, let me know if you would like to see the other method.
I suggest you follow the link "starting point" in my signature to get to the basic tutorials, they include tutorials on eventing.


As for your question, that is a tricky thing.


There are several different solutions - the one you're considering with event commands will require a lot of conditional branching and variables. I can't really recommend that unless you're after a very limited functionality.


The other options are either to use a dedicated plugin (you'll probably have to request it, but it might already exist), or to use a plugin for conditional choice options


The second one still needs a mediocrum of event commands, but I think such a plugin already exist.


Basically with the conditional choices, you would enable options in the show choice list based on variables, and store in the variables the numbers stored in the chest - allowing withdrawal option only to become visible if one of the items is in the chest.


Still somewhat limited, but not requiring as much branching as the pure eventing.
Thanks. I'll check out that tutorial @Andar and thanks for the examples there @LadyBaskerville I was afraid it was going to get overly complicated and it seems it will, unless I can find a plug in. Who knew looking into a box and taking things out at random intervals when the player chooses to could be so complicated XD. What is the other method you were talking about though? Just in case it may work well for me, otherwise I'll be limiting how often I do something like this I think >.> Unless I find a plugin.
It almost sounds like you're after a storage container that has some items pre-added.  Would you want the player to be able to put stuff in the chest or only take stuff out?  Prime Hover has a storage plugin for MV that lets you add stuff up-front, and the player can choose what they want to take out.  You MAY be able to specify that they can't put anything back in.  It might be worth checking out.
Give this a go 
The other method would still require you to event the "Which item(s) do you want to take?" part individually for each combination of items that are left in the chest, but instead of using a switch for each item the player can take out of the chest, you would only use a single variable and some math.


Imagine a number assigned to each item, 1 to the first, 10 to the second, 100 to the third, 1000 to the fourth and so on. Add that number to a variable if the item is taken from the chest. You can then check the variable to see which item have been taken - e.g. 100 means only the third item has been taken, 1010 means the second (10) and fourth (1000) items have been taken, 0 means none of the items has been taken and so on. I'm not at my PC anymore, so I can't give screenshots of an example right now, but I hope the logic for this is clear without one.


If you can find a plugin that does most of the work for you, that would of course be more convenient that a purely evented solution. I haven't worked with any storage systems yet, but I remember seeing a Conditional Choice plugin from Himeworks:


http://himeworks.com/2015/11/hidden-choice-conditions/
Yes basically I'm looking for where a chest when you go up to it, it has pre-determined items in it. The player can choose to take items out or leave it be, or only take one item and leave the rest, but then come back to it later on and be able to take the remaining items if they so choose. However can't put items back in, I'll give those plugin's a look see as well. Thank you everyone so much helping me out with this!
Eventing wise you could make duplicates of items and use the hidden items list with select item command for the selection process and add the normal itrm based on their choice.


Also use self switches to keep record of which item is empty but this limits you to four choices by default.

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-make-an-inventory-treasure-chest.73131/