SetQuestNodeState to complete

Announcements, support questions, and discussion for Quest Machine.
Post Reply
Ollymuk
Posts: 39
Joined: Wed Oct 14, 2020 12:59 pm

SetQuestNodeState to complete

Post by Ollymuk »

Hi

What's the correct way to set a Quest Node State to complete? The manual appears to imply it uses the same states as the quest (so that would mean Success as the complete status). However when I set a quest node to Success via the LUA, the quest itself is marked as complete, along with the Node.

If I use True, which is what is shown in the drop down in the quest editor, then the node doesn't move from active/inactive.

It's probably me, but thought I'd check.

Olly
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: SetQuestNodeState to complete

Post by Tony Li »

Hi Olly,

A quest state (the overall quest state) can be WaitingToStart, Active, Successful, or Failed (or Abandoned or Disabled).

If you're using Lua, set it using SetQuestState(). Example:

Code: Select all

SetQuestState("peskyRabbits", "success")
---

An individual quest node state can be Inactive, Active, or True.

Set it using SetQuestNodeState(). When working with the Dialogue System integration, for consistency with Dialogue System terminology use "success" for True. Example:

Code: Select all

SetQuestNodeState("peskyRabbits", "returnToNPC", "success")
Ollymuk
Posts: 39
Joined: Wed Oct 14, 2020 12:59 pm

Re: SetQuestNodeState to complete

Post by Ollymuk »

Thanks. I wanted to check. I have a problem with one quest being marked as Success=True when a node is marked as success.

I have an object with a dialogue component which uses a LUA to issue the following commands

SetQuestNodeState("Get Game", "Find Game", "success")

However when the node "Find Game" is marked as success, it marks the Success node as True.

I tried to upload a gif of what happens but it's too large to upload.

Any ideas why that might be? I've tried various forms of capitalisation (S, s etc) and also tried True and true.

Olly
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: SetQuestNodeState to complete

Post by Tony Li »

Hi,

In the Quest Editor window, does the Find Game node link to a Success node? If so, then when the Find Game node becomes true, it will automatically activate the Success node. And when a Success node becomes active, it automatically becomes True, which marks the whole quest as successful.
Ollymuk
Posts: 39
Joined: Wed Oct 14, 2020 12:59 pm

Re: SetQuestNodeState to complete

Post by Ollymuk »

Thanks Tony

This is before the LUA command
before2.png
before2.png (93.46 KiB) Viewed 805 times
Then the player grabs a gameobject with a dialogue trigger which issues the following LUA code:

Code: Select all

SetQuestNodeState("Get Game", "Find Game", "success");
SetQuestNodeState("Get Game", "Sell Game", "active")
Then the quest node tree shows this:
after2.png
after2.png (122.1 KiB) Viewed 805 times
The second node is success, the third node is now active, which is correct, but the Success node is now also True.

I've tested the LUA code and it happens if I include "SetQuestNodeState("Get Game", "Find Game", "success")". That's enough to trigger the Success to true.

Olly
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: SetQuestNodeState to complete

Post by Tony Li »

Hi Olly,

Those screenshots look blown up to me, and it's a lucky thing. Notice that the line between Find Game and Sell Game is a little thicker than normal. I'd bet that there are actually two lines from Find Game: one to Sell Game, and another to Success. Try moving the Sell Game or Success node, or right-click and select Auto-Arrange Nodes.
Post Reply