Action-RPG Starter Kit Lua Code Problem

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
warlockoo1
Posts: 15
Joined: Thu Feb 02, 2017 2:47 am

Action-RPG Starter Kit Lua Code Problem

Post by warlockoo1 »

Hello,
So I am using Dialogue System with Action-RPG Starter Kit, I have setup player and one ally with which player will start conversation. Now at one point ally wil ask player for potion but this will trigger only on this condition

Code: Select all

Actor["EVE"].ItemQty1 > 0
and if it is then

Code: Select all

RemoveItem(1, 1)
Now it was working fine, till today I checked and it was not working and dialogue was not showing as condition was false but player has 1 potion and when I removed condition to show dialog it returned error =

Code: Select all

Dialogue System: Lua code 'RemoveItem(1, 1)' threw exception 'Invoke function call on non function value.'
I have tried everything including testing through console but same error. So please help, I am really stuck.

Thanks.

Update:
Ok still I am not able to find solution but I think found root cause which is I lua interpreter is not working as I played "Lua Example" scene and used "sqrt(4)" in in lua console but it output was "no return value". So I might accidently caused this but don't know how to solve it without starting all over again.
User avatar
Tony Li
Posts: 22062
Joined: Thu Jul 18, 2013 1:27 pm

Re: Action-RPG Starter Kit Lua Code Problem

Post by Tony Li »

Hi,

Instead of "sqrt(4)", try "return sqrt(4)". If that works, then Lua is probably working correctly.

Does your Dialogue Manager GameObject have an ARPG Bridge component? This component adds the ARPG-specific Lua functions as well as the code that sets Actor["EVE"].ItemQty1.

If it does, then temporarily tick the ARPG Bridge's Debug checkbox. When you start a conversation, it will log a lot of lines like:

Code: Select all

Dialogue System ARPG: Set Actor[EVE].ItemQtyX to Y
That will let you know that the ARPG Bridge is working.

You can also temporarily set the Dialogue Manager's Debug Level to Info. This will log a lot more lines, including lines like this at startup:

Code: Select all

Dialogue System: Registering Lua function SetPlayerLevel
This will let you know that the ARPG-specific Lua functions are available to use in conversations.

You might also try backing up your project, and then update to the latest version of the Dialogue System and ARPG. I just tested everything on the latest version and it looks like it's working.

If none of that helps, please feel free to send a reproduction project to tony (at) pixelcrushers.com and let me know what version of Unity to use. I'll be happy to take a look.
warlockoo1
Posts: 15
Joined: Thu Feb 02, 2017 2:47 am

Re: Action-RPG Starter Kit Lua Code Problem

Post by warlockoo1 »

Thanks for quick response, I'll try steps mentioned and will let you know.
warlockoo1
Posts: 15
Joined: Thu Feb 02, 2017 2:47 am

Re: Action-RPG Starter Kit Lua Code Problem

Post by warlockoo1 »

Thank you so much. Somehow ARPG Bridge was deleted and after adding it, everything was fine. Thanks again, I have another query but I'll make new post for it.
Post Reply