Forum rules - please read before posting.

Launch monologue when item added to Inventory?

Hi guys, here I am with another doubt. So, the background is as follows: I have an inventory that's hidden by default and show when hitting the 'C' key. Everything is working perfectly until I realized the user might get lost when adding too much stuff to the inventory, so I would like some kind of pop up notification when items are added to Inventory, like: "Air Freshener added to the Inventory". I know this is possible through launching a dialogue on ActionList, but I'd like to know if there's a more automatic way of doing this.



  • edited March 2017
    I have something like this running in one of my projects (it automatically fades the inventory menu in and out when an inventory item is added).

    Would be happy to share the code here if you're interested - not at my development computer right now.
  • Hey @Snebjorn that would be really cool. Maybe based on your code I can develop my own idea. :)
  • edited March 2017
    I think it's almost done after I tweaked it a bit.

    Step 1: Create this C# script called InventoryNotification.cs:

    using UnityEngine;
    using AC;

    public class InventoryNotification : MonoBehaviour {

        public ActionListAsset ActionListAssetWhenAdding;

        void ShowInventoryNotification(InvItem item, int value)
            KickStarter.runtimeVariables.SetCustomToken(0, item.label);

        void OnEnable()
            EventManager.OnInventoryAdd += ShowInventoryNotification;

        void OnDisable()
            EventManager.OnInventoryAdd -= ShowInventoryNotification;

    Step 2: Create this action list asset called ShowInventoryNotification:


    Step 3: Add an empty GameObject to your scene, in this case called InventoryNotifier, and add the script component to it:


    ... and you should be having narrator dialogue telling the player what has been added to the inventory.

    As mentioned, in my original version it's handled through a dedicated menu, but this version is probably simpler.
  • @Snebjorn that's amazing man! Works like a charm. And it's very versatile, since we can tweak it around and make it look totally different from the actual dialogues. Thank you so much!
  • edited March 2017
    Any time - this was actually a good reminder for me of how versatile and well-designed AC is! :)
  • Good trick!  Another method would be to make use of parameters, and place your Inventory: Add or remove Action in a separate ActionList asset, and then run this asset - with parameters set to whatever you like - instead of running a separate instance of this Action each time you pick something up.

    More about ActionList parameters can be learned in the Manual's section 5.13, and by following this tutorial.
  • @Snebjorn could you please update screenshots? the links are broken now and I feel like some info is missing.
  • @Snebjorn thanks, and what about Step 2 screenshot?
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.