Disable oobject after added to inventory/Inventory Engine

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Trashrat
Posts: 25
Joined: Fri Oct 13, 2023 11:38 am

Disable oobject after added to inventory/Inventory Engine

Post by Trashrat »

Hi,

I am using the MM Inventory Engine in my game, and the compatabilty and the support between the two is fantastic.
The only issue I am currently having is that I have a dialogue trigger on an object to pick up, where something is said about the item, and then the choice of having the player pick it up or leave it.

I use

Code: Select all

mmAddItem("MainInventory", "Necklace", 1);
on the conversation node to pick it up and it adds it to the inventory, but unfortunately the item is still there on the table. I also cannot use a sequence to set Enabled to False as the item is the conversation actor. Is there any simple way for me to implement this or will it involve some kind of workaround?

Thank you.
User avatar
Tony Li
Posts: 22111
Joined: Thu Jul 18, 2013 1:27 pm

Re: Disable oobject after added to inventory/Inventory Engine

Post by Tony Li »

Hi,

If you use mmAddItem() on the last dialogue entry in the conversation, it should be fine to deactivate the GameObject using the sequencer command: SetActive(false) or SetActive(false, listener) if the item is the listener of the current entry.
Trashrat
Posts: 25
Joined: Fri Oct 13, 2023 11:38 am

Re: Disable oobject after added to inventory/Inventory Engine

Post by Trashrat »

Hey Tony,

Unfortunately that doesn't appear to be working for me, I am assuming it is becuase even if it is the last end of the dialogue, it is calling setEnabled flase before adding it to the inventory. I have managed to get it to work however by using

Code: Select all

SendMessage(Pick,,listener)
Which calls the Pick method on the listener, picks the item up and sets it to enabled=false. Unless there is any issue doing it this way, which I canot think there would be, then consider it working!

Thank you again.
User avatar
Tony Li
Posts: 22111
Joined: Thu Jul 18, 2013 1:27 pm

Re: Disable oobject after added to inventory/Inventory Engine

Post by Tony Li »

Hmm, the Script field runs before the Sequence field, so it should add the item before the Sequence's SetActive(false) runs. But SendMessage(Pick,,listener) is fine, too!
Post Reply