Detain System

UncleFesterson

New member
Hi,

I am having an issue with this police AI detaining system that I am implementing using the Ride and Rideable abilities (I tried making new abilities, but failed miserably thanks to my inferior understanding of scripting). Right now the cop NPCs can “detain” both the player and other NPCs by triggering the Ride/Rideable abilities when their handcuff items are equipped and are within close range of a target. But when the behavior tree runs the next task to have the police AI walk back to their patrol car with the target, both characters just stand there shaking. At first I thought it was a collision issue so I disabled horizontal and vertical collision detection on the detained NPC, yet nothing changed. So I don’t know what to do next unfortunately.
 
My first guess is that the agent is trying to land precisely on the target position so they wobble back and forth. You can fix this by increasing the arrive/stopping distance on the task/navmeshagent.
 
I think I got that part fixed now - the AI cop “handcuffs” the criminal and successfully completes the task. But when it moves to the next task that’s when nothing happens. It goes Start Stop Ability > Follow and gets stuck on the walking back to the police car segment. Both the cop and criminal have the Follow task that activate at the same time if that makes any difference. They rotate toward their target perfectly, but can’t walk at all.
 
Unfortunately this is really hard to say without digging into the behavior tree/code. I recommend just having the follow branch active and seeing if it is something related to the rest of the tree - if the agents can move when only follow is active then you know that it's something else. If they still don't move then I would try another movement task to see if it is related to the follow task.
 
Top