How to cast a variable from an actor to a character, in order to play an animation?

Hi. I have a problem. I have an actor blueprint in the scene, called Flower Blueprint.

Around that mesh, there is a collision box. When player enter that box, ,Is Player Close" variable is set to true, and input for that blueprint is enabled. When he exits the box, the variable is set to false.
If the variable is true and F key is pressed, then the flower light visibility is set to false, so it is not seen anymore.

Now what I’m trying to do is if I press F and , Is player close variable" is true, the character should play a picking up animation, and after that the flower light becomes invisible. Also, the character does not get frozen at the end, and Locomotion state blends back at the end of picking up . The input is also disabled, so while animation runs, the character cannot move.

Now the question is- how to bring , Is Player Close" variable into the character’s state machine in order to play picking up animation ?


Casting First Try

In the actor blueprint, I have tried to cast to character blueprint so it could play an animation. At first, it worked, but character froze at the end. After I changed the ,Play animation node’’ with a ,play montage’’ one, and put the animation into an animation montage, then changed back to a ,play animation node’’, it isn’t working anymore.

Casting Second Try

In the second try, I have tried to go the state machine route. Inside EventGraph, have tried to cast to the actor blueprint, so I could get , Is player close" variable from there, to make it available inside the state machine. I don’t know what object to link for this to work.

The character general set-up is similar to the default one.

How could I solve this problem. Could you help me please ?

Hello

Let me see if I understood, you are trying to cast to your flower to get the variable in it, but you can´t cast because the cast node doesn´t have an object of origin?

If this is the problem, try to use the nodes: “GetAllActorsOfClass” + “Get” and hook from the get to your object in the cast (actually, you probably will not need to cast anymore, the get node will do the trick)

see it here:

I’m actually trying to do the reverse. I wish to get a boolean variable from the flower blueprint , and use it in the Character’s animation blueprint, more precisely in the event graph.The variable is called ,is player close". This way, I could make that variable drive a state inside the animGraph.
I wish to make a similar set-up like in this video:
link text
But instead of getting the variable from the character blueprint, get it from the flower blueprint.

Hi. Thanks for your reply. I have tried what you suggested in Event Graph, and it seems that it works, the character animates, but only for a single blueprint (Flower) placed in the scene. If I place more flowers from the Content Browser to the scene, for them, the light becomes invisible on interaction as intended, but the character won’t animate. How could I solve this ? here is my set-up. Could you help me please ?

http://s17.postimg.org/6ktidecnz/biggest_issue_1.jpg

http://s11.postimg.org/c35ess3jn/biggest_issue_2.jpg

http://s28.postimg.org/mfcog4tdp/biggest_issue_3.png