Hey there. I’ve set up a follow function for an AI robot that follows the player around like a pet, which can be possessed to perform tasks that the player can’t do in his normal charachter.
The problem that I’m having is that after I possess and then unpossess the robot, the follow function doesn’t work anymore (even if I set the function to be called every tick or when the robot sees the main charachter), so the robot just sits there doing nothing.
I think that the problem is that the controlls aren’t given back to the AI after the player unpossesses the robot. To fix this I tried having the robot be possessed by “AI controller”, but i don’t know where this controller is found and I don’t think that it references to the follow function in the robot BP. Anyway the bottom line is that it doesn’t work (being possessed by the “AI controller” or not).
NB: currently the follow function is being called by an event tick.
Help would be much appreciated!
When you possess the character, it’s no longer being artificially controller, so nodes like AI Follow To shouldn’t work. Instead, if you want the player to not control the pet character, you can simply add a camera component to the Pet’s blueprint and change perspective that way. If you do want the player to have control over the pet, you can’t control it as if you’re controlling an AI.
What do you mean by controlling the pet character? You wanna control it but at the same time have it move autonomously?
That’s a shame! do you know of any other way to artificially control the pet charachter other than how I did it? Maybe using a behaviour tree? and thanks for the quick answer!
yeah, it would switch off between the two, so the main charachter would go exploring while the robot follows him and then the charachter uses the bot to get into a tight space or solve a puzzle. when thats completed the player unpossesses the robot and the main charachter keeps on exploring with the robot following him again.
Well, then i guess you want to possess the pet when you want the player to control it, and then unpossess it again, and only execute AI functions like AIFollow when the pet isn’t possessed by the player.
precisely my problem because the AI functions don’t work after i unpossess
That’s probably because the AI pet needs to be possessed by an AIController after it gets unpossessed by the player controller
Can just store the AI controller in a varoable and reuse it to repossess