Weird Issue with Quest Completion

And it wouldn’t, if CompletedQuest is true… so that’s the million dollar question… Why is CompletedQuest returning true?

The IsComplete function matches in the QuestStatus.cs, so it shouldn’t be having an issue with that.

So QuestList.Evaluate() is never evaluating CompletedQuest… which makes me wonder if something else is…

            public bool Check(IEnumerable<IPredicateEvaluator> evaluators)
                Debug.Log($"Testing Predicate {predicate}({parameters[0]}");
                foreach (var evaluator in evaluators)
                    Debug.Log($"{evaluator} is evaluating {predicate}");
                    bool? result = evaluator.Evaluate(predicate, parameters);

                    if (result == null) 
                          Debug.Log($"{evaluator} cannot handle {predicate}");

                    if (result == negate) 
                            Debug.Log($"result = {result}, but expecting {!negate} returning false");
                            return false;
                return true;

so it’s a long one haha.

Hard to read, but it’s saying that QuestList cannot handle CompletedQuest… Is there any chance you have a trailing space in the CompletedQuest in your DialogueNode?

A trailing space as in the Predicate fields? No, I do not have one. They all match up.

I can’t believe I looked at this Evaluate method 10 times and missed the first line every time… Of course it never tests CompletedQuest, because you’re calling it off before the switch

Okay, removing that gets it to not show the “sure let me help you” option after completing the quest, but I can still complete the quest. And now it’s giving me twice the rewards as well (per completion)

And it’s also still showing “sure how can I help” after accepting the quest.

Is it testing the HasInventoryItem now?

(it’s late, so I’m done for the evening)

Yeah I should be in bed myself, it’s like 2am here. It’s now checking the HasInventoryItem, and returning false when I don’t have the item in my inventory.


and returning true when I have the item in the inventory


But still showing all 4 nodes (only 2 should be showing) at the end of the quest

Take each condition for the four nodes and convert them from the condition to an if statement, and run through the logic…
Remember that each And requires that all and elements return true, and each or requires that at least one element returns true.

You might also consider implementing my Condition Editor Improving Conditions: A Property Editor
Which would remove Magic Strings as a factor in the conditions (because the PropertyDrawer will abstract them away).

1 Like

I appreciate all your help so far. I’m definitely going to implement your condition editor, but I still wanna figure out where the hell I went wrong here. haha. I went through the logic on all of the nodes, and somewhere along the way, it just stops caring about the “negate”. I’m going to share SSs of the dialogue tree and then each of the “trouble” (blue) nodes.

The first node has no conditions whatsoever, so it shows up in all circumstances.

“Sure, How can I help” node:

this one isn’t supposed to show up unless you DON’T have the quest, or when you’ve completed the quest, but it shows up when you still have the quest in your questlist. It does go away after you’ve completed the quest, however.

“I’m already helping you” node:

This node works as intended. Only shows up when you have the quest, and disappears after you complete the quest.

“I have the item” node

this shows up after you’ve accepted the quest, and when you have the item in your inventory. It also HIDES when you have completed the quest, stopping you from completing the quest over and over again.

So I think this works as intended. It’s just the “Sure, how can I help” node that’s not acting correctly.

I did have an error with my rewards script, and that was the reason for the double rewards showing up. I forgot to put an ! infront of something, so it was thinking that I wasn’t getting the items lol.

if(!HasQuest(SandboxQuest) || !CompletedQuest(SandboxQuest))

This will show up until you’ve completed the quest, regardless of whether you have the quest or not… To get the condition you’re going for, you need:

if(!HasQuest(SandboxQuest) || CompletedQuest(SandBoxQuest))
if(HasQuest(SandboxQuest) && !CompletedQuest(SandBoxQuest))

This logic looks correct

if(HasQuest(SandboxQuest) && HasInventoryItem(Whetstone) && !CompletedQuest(SandboxQuest))

This logic looks correct. Your original posting of this node was not what you described here, so I’m guessing you saw that when I posted the interpretation earlier.

I like to also add a node

if(HasQuest(SandboxQuest) && CompletedQuest(SandboxQuest))

attached to a node like “I already helped you”

This reminds me that I want to add a feature to the Condition property drawer that shows the psuedocode for each node and the Condition in general.

This will show up until you’ve completed the quest, regardless of whether you have the quest or not… To get the condition you’re going for, you need:

if(!HasQuest(SandboxQuest) || CompletedQuest(SandBoxQuest))


so this works up until I’ve completed the quest, and then talk to the NPC again, he’ll give me the option to say “sure, how can I help” once again.

I was only going by your description… If you want that to only show up until the player has accepted the quest, and never again, delete the CompletedQuest(SandboxQuest) altogether.

oh okay, that makes sense. So it only shows up when you don’t have the quest at all, so it won’t even check for completedquest.

Correct, because there’s really no point.

Privacy & Terms