GameMaker Fully Functional Inventory System

Aaron Craig

Member
GM Version: Created in 2.1 (usable with 1.4)
Target Platform: Computer (Modifiable to any platform)
Download: N/A
Links: video below


Summary:
A video tutorial on creating a functional, scrollable inventory using ds grid functions. Everything is explained as it's coded, but prior GML experience is highly recommended.


Tutorial:
 
B

BoltsFellOff

Guest
Thanks for the great tutorial. Will save this tutorial for later when I need to make similar inventory system.
Keep up the good work!
 

Carolusclen

Member
This is one of the best tutorials i have come across in general for a very long time.
Well spoken,
Well explained,
No time wasted,
Neat and readable coding,

10/10
 
L

Logan Bevans

Guest
FATAL ERROR in
action number 1
of Mouse Event for Left Pressed
for object obj_InventoryButton:

ds_grid_height argument 1 incorrect type (undefined) expecting a Number (YYGI32)
at gml_Script_addItem (line 18) - for(i = 0; i < ds_grid_height(gridToAddTo); ++i)
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_addItem (line 18)
called from - gml_Object_obj_InventoryButton_LeftButtonPressed_1 (line 4) - script_execute(ds_grid_get(playerInventory, 4, itemSelected));
 
A

Avidmoviegoer

Guest
FATAL ERROR in
action number 1
of Mouse Event for Left Pressed
for object obj_InventoryButton:

ds_grid_height argument 1 incorrect type (undefined) expecting a Number (YYGI32)
at gml_Script_addItem (line 18) - for(i = 0; i < ds_grid_height(gridToAddTo); ++i)
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_addItem (line 18)
called from - gml_Object_obj_InventoryButton_LeftButtonPressed_1 (line 4) - script_execute(ds_grid_get(playerInventory, 4, itemSelected));
Did you ever figure this one out? I'm wondering if it's not passing the info over correctly when we resize the grid due to trashing an item. Does 1.4 handle ds_grids differently than gms2?


EDIT:
I did finally get this working with my project, so I figured I'd write out my fix in case someone else runs into this.
The draw event kept trying to access, for example, [3,6] and grid size was [6,6] which is actually one less than what was trying to be accessed. I couldn't figure out why the resize of the grid from the Step Event wasn't working, so I tried everything. I eventually changed the step event into an End Step event instead, and now it works perfectly.
I think this may be because my version of this inventory system is running in the Draw GUI event rather than a regular Draw Event, and maybe GMS has a different order it runs these in.
Spent all day on this one, haha.
 
Last edited by a moderator:
C

Chris Livermore

Guest
from this tutorial I got evertjing workign and Its good all appart from trying to get the danm inventory to draw into the GUI layer. any ideas on how to do this?
 
Top