1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice
  2. NOTICE: We will be applying a Xenforo update on Tuesday 25th of February. This means that from approximately 10:00 to 14:00 BST the forums will be offline (or possibly longer). Sorry for the inconvenience! Official Announcement here.

GML Flexible Inventory System

Discussion in 'Tutorials' started by Cloaked Games, Sep 23, 2017.

  1. Hans66

    Hans66 Member

    Joined:
    Aug 14, 2019
    Posts:
    8
    Thank you so much everything was correct code wise i needed to add the sprite mask to the slot objects tried today have been swarmed with engineering school lately. Thank you again! now onto creating the menu.
     
    Cloaked Games likes this.
  2. tCubix

    tCubix Member

    Joined:
    Nov 25, 2019
    Posts:
    1
    Hey I am new to Gamemaker and I put the inventory in an extra room but I also want to have a hotbar if the inventory is closed. I dont know how I should do this
     
    Cloaked Games likes this.
  3. Cloaked Games

    Cloaked Games Member

    Joined:
    Jul 4, 2016
    Posts:
    836
    You should have the inventory as a global ds_grid, then you can reference it from anywhere in the game.
    Just create some slots for the hotbar where you need them, in addition to the slots in your inventory room.
     
  4. doomtucan

    doomtucan Member

    Joined:
    Sep 8, 2019
    Posts:
    14
    okay so my question is how can i take an implement this into the style of game i am making? im making an Action Role Playing Dungeon Crawler that has massive amounts of items and values!
     
    Cloaked Games likes this.
  5. Cloaked Games

    Cloaked Games Member

    Joined:
    Jul 4, 2016
    Posts:
    836
    This tutorial should work fine for that type of game. Nothing special you need to do to get it to work in any particular genre. The quantity of items just extends your enumerator, data structures, etcetera.
     
  6. Maxvolt0

    Maxvolt0 Member

    Joined:
    Jan 26, 2020
    Posts:
    2
    How would you go about making slots that only allow an Item into them based on their typing?
     
    Cloaked Games likes this.
  7. Cloaked Games

    Cloaked Games Member

    Joined:
    Jul 4, 2016
    Posts:
    836
    In the code where you would put items into a slot, do an additional check based on the type. There's a lot of ways you can do this, and it depends on what specific limits you want to have.
    - You may have different item_gain functions that you use depending on the type, that start the for loop for finding slots at different locations.
    - You could also possibly assign types, or a list of types to individual slots, either on the object or in a new data structure and check for that.

    I hope that helps. It's hard to give a specific answer.
     
  8. Maxvolt0

    Maxvolt0 Member

    Joined:
    Jan 26, 2020
    Posts:
    2
    I appreciate the fast response. Thank you, it helps.
     
    Cloaked Games likes this.
  9. McFishy

    McFishy Member

    Joined:
    Feb 9, 2020
    Posts:
    1
    Thanks for the tutorial! I found a way to better use this with cameras/view-ports. The device_mouse_x_to_gui(device); function can be used to get the mouse x/y relative the the gui layer and you could check for the position of the mouse when you click to see if its over a inventory slot.
     
    Cloaked Games likes this.

Share This Page