How can I cast or interface from a level blue print to an animation blueprint?

I have a simple system where the level blueprint determines a conversation choice: true or false. If true I want an enemy character to trigger a dying animation (imagine a robot that has been given a self destruct word but a simple true or false in this case,)

I can’t cast to the animation blueprint to allow a transition from neutral to dying, as there isn’t a specific corresponding object type: trying to bring in the animation blueprint as type “object” via a variable only results in a casting failure so far.

I also tried to use a blueprint interface, but so far, the receiving interface does not show a signal from the trigger: maybe animation blueprints can’t use this type of signal from the interface or maybe I’m just not implementing correctly?

The enemy has a working animation blueprint and is of course a skeletal mesh.

Is there another way to trigger this animation change using blueprints?

to access animation blueprints you would need to
get the robot => get it’s skeletal mesh => get anim instance => cast to the blueprint variant of the anim instance => trigger needed changes.

But doing this from within the animation blueprint is pretty bad practice.

It would be better if the dialogue system just had access to the robot actor and trigger the state through an exposed function.

Yes I would much rather have an abstracted function that can trigger the transition:

So that IsDying Function returns boole IsDying so it “can enter transition”
How do I create the exposed function that can trigger the boole pictured?

How can I get the skeletal mesh imported within a manager script,


So that I can use it as a target for Anim Instance like above?

Does my script need to be of parent class Actor to be able to import the mesh?
Having trouble getting down the right process to bring meshes into manager scripts, may be something obvious of course:

is this on the right path?:

Currently the blueprint cannot accept my object type so unsure of how to influence state machine.

Thank you! Appreciate the help.

It should be that the anim blueprint access character (reads character’s variables)>the level blueprint access the enemy character(change enemy character’s variables),like set it’s Boolean to true>and then the anim blueprint will automatically play the animation(because the anim BP keeps tracking variables in the character).
The whole point is that you don’t access anim blueprint from outside (normally),instead,just find the actor that owns the anim BP,and then change actor’s variables.

That seems like very logical pseudocode,

What method should I use to access the characters variables? Should I cast to the character FROM the animation blueprint event graph, then send it to another local boolean to trigger the state change?

ex. On begin gameplay > Cast to CharBlueprint > get DyingVar (type boole) > set LocalisDying (also type boole)

then LocalisDying triggers can enter transition?

1 Like

Yes,what you described is exactly correct.

Appreciate the reply!

MY process is still getting confused here:

  1. What is the best method to define the character blueprint here? In this case I have a casting testing blueprint with skeletal mesh data, however, it is neither a player controlled character nor an AI controlled character. I simply need a placeholder to store the boole flag to signal the dying animation. Attempt on left,

  2. How do I resolve the object type when casting to this other script? I cannot bring a skeletal mesh anim instance in as I get an error message when i try to define the context with a placeholder skeletal mesh variable? Attempt on right,

Thanks!

This is an quick example:



Sorry I didn’t notice this,it doesn’t has to be a character,any actor with the same skeletal mesh component is the owner of the anim BP.

You cast to correct actor.update variables with what it get from the actor. Use them to update animations.that’s the standard workflow.if you want something other then this perhaps I don’t know much .because myself is relatively new.

1 Like

Thank you again! I’ll see if I can adapt this,

Visual example is very helpful


Hmm, what exactly is getting set from the cast to my enemy BP? I can’t seem to replicate your SET node, is this a local variable being set or somehow something from TestActor BP? If a local variable, is the type boolean or TestActorBP?

Hmm, unfortunately, many steps are breaking down. @baobao4435 , if you can kindly share your project file somehow I’m curious why I can’t replicate your set up. The functionality you show is what I am after but I can’t replicate your exact node graph yet,

My project is default template.only your missing is one step.


Sorry for the confusion.
Or you could create a third person template and have a look at the metal person’s anim BP,where shows how to get character’s variables like velocity and so.and with a lot comments in it.

The method isn’t actually sharing information,
It looks like it is set up to but neither string nor boole variable types show any information exchange: there is no way to communicate from my dummy var of type blueprint to my local variable. The only data returned is “display name” which shows as none type.

in particular, I can’t the “target” node to expose so that I can get the dummy varialbe to trigger the local variable.

It works well for the movement component I can see in the template, but it can’t seem to read these data types yet on my end. Are there any tutorials you’ve encountered that can show any missing steps?

“Promote to variable” does two things:create a new same type variable and set it.
here what we do is that
1:at anim begin play get actor and set it to a variable.
2:at anim tick,get variables in that actor,set them all to variables in anim BP.
There should be a lot tutorials online,but I kind of forgot.sorry…
(Btw,set variable means store a new value to it.in my opinion(I mention this because I used to pay times to get understand))