Page 2 of 3

Re: Using Invector Trouble

Posted: Thu Jan 23, 2020 4:22 pm
by Tony Li
Hi,

You may have already enabled the Invector inventory Lua functions. If not, the steps are here.

Currently you have to manually type the Lua functions. For example, if you only want to show a dialogue entry node if the player has 7+ swords (swords are item ID 3), then set the node's Conditions field to:

Code: Select all

vGetItemCount(3) >= 7
If you want a node to take away 7 swords, set the Script field to:

Code: Select all

vRemoveItemByID(3, 7)
The Dialogue System has a new feature that can add the Lua functions in integrations (and your own custom Lua functions) to the "..." list so you don't have to type them. However, I haven't had time yet to set up the CustomLuaFunctionInfo assets for all of the integrations. I hope to get them all done in the next couple of updates.

Re: Using Invector Trouble

Posted: Thu Jan 23, 2020 4:28 pm
by DeidreReay
i have found this to be helpful I just may need to dig in deeper to figure it out. Thanks again

https://www.pixelcrushers.com/dialogue_ ... torExample

Re: Using Invector Trouble

Posted: Thu Jan 23, 2020 4:38 pm
by Tony Li
If you have any questions on how to do a specific thing, just let me know.

Re: Using Invector Trouble

Posted: Thu Jan 23, 2020 4:41 pm
by DeidreReay
Tony Li wrote: Thu Jan 23, 2020 4:22 pm Hi,

You may have already enabled the Invector inventory Lua functions. If not, the steps are here.

Currently you have to manually type the Lua functions. For example, if you only want to show a dialogue entry node if the player has 7+ swords (swords are item ID 3), then set the node's Conditions field to:

Code: Select all

vGetItemCount(3) >= 7
If you want a node to take away 7 swords, set the Script field to:

Code: Select all

vRemoveItemByID(3, 7)
The Dialogue System has a new feature that can add the Lua functions in integrations (and your own custom Lua functions) to the "..." list so you don't have to type them. However, I haven't had time yet to set up the CustomLuaFunctionInfo assets for all of the integrations. I hope to get them all done in the next couple of updates.
So.. I am following your tutorials and on the first quest giving tutorial we have set up variable to get babies.
Now instead of babies using invector id(2) (which is potion) Do i need to still set up the variable and how so??
The conditions and script inside of nodes make sense enough just not sure about if needing to set up the variable before hand
Thank you what everyone said about you being active and helpful is more than true.

Re: Using Invector Trouble

Posted: Thu Jan 23, 2020 5:05 pm
by Tony Li
Hi,

If you're checking Invector items, you don't have to define a separate variable.

Roughly following the Quest Tutorial in structure, in step 7 change quest entry 1 from:

Code: Select all

[var=BabiesSaved]/2 Saved
to:

Code: Select all

[lua(vGetItemCount(2))]/2 Potions
Entry 1 will show the value of vGetItemCount(2) instead of the value of a "BabiesSaved" variable.


In the conversation, in place of:
  • Conditions: Variable["BabiesSaved"] < 2
use:
  • Conditions: vGetItemCount(2) < 2
And similarly for the other node's Conditions (Variable["BabiesSaved"] >= 2).


The only other major difference is that the tutorial uses an Increment On Destroy component, which automatically tells the quest HUD to update. This is what makes Entry 1 show the updated value of the "BabiesSaved" variable.

If the pickup deactivates its GameObject when picked up, you can still use IncrementOnDestroy; just leave the variable part blank.

If it doesn't deactivate its GameObject, you'll need to configure your item pickups to run a DialogueSystemTrigger when picked up. Select Add Action > Run Lua Code, and set the Lua Code field to: UpdateTracker()

Re: Using Invector Trouble

Posted: Thu Jan 23, 2020 5:12 pm
by DeidreReay
Thank you I will try all of this out right now.

Re: Using Invector Trouble

Posted: Thu Jan 23, 2020 6:26 pm
by DeidreReay
receiving three errors

Dialogue System: Lua code 'return vGetItemCount(2)' threw exception 'Tried to invoke a function call on a non-function value. If you're calling a function, is it registered with Lua?'
UnityEngine.Debug:LogError(Object)

Dialogue System: Lua code 'return vGetItemCount(2) >= 2' threw exception 'Tried to invoke a function call on a non-function value. If you're calling a function, is it registered with Lua?'

Dialogue System: Lua code 'return vGetItemCount(2) < 2' threw exception 'Tried to invoke a function call on a non-function value. If you're calling a function, is it registered with Lua?'

Re: Using Invector Trouble

Posted: Thu Jan 23, 2020 6:43 pm
by DeidreReay
Im sorry I forgot the Invector bridge when i redid the main player character. It worked thank you so much

Re: Using Invector Trouble

Posted: Thu Jan 23, 2020 6:49 pm
by DeidreReay
How would I remove the two potions

On the conversation node that condition checked he has the two potions and then on custom script write

vRemoveItemByID(2, 2) ??

Re: Using Invector Trouble

Posted: Thu Jan 23, 2020 8:14 pm
by Tony Li
Yes, that's it exactly.