Only one quest tracked and active at the same time

Announcements, support questions, and discussion for Quest Machine.
GorkaGames
Posts: 178
Joined: Fri Sep 21, 2018 8:38 pm

Re: Only one quest tracked and active at the same time

Post by GorkaGames »

sorry, can you please elaborate a bit more on here:

I suggest that you leave the quest state active, but reset the node states.

What do you mean with reset the node states? One example?
And I need to disconnect the gamebjects or at least the listeners somehow...
User avatar
Tony Li
Posts: 20803
Joined: Thu Jul 18, 2013 1:27 pm

Re: Only one quest tracked and active at the same time

Post by Tony Li »

Use QuestNode.SetState:

Code: Select all

// Set all except Start node to Inactive, in reverse order:
for (int i = quest.nodeList.Count - 1; i > 0; i--)
{
    quest.nodeList[i].SetState(QuestNodeState.Inactive);
}
The loop above sets it in reverse order (e.g., node 4, node 3, node 2, node 1) because it's less likely to cause side effects when changing states. It's like rewinding the quest back to its original state. It leaves node 0 (the Start node) untouched.

(BTW, there are also Set Quest State and Set Quest Node Action actions that you can add to quests' Actions lists.)
GorkaGames
Posts: 178
Joined: Fri Sep 21, 2018 8:38 pm

Re: Only one quest tracked and active at the same time

Post by GorkaGames »

ok, but this is not similar to "abandone"? when you abandone and accept again in starts form the beginning, as far as I know....
User avatar
Tony Li
Posts: 20803
Joined: Thu Jul 18, 2013 1:27 pm

Re: Only one quest tracked and active at the same time

Post by Tony Li »

It's similar, but the manual script keeps the quest in the active state and doesn't send "quest abandoned" messages (in case something is listening for those messages). It's really up to what you want. I think it's better to keep it in the active state so it appears in the quest journal.
Post Reply