MV (MV) Trying to open Shops with dynamic inventory. Help needed in placing items into shops through scripting.

Basically, I want to make a shop that updates its inventory based on variables. Like, as an example, if you are level 1, it has potions. If you're level 2, super potions. Level 3, ultra potions. I would rather not have a million different event commands where I have to manually place all the items in the shop, but instead simply have a simple array of items that I can create, and put that array into the shop.

It feels like it should be simply to do this. I know how to open a shop using script calls. The problem comes to actually giving that shop any inventory. For instance, this code:

Code:
var goods = [0,1,2,3];

SceneManager.push(Scene_Shop);
SceneManager.prepareNextScene(goods, false);

Doesn't work! The shop opens fine, and you can sell to your heart's content. But the shop has no items at all.

I tried changing it to this, but to no avail:

Code:
var goods = [$dataArmors[2], $dataArmors[3]];

SceneManager.push(Scene_Shop);
SceneManager.prepareNextScene(goods, false);

Once again, there's simply nothing in the shop.

I don't know how to proceed. Any help in formatting how to put items into the store's goods will be super helpful. Once I know the formatting, I think I can do the rest on my own. I just need to know how to, through scripts (or a plugin command), and not events, to populate a shop's inventory.
goods is an array of arrays, where each element has a different meaning:
- The first element of the subarrays is the kind (0 for item, 1 for weapon, 2 for armor)
- The second element is id of the item
- The third element is a flag to indicate whether a custom price should be set
- The last element is the custom price,

so:

Code:
var goods = [];

goods.push([0, 1, 0, 0]); // Would push item #1 without a custom price into the goods.
goods.push([1, 2, 1, 50]); // Would push weapon #2 with a custom price of 50 into the goods.

SceneManager.push(Scene_Shop);
SceneManager.prepareNextScene(goods, false);

I hope that helps you.
Thank you very much! This is super helpful, and I think I'll be able to make my systems now.

I think this can probably be closed now. Thanks a bunch!
Just report your first post and let the mods know you got your answer, if you want the thread to be closed.
Okay, thanks!
hime or yanfly had a plugin to hide good until require level or whenever you want
unhide it if it makes easier for you.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/mv-trying-to-open-shops-with-dynamic-inventory-help-needed-in-placing-items-into-shops-through-scripting.126425/