GMS 2 Fully Functional Inventory System

Discussion in 'Tutorials' started by Aaron Craig, Sep 9, 2017.

  1. Aaron Craig

    Aaron Craig Member

    Joined:
    Jun 20, 2016
    Posts:
    31
    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:
     
  2. BoltsFellOff

    BoltsFellOff Member

    Joined:
    Aug 17, 2017
    Posts:
    8
    Thanks for the great tutorial. Will save this tutorial for later when I need to make similar inventory system.
    Keep up the good work!
     
  3. ysdulank

    ysdulank Member

    Joined:
    Jun 8, 2017
    Posts:
    3
    Thanks for sharing your experience! Thank you so much!
     
  4. Carolusclen

    Carolusclen Member

    Joined:
    Oct 24, 2016
    Posts:
    96
    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
     
  5. Geoff Jones

    Geoff Jones Member

    Joined:
    Aug 20, 2016
    Posts:
    483
    Brilliant. Wish I had this when I was making my inventory.
     
  6. Logan Bevans

    Logan Bevans Member

    Joined:
    May 17, 2018
    Posts:
    39
    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));
     
  7. Avidmoviegoer

    Avidmoviegoer Member

    Joined:
    Feb 22, 2018
    Posts:
    1
    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: Jan 11, 2019

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice