Quest Condition Counting
Posted: Thu Jan 17, 2019 6:05 am
Hello everybody!
I noticed QuestMachine uses a counting mechanism when checking if the conditions for a questnode etc. are met. However, it would be handy if QuestMachine could keep track of all the different conditions and only count a true condition if it had not already been true.
I refer to the following code in the class QuestConditionSet:
And to explain my problem a bit further: I want a questnode to become "true" when condition1 and condition2 are met. Currently, the questnode would also become "true" if condition1 is met two times and condition2 is still false.
I thought about removing true conditions from the quest condition set, but maybe you don't always want this behaviour... anyway, is it possible to add a feature like this or should I use custom quest conditions for that?
I noticed QuestMachine uses a counting mechanism when checking if the conditions for a questnode etc. are met. However, it would be handy if QuestMachine could keep track of all the different conditions and only count a true condition if it had not already been true.
I refer to the following code in the class QuestConditionSet:
Code: Select all
private void OnTrueCondition()
{
numTrueConditions++;
if (areConditionsMet) SetTrue();
}
public bool areConditionsMet
{
get
{
if (conditionList == null || conditionList.Count == 0) return true;
switch (conditionCountMode)
{
case ConditionCountMode.All:
return (numTrueConditions >= conditionList.Count);
case ConditionCountMode.Any:
return (numTrueConditions > 0);
case ConditionCountMode.Min:
return (numTrueConditions >= minConditionCount);
default:
if (Debug.isDebugBuild) Debug.LogWarning("Quest Machine: Internal error. Unrecognized condition count mode '" + conditionCountMode + "'. Please contact the developer.");
return false;
}
}
}
I thought about removing true conditions from the quest condition set, but maybe you don't always want this behaviour... anyway, is it possible to add a feature like this or should I use custom quest conditions for that?