Variable Item drops?

I am having a hard time grasping the variables when it comes to eventing. Is there a way to have a random item spawn from the item database? Basically a treasure chest that is completely randomized from a pool of item ids?
Yes.
Create your treasure chest event.
Set variable 1(or whatever number) to random..
Choose a range. For example 0 ~ 1(this has 2 possible outcomes).
Then conditional branch.
If variable 1 = 0.
Add whatever item.

Next conditional branch.
If variable 1 = 1.
Add whatever item.. so on..
The conditional branch system is one way.

If all the items you want to award are within a given range, say items 10-20, there is a nice script I can point you to that can do the same thing as the conditionals but using a single script call.

Its also possible to set the value of a variable to an array, which is simply a list of indexed values. You can 'push' values into the array and then select a random element of the array to pick which item to award the player. This method is a little more involved but can handle a list of item Ids that are not consecutive. For example, items 3, 6, 9, and 42.

I don't use MZ so the rest of my post doesn't totally apply but I'd like to bring it up anyway.

I'm actually recently began working again on a plugin for MV. It will allow the dev to create custom notetags that can be attached to items, weapons and armors. The notetags create custom loot pools containing any item with a common notetag. Then, a simple script call is all thats needed to award a random item from a selected loot pool.

I put it on the back burner but I've recently started working on it again. Theres a chance that once its released, someone might have interest in porting it to MZ. I can't say for certain but if its something that turns out to be useful, there's a greater possibility of that.
if you have problems understanding how to use variables, I suggest you search the forum for the "variables guide" - it is also linked in my "starting point" tutorial (see my signature).

that variables guide is a game where you are taught how to use variables and what you can do with them.
It was originally written with VXAce, so if you want to see the events themselves you'll have to use that (trial is sufficient), but everything inside that game is still the same principle in MV and MZ and you can learn things even without checking the event code from playing the game.
I am having a hard time grasping the variables when it comes to eventing. Is there a way to have a random item spawn from the item database? Basically a treasure chest that is completely randomized from a pool of item ids?
Hello, i got a random loot event made in my demo-town project, you can look it up there how it works or even copy + paste it. There are also alot of events wich use variables.
Its for the MZ.
https://forums.rpgmakerweb.com/index.php?threads/demo-town.141882/

Original thread: https://forums.rpgmakerweb.com/threads/variable-item-drops.142438/