Hi Tony,
I got a bug relates to the condition checking. My node has 3 conditions and it requires all of them to be True. But the node became true with only 2 last conditions. The counter condition didn't work.
Please help me to fix that. Thank you.
P/S: from my debugging, it looks like the numTrueCondition is not reset when one condition fails, and the callback increase numTrueCondition when other conditions match and ignore the first one.
Checking conditions is not correct
Checking conditions is not correct
THAP TAM STUDIO
https://www.hogvalord.com
https://www.hogvalord.com
Re: Checking conditions is not correct
Hi,
What do you mean by "when one condition fails"? Are you reverting a node back to a previous state? (For example, using the Set Quest Node State quest action.)
What do you mean by "when one condition fails"? Are you reverting a node back to a previous state? (For example, using the Set Quest Node State quest action.)
Re: Checking conditions is not correct
I made a set of 3 conditions and set the node will be successful when all of the 3 conditions match. The first condition is the counter condition and the next two conditions are Lua variable conditions.
In my case, the first one does not match but the Lua variable conditions have a callback and that causes the issue. After the first checking, everything is fine, but the callback is triggered by the time manager, and that time the Lua variable matches the condition. It increases the value of numTrueCondition and the numTrueConditon larger than the ListCondition.Count. So the node becomes true but the counter condition in the set does not match.
My opinion is when node checks all conditions, it should go through all condition likes A & B & C = true instead of comparing the numTrueCondition with the List Condition Count.
In my case, the first one does not match but the Lua variable conditions have a callback and that causes the issue. After the first checking, everything is fine, but the callback is triggered by the time manager, and that time the Lua variable matches the condition. It increases the value of numTrueCondition and the numTrueConditon larger than the ListCondition.Count. So the node becomes true but the counter condition in the set does not match.
My opinion is when node checks all conditions, it should go through all condition likes A & B & C = true instead of comparing the numTrueCondition with the List Condition Count.
THAP TAM STUDIO
https://www.hogvalord.com
https://www.hogvalord.com
Re: Checking conditions is not correct
Hi,
Quest Machine works the way it does because some conditions only get one message to turn true (such as the Message Quest Condition).
If the Lua condition can become true and then later become false before all of the conditions are true, use a Parent State Quest Condition. Add A & B & C as separate condition nodes, each leading to a single child node with a Parent State Quest Condition:
If the Lua condition on C can become false before A & B are true, add a node that checks of C turned false. In this node, reset the nodes above to Active instead of True:
It requires a few more nodes, but it gives you the greatest amount of flexibility.
Quest Machine works the way it does because some conditions only get one message to turn true (such as the Message Quest Condition).
If the Lua condition can become true and then later become false before all of the conditions are true, use a Parent State Quest Condition. Add A & B & C as separate condition nodes, each leading to a single child node with a Parent State Quest Condition:
If the Lua condition on C can become false before A & B are true, add a node that checks of C turned false. In this node, reset the nodes above to Active instead of True:
It requires a few more nodes, but it gives you the greatest amount of flexibility.
Re: Checking conditions is not correct
Thanks, Toni. That's very helpful.
THAP TAM STUDIO
https://www.hogvalord.com
https://www.hogvalord.com
Re: Checking conditions is not correct
Happy to help!