• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Make an Menu/Inventory System (Like Earthbound and Undertale)

NotTayyy

Member
Im trying to make a Inventory system that Is like Earthboud and Undertales, Where its controlled by the Keyboard and You can open multiple diff menus, and Items dont stack Etc...

I Was wondering How I would go about this.

edit: I Kinda know how to make the menu's for the Most part, Its the Inventory that's giving me the most trouble
 
Last edited:

obscene

Member
It can be rather complicated if you're new to coding. You could use something like a ds_grid to create what is basically a spreadsheet that looks something like this...

Code:
Name            Quantity           Script (To execute when selected)
Potion            5                      scr_potion
You would need a set of scripts to do the following...

Initialize inventory with quantities of 0
Add a quantity of an item to inventory
Use an item by executing it's associated script and reducing inventory by 1
Save inventory
Load inventory
Display inventory items with a quantity of 1 or more in a list

I may have an example for you later if you're interested.
 

Yal

🐧 *penguin noises*
GMC Elder
I'd imagine Undertale's system is just a list of item IDs....to pick an item up, change the first non-empty slot in the inventory into that item's ID. (If no slots are empty, your inventory is full and you can't pick the item up). This array changes all the time as you get and use items. However, there's another array... a 2D array which is an item database. Each row represents an item ID, each field its data (name, flavor text, whether it can be used in the battle / field, scripts when used, scripts to check if it's applicable...). You only store its ID in the inventory, and access all its functionality through the database.

Protip: use convenience scripts like this to actually store the data in nice spreadsheet-like form:
upload_2019-10-30_21-23-9.png


And the script that actually adds data looks like this, if you couldn't guess:
upload_2019-10-30_21-24-12.png

(the colored text for all the wd_s is because I use hundreds of constants / macros for array indexes so you don't need to remember all the numbers when you read data)
 

Yal

🐧 *penguin noises*
GMC Elder
Code:
for(c = 0; c < inventory_size; c++){
  if(global.inventory[c] != NULL){
            draw_text(x,y + c*20,global.item_name[global.inventory[c]])
  }
}
 
Top