Forum rules - please read before posting.

Limited Inventory

Are we to forever have George Stobbart pockets, or is there some way we can have a limited inventory, therefore forcing the player to use containers to store items? I don't mean anything too complex like weight limits or anything, just a very simple, early-Resident Evil-like grid, where one item takes one grid space, for example. I didn't find anything about this in the manual or tutorials, but apologies if there is & I missed it.

Thanks

Comments

  • edited December 2015
    The actual grid or presentation of any inventory system is only the visual side of things; any game with a limited inventory will control it with a few variables.

    I'd suggest having two global variables: currentInventory and maxInventory. Then, whenever you want to pick up a new inventory item, first compare the two. If current is less than max, allow the inventory item to be picked up. If not, tell the player that they can't. If the inventory item can be picked up, be sure to increase currentInventory by 1 (or more, if you want "large" items). You can even change the size of maxInventory as the game progresses, if you so wish.

    Easiest way to do this would be with a separate ActionList. You could set up everything to work with the ActionList beforehand using parameters (actually just one parameter: an inventory item which gets passed to the ActionList), and then your entire process of handling the inventory "test" could take place with a single action.
  • Thanks for the response Geo! I haven't done much with parameters before, I'll experiment.
  • Ok, I've set up the two variables maxInventory (with an integer of 12) and currentInventory.

    I've now started making an ActionList that starts with a Variable Check, that compares the two variables. If the condition is met (current less than max) then continue to an inventory add object action. If condition is not met, then stop.

    I'm not sure if I'm doing this right, though. Currently in my scene I have a regular setup with a hotspot that adds an item to the inventory.

    This can't be right though, it's not checking the variable, and also what about later on if the player decides to store the item in a container?

    I'm struggling with the specifics.

  • If you told it to check the variable, it will check the variable. Could you post a screenshot of your ActionList(s) and hotspot properties?

    If an item is stored in a container or otherwise removed from the inventory, be sure to reduce currentInventory by 1.
  • Ok, it is definitely working - the variable is being checked and compared to the max inventory, then adding 1 to current if it is picked up. I also have it printing text to the screen when the inventory is full - works like a charm, so thanks a lot for the help.

    However, this is all through actions created in each hotspot for each item - I'm not actually making use of the Action List Asset that I made earlier, that's supposed to make use of parameters.

    (I wasn't sure how to upload screenshots btw)

  • For future reference: screenshots can't be hosted here - but they can easily be uploaded to eg. imgur.com, and linked to.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.