changing the value of variable

hii I need help with this i want to change the value of variable distance (as shown in pic1) form 0 to 1 when im near to this NPC and want it to go back to 0 when im far away i dont know how to do it inside anim bp, i tried to achive it in level BP and character BP in this manner as shown in pic2 but that is not working, so anyone can help me with that im not much pro in BPs

Hello,
Use the “other actor” output to link to the “cast to” to check if this is the right one. Then drag and set your variable (1 on begin overlap and 0 on end overlap)

sorry bro that didnt work either

You have to set begin overlap event and end overlap in the other actor or if you do the begin / end overlap in your character, cast to the other blueprint (but then you have your variable in your character, not from the cast to )

sorry didnt get u what u meant, if u mean i should make overlap event in my character which im controlling and make a varibale there and cast it to animBP then it also didnt work that way

There is no relation with your anim bp. In one blueprint you set an event begin overlap and use the other actor output to check what is the other blueprint with a cast to. Then you set your variable. If you did event in character, variable is there then you set it. If you did it in the other actor, you drag variable from the cast to output and set it. Then your variable is changed. You can see if it works by using a print string on both events begin and end) if it works but not update your anim then trouble is in your anim.

Edit : overlap have to be done with the actor bp, not the anim one so yes you then have to set variable in anim too from character.

im getting bit confuse can u help me with some pics, just take that blue guy as character and post some pics that how should i setup there

and to make things clear for you i just follow this tutorial to make this and i just now want to change the value of alpha

Hey huxi,

ok so to get my hand on this i need to have some clarification:

You have an NPC and he has an AnimationBlueprint with the “Distance” variable.
And you want to set the variable to 1 as soon as you overlap with the collision of this NPC.

If this is correct, then you will need to do the following:

I called my NPC simply “NPC” and the AnimationBP of him “NPC_AnimBP”.

Inside of my own PlayerCharacter, i went ahead and created the overlap node just by rightclicking into the empty EventGraph and searching for it:

http://puu.sh/h8Vu7/634755b098.png

You can also do this by creating an overlap event of the capsule. Important is the next part.

Either way, drag of the “OtherActor” pin and cast it to your NPC class. Because this is the Actor we are overlapping with.

http://puu.sh/h8Vw5/56a9ba8161.png

Now we want to get a hold of the AnimBP he is using. Wie also need to cast it to our NPC_AnimBP, because this is the
specific AnimBP Class we are using and we can’t get or set the Distance without casting (Because the BaseClass doesn’t know
about this new Variable):

http://puu.sh/h8VDs/4641395c95.png

And now you can simply set the Distance variable:

http://puu.sh/h8VIM/ad3234bf5b.png

And this is all the magic you need. To sum this up: Distance is the float variable inside of the AnimBP of your NPC.
The screenshots are taken from inside the EventGraph of the PlayerCharacter.

Even if your setup differs a bit, you will need to do it somewhat like this.

thank you so much exi it helps a lot its working now, thnx for ur help and effort