Jump to content

AI Package won't repeat


Recommended Posts

I have an AI Package for a guard. I want him to do a patrol but to light or extinguish various candles and lanterns on the way, depending on the weather. That's working fine. The Procedure Tree goes like this:

Sequence
   Procedure: Patrol
   Sequence
      Procedure: Activate
      Procedure: Activate
      ...activate triggers to light or extinguish flames depending on the weather
   Procedure: Patrol
   Sequence
      Procedure: Activate
      ...
   Procedure: Patrol
   ...


The Patrol procedures are there because once all the "lights" are taken care of, I need the guard to do his regular patrol without any of the Activate procedures being valid. Activate does move NPCs from one location to the next, but once all the lights are turned off it's sunny, there's nothing left to activate. So, without the Patrol procedures, the guard just stands there (unless the weather changes) once dealing with all the lights the first time.

I have another package with the same structure for an NPC who chops wood at a chopping block for 30 seconds. Each time that idle times out, it runs through a Procedure Tree just like the above where various woodpiles are checked to see if they need refilling (if the player character took any wood, which I added the functionality for), and goes off to refill the woodpiles that need it.

That works fine with the same structure. He chops wood, which I get going with a Patrol procedure to the chopping block. It times out every 30 seconds, the woodpiles are all checked and refilled if necessary, then the package repeats, so the NPC goes back to chopping wood again.

I have all the "Repeatable?" flags set to TRUE in the light/extinguish candles package with the same structure, but it never repeats. It runs from from top to bottom and everything works fine, but it won't repeat no matter what I try.

Has anyone else run into this? I've tried changing all the Patrol to Travel procedures, but the package still doesn't repeat.

Link to comment
Share on other sites

  • 2 weeks later...

Just making sure you are aware of the "Repeat When Complete" checkbox at the very top of the stack, assuming its a stack or sequence. Repeatable within a specific sequence, just means it will repeat if you use another flag to make them re-review their AI

Link to comment
Share on other sites

Just making sure you are aware of the "Repeat When Complete" checkbox at the very top of the stack, assuming its a stack or sequence. Repeatable within a specific sequence, just means it will repeat if you use another flag to make them re-review their AI

Thanks very much for responding, Sphered. That's what it was. It's always something tiny like this. It's why we overlook the little "bugs". 😊

 

For clarity, what was missing was right at the top of the Procedure Tree in the very first Sequence branch:

 

Sequence  <-- Didn't have 'Repeat When Complete' checked
   Procedure: Patrol
   Sequence
      Procedure: Activate
      Procedure: Activate
      ...activate triggers to light or extinguish flames depending on the weather
   Procedure: Patrol
   Sequence
      Procedure: Activate
      ...
   Procedure: Patrol
   ...

'Repeat When Complete' is in the box to the right under where the type of branch (Sequence in this case) is selected.

 

I'd initially ticked 'Repeat When Complete' in all the Sequence branches (after I saw Sphered's response) thinking that all of them needed to be set to true for the package to repeat fully.

 

But that caused my guard to get stuck. If you tick 'Repeat When Complete' here, for example:

 

Sequence <---------------------
   Procedure: Patrol
   Sequence <---------------------
      Procedure: Activate
      Procedure: Activate
   Procedure: Patrol
   ...

On both branches, the second Sequence branch will repeat right away. In this example, it means the Activate (one is for good weather, one is for bad) will be completed but the Actor will stay in that position. The Sequence repeats right away.

 

So, I unticked 'Repeat When Complete' on all branches (Sequences in my case) except the first one. It was just that the very first Sequence branch was missing 'Repeat When Complete' that was causing the package to finish and just sit there.

 

Thanks again, Sphered. I appreciate your help with this.

Link to comment
Share on other sites

I completed more testing and everything is working fine now. It's set like so:

Sequence  <-- 'Repeat When Complete' IS checked (set true)
   Procedure: Patrol
   Sequence   <-- 'Repeat When Complete' NOT checked (set false)
      Procedure: Activate
      Procedure: Activate
      ...activate triggers to light or extinguish flames depending on the weather
   Procedure: Patrol
   Sequence   <-- 'Repeat When Complete' NOT checked (set false)
      Procedure: Activate
      ...
   Procedure: Patrol
   ...

It works fine in that the Sequences after the first one do repeat if the weather changes. I have the 'Activate' procedures configured with a simple condition on each that checks for clear skies (extinguish lanterns) or not clear skies (light lanterns).

The package repeats due to 'Repeat When Complete' being set to true on the first Sequence branch. But even though 'Repeat When Complete' ISN'T checked (is set false) on any of the other Sequences, all the Activate procedures in all the Sequence branches after the first one do repeat.

I'm not sure why that is and behavior may be different depending on the type of branch.

I was also curious, initially, why the package that causes an NPC to chop wood (via a Patrol to a chopping block idle) at the top, then, if various woodpiles need refilling, which is handled by other logic elsewhere, that NPC stops chopping wood (the chopping idle times out every 30 seconds because I set that in the properties of the chopping block idle) and goes to refill the woodpiles.

That's handled by Activate procedures too and that package was repeating fine and I couldn't figure out why. But it had 'Repeat When Complete' checked in the top Sequence branch and I didn't notice it.

So, all the mysteries have been solved, other than that I don't understand of what use 'Repeat When Complete' is on a branch that isn't at the top of the package.

If that's set to on/checked, the Sequence repeats right away and it causes an infinite loop. The only way I can see to get out of it is by checking 'Success Completes Package', but that'd (probably) end the whole package, so again I'm not really sure of what use 'Repeat When Complete' is other than on the first branch. 🤷🏼‍♂️😊

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...