Invecvtor Inventory Question

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
nitrox32
Posts: 68
Joined: Sat Dec 01, 2018 10:41 am

Invecvtor Inventory Question

Post by nitrox32 »

I've looked at the manual on how the to use DS to add items to Invector's inventory. I've also added the Use_Invector_Inventory to the Scripting Define Symbols. I can't figure out where to use these Lua in conversations. I thought they would be used under Conditions and Scripts in a Dialogue Entry but they are not showing up.
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Invecvtor Inventory Question

Post by Tony Li »

Enter them manually. In the example below, the dialogue entry's Conditions check if the player has a sword (item ID 3). If so, it uses this entry, displaying the Dialogue Text and running the Script, which gives the player a sword:

invectorLua.png
invectorLua.png (5.26 KiB) Viewed 1420 times

BTW, for debugging, you can also add a Lua Console component to your scene. Press ~+L to open it, then enter Lua commands. For example, to give yourself a sword, enter "vAddItemByID(3, 1, true)​" in the Lua Console.
nitrox32
Posts: 68
Joined: Sat Dec 01, 2018 10:41 am

Re: Invecvtor Inventory Question

Post by nitrox32 »

Perfect! Thanks!
nitrox32
Posts: 68
Joined: Sat Dec 01, 2018 10:41 am

Re: Invecvtor Inventory Question

Post by nitrox32 »

One other thing, I would like to have a message display that a sword has been added to my inventory. I've added ShowAlert("Sword added!") but nothing happens.
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Invecvtor Inventory Question

Post by Tony Li »

Hi,

In the Dialogue Manager's Alert Settings, make sure alerts are allowed during conversations.

Alternatively, you can set the Variable["Alert"] to the string you want to show. When the conversation ends, the Dialogue System will check this variable and show its content if you've set it.
nitrox32
Posts: 68
Joined: Sat Dec 01, 2018 10:41 am

Re: Invecvtor Inventory Question

Post by nitrox32 »

I have two situations. First, I have a key and door lock system set up in Invector. Is there a way to have DS save the state of the lock? In other words once the lock has been opened, can DS save the state so that it doesn't have to be unlocked later when the scene is loaded? Also, DS seems to be saving the inventory but when I load a saved scene the items that have been picked up reappear in the scene. Any way to fix this?
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Invecvtor Inventory Question

Post by Tony Li »

Hi,

Add Destructible Saver components to pickups. Assign a unique key to each one, or use menu item Tools > Pixel Crushers > Common > Save System > Assign Unique Keys to do it automatically.

For the lock, it depends on how it's set up. For example:
  • If it's an animator state, add an Animator Saver.
  • If it activates a GameObject representing the unlocked lock and deactivates the locked version, then use Active Saver components. You'll need to put these on a different GameObject such as the parent, since one of the GameObjects won't be active when the scene starts, so its Active Saver won't take effect.
  • Or you can write your own Saver component. The Common / Templates folder has a starter script.
nitrox32
Posts: 68
Joined: Sat Dec 01, 2018 10:41 am

Re: Invecvtor Inventory Question

Post by nitrox32 »

Thanks for the quick reply. I was just about to edit my post. I found the destructible component. I forgot a read about that in the manual. I'll try the animator saver and see if it works.
nitrox32
Posts: 68
Joined: Sat Dec 01, 2018 10:41 am

Re: Invecvtor Inventory Question

Post by nitrox32 »

Actually the solution was quite simple for my design choices. I did end up using the DS position saver component. It should of been placed on the door model itself instead of the parent object that contained the vSimpleDoor and UseItemEventTrigger compnonets. I also had to untick Auto Close in the vSimpleDoor component.
Post Reply