[HELP] Casting from Behaviour Tree decorators & tasks to Blueprints

I’ve created myself a simple ‘SearchPoint’ actor which I can add to levels and provide AI with extra information with, including the names of nearby SearchPoints.

However I want to check for that information in the Decorators and Tasks of the AI Behaviour Trees. For example, I may want to randomly choose from all search points connected to the closest one, then send an AI character to that new search point.

I don’t seem to be able to cast anywhere in the BT but the Root Service, and in there I’m only able to cast to my SearchPoint class, rather than a specific actor in the level.

Does anyone know of the best way to handle this?

in there I’m only able to cast to my SearchPoint class, rather than a specific actor in the level.

There’s no such thing as casting to a specific actor. If you mean using specific actor references in BP this is not possible in BT elements since they’re not level-bound. It’s not like LevelScript, where you can put any actor’s reference. BP implemented BT nodes are classes and as such are guaranteed to work the same regardless of the specific game map.

Let me know if you had something different in mind.

Cheers,

–mieszko

Thank you, I’ve finally understood the logic behind casting last night - Epic’s tutorials are great for telling you what to do, but need to explain more about what’s going on under the hood in them.

Anyway, I’ve found a way to do, for now, this by getting actors of class in the AI BP and adding them to an array, then for each of them, casting to their class and getting data from there.

It’s not the optimal way of doing it but it’s a start :slight_smile: