I've Casted to An AI Character's parent, "Cast to Character." What is the object reference for that?

I need to cast to an AI Character. It’s parent class/object is “Character.” Now, it says it’s valid for the character to cast to the Ai Character, but I have no idea what to use for the object reference for the “Cast to Character” Node. The image below depicts exactly what I mean.

https://drive.google.com/drive/folders/1r5yOzPPBbvz-tUXzJCQGJBNvdCT9iR1m?usp=sharing

I’d say I’m pretty good in Unreal Engine, but I’m absolutely terrible at understanding casting.

Casting takes you ‘down’ the inheritance tree.

If you had a character reference, you could cast it to your AI Character.

You could also cast an actor reference to Character or your AI Character.

You need a reference to start with… Casting does not get you the reference.

how would you get a reference then?

1 Like

What are you trying to do? How many AI do you have?

1 Like

I have one AI of this exact character, but I have 10 different ai characters. I only need this one, though. I’m trying to cast to them so I can access and change relationship status values within the ai’s variables.

1 Like

So it sounds like you need ‘get actor of class’?

maybe! I did try that and it gave me an error. If I put the ‘get actor of class’ in the object reference, the casting doesn’t work, and if I remove the casting and just keep the ‘get actor of class,’ I get a runtime error

https://drive.google.com/drive/folders/1r5yOzPPBbvz-tUXzJCQGJBNvdCT9iR1m?usp=drive_link

What I’m saying is, you don’t need to cast. Just get actor. This

looks fine. But if you’re getting ‘none’ errors, it means there just isn’t a BP_AIGibbes in the level.

Do you have one in the level ( map )?

Oh… Oops. I don’t. I didn’t know that was required but that makes sense. I’m having problems adding the character to the blueprint, not sure why… I’ll figure that out, though
Thank you!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.