Hi,
I am trying to set up a normal kill quest.
This is what I did:
I added a variable wolfKills to the Variables tab
I have 3 Enemies that have a an increment on Destroy Script attached to them:
and I have this Quest here setup:
And I have this Diaolgue Entry that asks for this condition:
Quest["SaveMe"].State == "active" and Variables["wolfKills"]>=3
And I get this error message:
Dialogue System: Lua code 'return Quest["SaveMe"].State == "active" and Variables["wolfKills"]>=3' threw exception 'Lookup of field 'wolfKills' in the table element failed because the table element itself isn't in the table.'
UnityEngine.Debug:LogError(Object)
PixelCrushers.DialogueSystem.Lua:RunRaw(String, Boolean, Boolean)
PixelCrushers.DialogueSystem.Lua:Run(String, Boolean, Boolean)
PixelCrushers.DialogueSystem.Lua:IsTrue(String, Boolean, Boolean)
If I remove the part (and Variables["wolfKills"]>=3) it does work. But I need to check if these nasty wolfs are dead or not.
What I am doing wrong. I allready spent half a day on that. In another forum post I have read, that the part with the tables means that the variable is not set. But as you can see I have set it. So....
Your help would be very much appreciated!!
Error in Kill quest
Re: Error in Kill quest
Hi,
Change "Variables" to "Variable". Or use the Lua wizard to write the Lua code for you. I use the Lua wizards a lot, not just because I'm lazy but also because it helps reduce typos.
Example screenshot:
Change "Variables" to "Variable". Or use the Lua wizard to write the Lua code for you. I use the Lua wizards a lot, not just because I'm lazy but also because it helps reduce typos.
Example screenshot:
-
- Posts: 105
- Joined: Tue Apr 05, 2016 9:37 am
Re: Error in Kill quest
Hi Tony,
awesome! I just did not know that wizard exists! Face Palm.
So I get closer to the functioning quest. The message error is gone. But somehow the wolfKill gets not incremented when killing a wolf. Is there more to it then just adding the script to the enemy and entering the proper values?
Because it does work if I go to the Variables tab and set the wolfKills to 3.
So it must be the increment on destroy script.
awesome! I just did not know that wizard exists! Face Palm.
So I get closer to the functioning quest. The message error is gone. But somehow the wolfKill gets not incremented when killing a wolf. Is there more to it then just adding the script to the enemy and entering the proper values?
Because it does work if I go to the Variables tab and set the wolfKills to 3.
So it must be the increment on destroy script.
Re: Error in Kill quest
As a debugging step, inspect the Increment On Destroy component and specify an Alert Message such as:
This will let you know when the Increment On Destroy component is working.
When the player kills a wolf, does it destroy the wolf GameObject? If it only disables the GameObject, change Increment On to Disable. Many frameworks, such as UFPS and ICE, just disable the GameObject and return it to a pool for recycling.
If killing a wolf doesn't disable or destroy it, you'll need to use a different component than Increment On Destroy. In this case, let me know what happens to the wolf GameObject when it's killed; I'll try to suggest a solution.
Code: Select all
Wolves Killed: [var=wolfKills]
When the player kills a wolf, does it destroy the wolf GameObject? If it only disables the GameObject, change Increment On to Disable. Many frameworks, such as UFPS and ICE, just disable the GameObject and return it to a pool for recycling.
If killing a wolf doesn't disable or destroy it, you'll need to use a different component than Increment On Destroy. In this case, let me know what happens to the wolf GameObject when it's killed; I'll try to suggest a solution.
-
- Posts: 105
- Joined: Tue Apr 05, 2016 9:37 am
Re: Error in Kill quest
Thanks again Tony!
This helped me out! It is embarrassing to say but it was another typo in the script!
But this will not be the last quest so I guess your lessons will help me from now on.
Thank you for your help.
This helped me out! It is embarrassing to say but it was another typo in the script!
But this will not be the last quest so I guess your lessons will help me from now on.
Thank you for your help.
Re: Error in Kill quest
Glad I could help!