Forum rules - please read before posting.

Action to occur after a container is closed

Is there a way to have an action occur after a container is closed? I want to have a container shown a part of a dialogue "take this item" and for the dialogue to continue after the container is closed, and checks for the item in the inventory.

Is that possible? The show container action has no onward connection node.

Olly

Comments

  • edited June 2023

    If i understand what you are trying to do correctly:

    Wouldn't that be possible with the "Action List when turn off" option in the Container Menus Settings?

    You could use a Check Item Action and then -> Play Dialogue.
    You'd just check for the Items you want that to happen for, and chain those.

  • So, one action list to start the dialogue and show the container. Then have another one called by the container settings, which will continue the dialogue (or rather play a second dialogue) once the container is closed?

    Will give it a go. Thanks.

  • edited June 2023

    I didn't quite get the "take this item" dialogue, but yes. One Actionlist to start that dialogue, and the second one on that Menu Setting: "action list when turn off", i don't know what you want it to do there.
    If you have multiple containers, just put it on the hotspot that you open it with, if you want different dialogues.

    But you wrote check for an item in the inventory, so you could just put an inventory check action and dialogue on the action list when turn off for the second part there or do whatever you want to happen.

  • edited July 2023

    Thanks. Working through these options.

    Alas none are a perfect fit for me. Ideally there would be a "Actionlist on Close" actionlist parameter on each container object. This could restart the dialogue or action something when the container is closed.

    There doesn't appear to be a way to have an actionlist run when you pick up an item (put it in your inventory) only give or use or examine.

  • Ideally there would be a "Actionlist on Close" actionlist parameter on each container object.

    The "ActionList when turn off" Menu property would run at this time, but it doesn't provide a way to react to specific Containers. I shall give this some thought and see if something can be done about this.

    Having an inventory item call an actionlist when it's put in the inventory is fine, but only works for unique items. It doesn't work in my case for generic items like "money" as the actionlist would run every time.

    I'm not following your meaning, here. Could you describe the original problem you're trying to solve here in more detail?

  • Hi Chris

    Did the "actionlist on close" feature for the container actions ever get on the roadmap?

    The use case here is that say I have a conversation from someone who tells the player to take their money (or other non-unique item). If I want the conversation to carry on after the player empties the container, then there is no "easy" way to do this. My work around is to have a script that checks whether that non-unique item has been added to the inventory, but that actionlist itself has to then check for a localvariable (or other form of variable) to see where that money came from. Did it come from the mugged-npc? If yes, then carry the conversation on. If not, then do nothing. However money might be taken from any number of places, with any number of dialogues continuing (or not).

    Having a parameter on the Show Container action that says "do this when it's closed" would be a quick simply solution to it. Other actionlists, such as the onMenuClose ones, could also fire, and that would be up to the dev to manage.

    Olly

  • Yes - v1.78 introduced the Events Editor, which can handle this.

    In the top toolbar, choose "Editors -> Events Editor". In the new window, create a Container: Close event and click the "+" icon to assign an ActionList asset file that will run when any Container is closed.

    If you want to instead only perform this for a specific Container, replace this with the new Event Runner component attached on your Container. Create another event in the same way - but this time, you'll be able to specify which Container it responds to.

  • Hi Chris.
    Is there a way to debug an Event Runner component? I have this component on a container. The action list never gets triggered, though the action list runs manually or via other triggers. Nothing appears in the console when I close the container, as though the action list never runs, despite there being a COMMENT node in the action list.

    Any ideas what I've missed or how I can debug what's happening? The HelpURL in the script points to a URL which returns a 404.

    Olly

  • It's a bug - thanks for the report.

    To fix, open up AC's Menu script and look for the following (around line #2077):

    KickStarter.playerInput.activeContainer = null;
    

    Replace with:

    if (KickStarter.playerInput.activeContainer) KickStarter.playerInput.activeContainer.Close ();
    
  • Thanks Chris. That's working.

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.