AI Blueprint Doesn't work after possessing pawn


Hi! Me and some friends are doing this project where you switch between characters on the fly. That all works well but we tried adding some simple AI to a dog character you also can possess. The simple AI movements works well when the scene starts but after possesing the dog and then going back to the human we have the AI stops working. I can still switch back to the dog after and move about like normal.

I can’t for the life of me figure out why the AI would stop even after I stop possessing the dog!

Using tick with provided logic doesn’t really make sense. I’d imagine that tick calls for your delay node each frame and that won’t lead you anywhere. I highly suggest you to use Behaviour Tree for your AI, you can watch a quick and very useful tutorial from Ryan Laley to get into it.

1 Like

Hi!

I did follow the guide you posted, thanks! It works better now but the new problem that is now is after possessing the human again after the dog the dog now wont move to the next spot its supposed to. It spins and faces the waypoint but never walks after being possessed. Again when i start the scene I play as the human and then the AI works as normal.

Any help would be appreciated!

1 Like

Hi. Is it possible that you went outside the navmesh volume?

2 Likes

Easy way to check if you’re in navmesh is press “p” in the level viewport. It’ll highlight navmesh areas in green.

1 Like

Yeah i did but it’s actually still inside the nav mesh :o

Wasn’t reading this post properly before;

I’ve never dealt with this exact situation but working with AI quite a bit I’d assume it’s because the AI is being “kicked out” when you possess their pawn.

You’ll probably want to build a system that allows your character to “request” possession & keep track of the AI’s controller as a reference. This way, the system would gracefully unpossess you & the AI, possess the dog for character for you, & then unpossess you & repossess the AI when finished.

I don’t think it’s getting kicked out relly, mainly beacuse of this. This is the AI controller for the dog. The way I made it the moment I unposses the ai controller and pawn are set to the value from the begin play. :open_mouth:

But I don’t know haha.

Update! I fixed it!!!

What was the fix?


The fix was actually a setup like this, first picture shows the dog blueprint and the second one the ai contorller blueprint. Doing it like this I saved the current ai controller in the main blueprint so I could reasign it over and over no matter if it was possessed or not!

1 Like

Lol this is a ‘quick’ version of what I had suggested, glad you fixed it though.

It works because you’re re-possessing the dog when the player unpossesses it, which means that the dog is being “kicked out” as I’d assumed.

Edit:

Looks like the main issue was actually your BT though. It was in the character and calling “self” at first, which wouldn’t work. When you moved it to the controller it started using the proper references.

1 Like