There's something wrong with the subtraction of counters

Announcements, support questions, and discussion for Quest Machine.
Post Reply
startfromzero
Posts: 8
Joined: Fri Jan 14, 2022 6:17 am

There's something wrong with the subtraction of counters

Post by startfromzero »

I set up a counter for a task that uses messages to add or subtract. "Modify by parameter" is used to set the conditions for receiving A message to increase by 1 (the parameter is 1) and receiving B message to decrease by 1 (the parameter is -1). The initial value is 1 and the condition is reduced to 0 or below. The increase was fine, but the decrease never took effect. I changed "modify by parameter" to "set to parameter" and the condition passed.

I checked it so many times that I didn't know what was wrong, and it bothered me.
startfromzero
Posts: 8
Joined: Fri Jan 14, 2022 6:17 am

Re: There's something wrong with the subtraction of counters

Post by startfromzero »


I found that if the automatic start parameter is the same as the one set in the counter, the task will increment the count at the same time it starts, which is not what I want. What I want is for the first message to trigger the task to start and for the messages after that to increment the count.

I need some help
User avatar
Tony Li
Posts: 21928
Joined: Thu Jul 18, 2013 1:27 pm

Re: There's something wrong with the subtraction of counters

Post by Tony Li »

Hi,

Is this your current question?
startfromzero wrote: Fri Jan 14, 2022 7:50 amI found that if the automatic start parameter is the same as the one set in the counter, the task will increment the count at the same time it starts, which is not what I want. What I want is for the first message to trigger the task to start and for the messages after that to increment the count.
If you have other questions about this, please let me know. For now I'll assume your question is that, when the quest automatically starts, you want the counter to start at zero.

To do that, add a Set Counter Value action to the quest's States > Active > Actions to set the counter value to zero. If you prefer, you can add the Set Counter Value action to the Start node.
startfromzero
Posts: 8
Joined: Fri Jan 14, 2022 6:17 am

Re: There's something wrong with the subtraction of counters

Post by startfromzero »

If do this, the mission is an immediate success.Because the conditions for success are zero or less.
To avoid immediate success, I set the initial value to 1.what I want is that counter to start at 1.And I tried what you said, and it still didn't work.
Looks like "Set Counter Value to one" was executed first,then increment the counter.So it's still going to be 2.
User avatar
Tony Li
Posts: 21928
Joined: Thu Jul 18, 2013 1:27 pm

Re: There's something wrong with the subtraction of counters

Post by Tony Li »

I'll give this some thought and get back to you. It's an unusual setup.
startfromzero
Posts: 8
Joined: Fri Jan 14, 2022 6:17 am

Re: There's something wrong with the subtraction of counters

Post by startfromzero »

look forward
User avatar
Tony Li
Posts: 21928
Joined: Thu Jul 18, 2013 1:27 pm

Re: There's something wrong with the subtraction of counters

Post by Tony Li »

Hi,

Import this package and add a "Reset Counter" quest action to the Start node's True section:

QM_ResetCounterQuestAction_2022-01-15.unitypackage

Select your counter and set the value to 1.
Post Reply