Hi Chris:) Hope you and your family are safe!
Each item in my inventory have examine function that calls the document. I use such document for item description. So, basically one item has one document to describe it. When the document is opened it pause the game - this works as I wanted! But I can still play with items: reorder them, examine and this also works fine for me. But the issue is in that I can still combine items when game is paused. This not works for me because when I combine items it's running action list with player animation, so even if document is opened and game is paused my player start to play animation and do other stuff that I have in a combining action list.
I am trying to avoid of making of any scripts in my game and make everything mostly with action lists. So it will be great to hear your thoughts:
The best solution is to block somehow the whole inventory while the document is opened. So basically I can combine items only in play mode. Is there a way of how I can do this?
There is a way to close document from the combining action list every time when I combine this or that item. This will deactivate game pause and will start playing combining action list which is good for me! But the problem is that I can't find any function to close all documents at once. Any thoughts?
Maybe there is an easy way of how I can block combination of items while document is opened and game is paused? This is also works for me.
Thanks,
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Thank you, and yours.
The InventoryBox element's Prevent interactions? property can be used to block default click behaviour, and you can toggle this through script.
Though you'd likely want to use an event of some kind, a quick-and-easy way to do this would be to place it in an Update function, i.e.:
Place that inside a new C# script, add "using AC;" at the top, and place it in your scene somewhere.
If a Menu is locked, it will turn off even if it's current Appear type condition is met. This can be done with the Menu: Change state Action, but also through custom script:
Such code could be incorporated into a custom Action, or simply placed on a prefab and triggered with the Object: Call event Action.
You can't block separate interaction types - just all or none. Probably best to go with the first method.
Thank you Chris, I'll try:)
Hey Chris, first scrip gives me error: Unexpected symbol `MenuInventoryBox'
guess it's missing some symbol?
As with all custom scripts, be sure to include the AC namespace at the top of the script:
Yes, it's already there but it's still gives me this message.
Share the exact error message, and the exact script you're using - pasted into Paste ofCode.
https://paste.ofcode.org/Ydchyud5n6vDvd9NV82h8U
Assets/Scripts/InventoryBox.cs(2,0): error CS1525: Unexpected symbol `MenuInventoryBox'
You need to paste the code inside the class - not replace it completely.
e.g. If your file is named PauseInventory, this would be the contents:
Another error:
Assets/Scripts/PauseInventory.cs(10,36): error CS0266: Cannot implicitly convert type
AC.MenuElement' to
AC.MenuInventoryBox'. An explicit conversion exists (are you missing a cast?)Apologies.
As always, HUGE thank you Chris! It's working! I will test it with other scenes and will let you know if I will have any other issues:)