Error in Corgi Inventory Example
-
- Posts: 194
- Joined: Mon Jul 01, 2019 1:21 pm
Error in Corgi Inventory Example
I'm getting a few issues with the Corgi Inventory Example. When Dude1 gives you a teddy bear, the console shows the following errors.
- The referenced script (Unknown) on this Behaviour is missing
- The referenced script on this Behaviour (Game object 'Dialogue Manager') is missing
- Dialogue System: Lua code 'mmAddItem("MainInventory", "Teddy", 1)' 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)
And the teddy bear does not show up in Inventory.
Is this just a simple missing script or is there something else going on here?
Thanks for your help
- The referenced script (Unknown) on this Behaviour is missing
- The referenced script on this Behaviour (Game object 'Dialogue Manager') is missing
- Dialogue System: Lua code 'mmAddItem("MainInventory", "Teddy", 1)' 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)
And the teddy bear does not show up in Inventory.
Is this just a simple missing script or is there something else going on here?
Thanks for your help
Re: Error in Corgi Inventory Example
Hi,
That example also uses Inventory Engine, which is an inventory system included with Corgi. Did you import the Dialogue System's Inventory Engine Support package?
That example also uses Inventory Engine, which is an inventory system included with Corgi. Did you import the Dialogue System's Inventory Engine Support package?
-
- Posts: 194
- Joined: Mon Jul 01, 2019 1:21 pm
Re: Error in Corgi Inventory Example
Oops, no I didn't! I'll do that and see if it works.
-
- Posts: 194
- Joined: Mon Jul 01, 2019 1:21 pm
Re: Error in Corgi Inventory Example
Imported the support package, the scene works now.
I have another question. How can I add conditions relating to the inventory to dialogue options? Let's say I want to have a dialogue option show up only if the player has 5 coins in their inventory. What's the best way to go about this?
I have another question. How can I add conditions relating to the inventory to dialogue options? Let's say I want to have a dialogue option show up only if the player has 5 coins in their inventory. What's the best way to go about this?
Re: Error in Corgi Inventory Example
Hi,
Use the Inventory Engine Lua Functions documented on the Inventory Engine Support page.
For example:
Use the Inventory Engine Lua Functions documented on the Inventory Engine Support page.
For example:
- Dialogue Text: "Hey, moneybags! Can you spare some of those coins?"
- Conditions: mmGetQuantity("MainInventory", "Coin") >= 5
-
- Posts: 194
- Joined: Mon Jul 01, 2019 1:21 pm
Re: Error in Corgi Inventory Example
Ah nice, I almost had it. I was missing the >=5 which seems very obvious now...
Thanks!
Thanks!
-
- Posts: 194
- Joined: Mon Jul 01, 2019 1:21 pm
Re: Error in Corgi Inventory Example
Just tried it, getting an error unfortunately.
Dialogue System: Lua code 'return mmGetQuantity(MainInventory, Coin) >=1;' threw exception 'Exception has been thrown by the target of an invocation.'
Dialogue System: Lua code 'return mmGetQuantity(MainInventory, Coin) >=1;' threw exception 'Exception has been thrown by the target of an invocation.'
Re: Error in Corgi Inventory Example
Use quotes, like this:
Also, the inventory name (e.g., "MainInventory") must exactly match the name of your inventory GameObject. In the Dialogue System's Corgi Inventory Example scene, this GameObject is named "MainInventory".
The second parameter, "Coin", must be the name of an Inventory Engine item.
Code: Select all
mmGetQuantity("MainInventory", "Coin") >= 5
The second parameter, "Coin", must be the name of an Inventory Engine item.
-
- Posts: 194
- Joined: Mon Jul 01, 2019 1:21 pm
Re: Error in Corgi Inventory Example
The code is working, but the quest isn't playing as I intended. Maybe I've missed something.
I have two dialogue options: "I have a coin" and "I don't have a coin".
The condition for "I have a coin" is: mmGetQuantity("MainInventory", "Coin") >=1;
The condition for "I don't have a coin" is: mmGetQuantity("MainInventory", "Coin") <=0;
However, even if you have 1 coin, the option "I have a coin" doesn't show up. The only way I can get it to show it to change the condition from >=1 to .=0, but then both options show up. Have I made a mistake somewhere?
Thanks for all your help btw, it's appreciated.
I have two dialogue options: "I have a coin" and "I don't have a coin".
The condition for "I have a coin" is: mmGetQuantity("MainInventory", "Coin") >=1;
The condition for "I don't have a coin" is: mmGetQuantity("MainInventory", "Coin") <=0;
However, even if you have 1 coin, the option "I have a coin" doesn't show up. The only way I can get it to show it to change the condition from >=1 to .=0, but then both options show up. Have I made a mistake somewhere?
Thanks for all your help btw, it's appreciated.
Re: Error in Corgi Inventory Example
Try removing the ";" at the end.
You only need a semicolon to separate statements. Since your condition only has one statement, you don't need it.
For debugging, you can also type:
into the "Run" bar at the bottom of the Dialogue Editor's Watches section, or in a Lua Console at runtime. You can also enter the full conditions, such as:
and:
to see what results they return.
You only need a semicolon to separate statements. Since your condition only has one statement, you don't need it.
For debugging, you can also type:
Code: Select all
return mmGetQuantity("MainInventory", "Coin")
Code: Select all
return mmGetQuantity("MainInventory", "Coin") >=1
Code: Select all
return mmGetQuantity("MainInventory", "Coin") <=0