Conditional Abort Condition Evaluation Question

slipyfrog

New member
Hello,

I hope you are doing well! Just a quick question on conditional aborts.

Is there away to detect if a condition is being evaluated as part of a conditional abort?

For example:


Code:
public override TaskStatus OnUpdate ()
{
   if (m_ActivateStuff)
   {
     if (!IsBeingEvaluatedFromConditionalAbort()) //-- ensure we only reset the flag when running outside of conditional aborts evaluation
     {
        //-- Reset flag
        m_ActivateStuff = false;
     }
    
       return SUCCESS;
   }
  
   return FAILURE;
}

The problem I am having is that 'm_ActivateStuff' is being reset on the conditional abort evaluation. When the tree is run after the conditional abort, the condition returns failure. I can work around but this would be cleaner.

Thanks in advance!
 
Is there away to detect if a condition is being evaluated as part of a conditional abort?
There isn't a direct way, but you could set a flag within OnStart/OnEnd and then determine if you are within a conditional abort. For example, the flow would be:

OnStart // Set flag
OnUpdate // Regular Update
OnEnd // Reset flag
OnUpdate // Reevaluate
OnUpdate // Reevaluate
 
Top