I believe my problem is the engine wants me to specify what instance of my NPC character blueprint to cast to, but I cannot specify because I want what I’m doing to apply to all members of this class. For example, Animation Blueprints.
When it’s the player character, I can use the “get player character” node to specify. On NPCs, I’ve tried “get owning actor,” “get owner,” “try get pawn owner,” and nothing seems to work.
Do I need to cast to a blueprint class instead? I haven’t used this before and I’m not sure how it works and I’m unable to find help with it yet.
Casting is the same, you can use a base class to do iperations, such you can have all your npc character classes extend a class called base npc with the functions on it that are common to all.
You describe what you are trying to cast to, but you dint say what you are trying to cast, it actually has to be the object you want for it to succeed. So in the level a trigger will activate on a character probably, you can cast that actor to your base npc character class. Or on a projectile hit in the projectile graph cast the hit actor to the npc base class etc.
I’m trying to make this animation blueprint work for a non-player character blueprint. I need access to boolean variables inside this blueprint to control which animations are fired when. I have no trouble setting this up for the player character.
I would also like to know the answer to this question as it sprung up on me recently where I needed an animation blueprint, but the actor I was applying it to was derived from “Actor Class” and not “Character”. I could not find a way to get a handle on the owning actor through the animation blueprint at all.
Casting to the correct class is not the issue at all, as we know exactly what class we want to cast to. The problem is what actor are we trying to get a handle on before we do the cast? There is no generic “Get Owner” in animation blueprints and since it’s not a Pawn, “Try Get Pawn Owner” returns nothing.
In the end, I bypassed the problem by just making the class a child of Character. This added a movement component and other aspects that are simply a waste of process.
FYI, what I created was an animated door. If your question is “why don’t you just rotate it?”, the answer is “It doesn’t rotate, it smoothly scales a bone”. If your next question is “why don’t you do that in the blueprints?”, the answer is “You can’t”.