Forum rules - please read before posting.

Inventory item to trigger ActionList in custom menu

edited August 2023 in Technical Q&A

Hey all. I'm currently trying to set-up the following flow:

Inventory items that, when collected, appear in a specific menu and can trigger an ActionList. These will be items that, when selected in a menu, will play an animation + a track (song).

I've setup mostly everything, but I can't figure out how to make these inventory items appear in this menu. I cloned the "Objectives" menu, and I've rearranged things as I'd like them. I've set up descriptions and textures. Now I need these items to appear as the objectives do, to display text at the bottom (band history) and display a texture up top/right, and, as mentioned before, when clicked, to trigger an individual ActionList/Per item. Here's an image of how it's set up currently. 

https://drive.google.com/file/d/1hHFAAHsb0AfJvKYqwzzH3Cc2J5lthwRA/view?usp=sharing

As always, thank you very much for your help.

Comments

  • Are these items separate from your "regular" Inventory? If so, you can use Categories to filter their display between Menus.

    In the Inventory Menu's "Categories" tab, define two Categories - Default and Music Track (or whatever best describes the item type). Then in the "Items" tab, place each item in the correct Category.

    Set the InventoryBox element's Inventory box type property to Default, and then check Filter by category? to have it only display items in the "Music Track" category. You can do the same to your "regular" Inventory to prevent such items showing there.

    To change the label/texture of an item in the Menu, you can use the Menu: Update content Action. If you pass an Inventory item parameter to this Action, it can be used to set a Label element's text to that item's name, and a Graphic element's texture to that item's texture.

    Create a new ActionList asset with two instances of Action type that affect the Label and Graphic elements. Define an Inventory Item parameter, and use it to override each of them.

    Then, for each item, define a "Use" interaction asset, and use the ActionList: Run Action to run the above asset, setting the Inventory item parameter to the item that is being used.

  • Hi. thank you for replying so quickly. I followed your instructions up to the filter by category. But, I believe I'm having a senior moment.

    Where do I need to "Create a new ActionList asset with two instances". Where does this action list go? In the "Menu Proprieties" on "Actionlist when turn on"?

    Same question but for "Menu: Update content", does that one go in the "Menu Proprieties" on "Actionlist when turn on"?

    thank you in advance

  • I was able to make the items appear in the costum menu (still having issues figuring out how to make text/texture appear as they did for the objective example). I also had an additional question. Is it possible to change "Category" in an ActionList? 

    The flow for the vinyl Records/Tracks is going to be: Collect -> Take from Standard Inventory -> Drag into Custom Inventory (which is going to be a record player) -> Remove from Standard Inventory -> Retain in Custom Inventory. 

    If the above is not possible, then it's fine, I can just send them directly to the custom one and forgo the entire flow. I was just curious if it was possible.

    Also, for the "Menu: Update content Action" question, if anybody has a tutorial or link to a thread that alreayd covered this, please let me know, and I'll follow that.

    Thank you.

  • I've been working with the inventory quite a bit recently, and here are few things worth experimenting with that may help in the above instances or overall:

    • ActionLists can be started from many places, such as: menus (e.g. turn on), from an inventory item interaction (e.g., use), and a recently added events listener (i.e. global actions that wait for an inventory item to be selected).
    • Key inventory actions rely on an item being selected, but they can also reference the last item selected, or even add and select an inventory item on the fly/behind the scenes.
    • As an alternative to updating an item's properties, I switch out inventory items entirely behind the scenes in an actionlist. For instance, you could have a potion with a "usable" category type. After using, an actionlist can remove the potion and replace it with an empty bottle. The bottle would just be a different inventory item with its own category, parameters, image and all.
    • Categories are a nice way to control inventory via (e.g.,) tabs, hotbars, or even using inventory items for purposes not usually considered inventory (skills, powers, statuses)
    • Inventory items do or can function largely as hotspots in the UI; this allows for things like popup descriptions, but also has to be considered in the context of ALL hotspots
    • Both inventories and containers can be used to similar purposes. It's worth experimenting how both function in different scenarios. Crafting and trading.
    • You won't always solve something in a single actionlist; many scenarios will require having one actionlist run another, or one one of several based upon a switch or variable/parameter check. Get used to chaining actions, passing parameters from one to the next, and even transferring between parameters, variables (often global), and inventory item properties.
    • There are settings that affect inventory management and use in several places. Consider the AC Game Editor Settings, Menu, Inventory, and even Cursor. For instance, my setup is very particularly not drag and drop, so I turn off the inventory item sticking to the cursor and manage inventory largely by clicking rather than item use.

    That's a bit of a junk drawer of ideas. Hopefully it will at least give you some more things to search the forums for.

    I will definitely say that there is nearly always more than one way to achieve the same or similar result with AC with little or no scripting. It is definitely worth experimenting, particularly with the higher level functions like inventory and crafting.

    Happy ActionListing!

  • edited August 2023

    Where do I need to "Create a new ActionList asset with two instances". Where does this action list go? In the "Menu Proprieties" on "Actionlist when turn on"?

    I was referring to "two instances" of the same Action type, rather than two separate ActionLists.

    Create a new ActionList asset, define an Inventory Item parameter in its properties, and add to it two copies of the Menu: Update content Action.

    For the first, fill in the details for the Label element that should show the item's name, leaving Content type as Text. Override the New label is field with the Inventory item parameter. This will cause the Label text to be set to the Label of the Inventory item mapped to the parameter when run.

    For the second, fill in the details for the Graphic element that should show the item's texture, this time setting Content type to Texture. Override the New texture field with the Inventory item parameter as before. This will cause the Graphic to display the texture of the Inventory item.

    Then, for a given Inventory item, create a new "Standard Use" ActionList in its properties. Give this ActionList a single Action: ActionList: Run. Have this run the ActionList asset above (with the Menu: Update content Action). Set its Run mode to Set Parameters And Run, and set the Inventory item parameter to match the Item involved.

    A tutorial that covers this Action type can be found here.

  • Hello. I've set up everything, but I'm getting some errors. I'm sure I'm missing something obvious in the logic. I've attached how everything is set up. I think the problem is either in the Jukebox_turnon (actionlist) or in "Update Content" fields where I've added the "?".

    https://drive.google.com/file/d/1yRo1uo5HkGK_J65cahT3m7tEVlqlyv8A/view?usp=sharing < - inventory

    https://drive.google.com/file/d/1jXyh-EJIJzad9qrCix1xamzn87ULOxTl/view?usp=sharing <- Menu.

    Thank you again.

  • You don't need the ActionList: Run in parallel Action - you can just run one Menu: Update content Action after the other, as they'll both run instantly.

    For those Actions, you need to insert the names of the Menu and Element you want to update.

    It looks like "Jukebox" is the name of the Menu, but I'm not sure what the Element names are.

  • What should be the "Element Name"? Should it be the Inventory Item or the Inventory Box "Vinyl Collection" - which is a menu element within Jukebox. If I add the former (Inventory Item) - get an an error saying "Couldn't find menu element". If I add the latter (VinylCollection) - I get Object reference not set ot an instance of an object.

    https://drive.google.com/file/d/1PdKIzftGYyFtfNGc56lLaWQb9GQn7Ixv/view?usp=sharing

  • For the case that you want to display the Inventory item's graphic, you'll want to set the Element name to a Graphic element in your Menu.

    I don't know which element in your Menu this is - or if you have one. The InventoryBox element is the wrong type - make sure that your Menu has a Graphic element, and enter its name into the Action.

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.