# How do I BPI pass a variable in Anim Notify to Char BP? \[How to Hit trace in Anim Montage\]

**URL:** <https://forums.unrealengine.com/t/how-do-i-bpi-pass-a-variable-in-anim-notify-to-char-bp-how-to-hit-trace-in-anim-montage/1144800>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [April 26, 2023, 9:01am UTC](https://forums.unrealengine.com/t/how-do-i-bpi-pass-a-variable-in-anim-notify-to-char-bp-how-to-hit-trace-in-anim-montage/1144800 "2023-04-26T09:01:32Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![XxNotAGamerxX](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@XxNotAGamerxX](https://forums.unrealengine.com/u/XxNotAGamerxX)\
**Post date:** [May 4, 2023, 3:30am UTC](https://forums.unrealengine.com/t/how-do-i-bpi-pass-a-variable-in-anim-notify-to-char-bp-how-to-hit-trace-in-anim-montage/1144800/9 "2023-05-04T03:30:52Z")

</div>

@illspiritx @Rev0verDrive ok thanks for the replies.

- [I’ve been reformating my code to post. Encountered a problem, so I made a new thread on that specific topic (it also shows my setup pics for what I explain below).]

> [How do I split AddUnique array - to Play Anim Montage once per index?](https://forums.unrealengine.com/t/how-do-i-split-addunique-array-to-play-anim-montage-once-per-index/1153758)

@illspiritx made good points to consider. So I will clarify what I want to do:

1. I have 90% of the Attack code in Player Character BP (while AI character is a child, thus uses the same logic).

2. I want the brain/logic driven by the Player’s CharBP - meaning when I press a key, it triggers the code in Player’s Char BP (not AI BP).

3. The reason is that I am using a DataTable to set 10 vars related to the Player’s anim montage to play, the Target’s reaction anim to play, the distance required, etc.

4. But for #3 to work in my Player’s CharBP, I have a Hit Target var, which I need to set.

- Update: _I no longer wish to get this Var from the constant Tick-Hit [Notify State] (that is in the Anim Montage of my Player’s attack)  
\*\* old: From NS, I used to wish to pass the Hit target Var \> to my Player’s CharBP \>  
\*\* then I pull the same DT row (that chose the Player’s anim montage) \>  
\*\* to get the matching Target reaction montage \> and thus [Play Anim Montage] on Target enemy, from within Player’s CharBP code._

1. #4 is very complicated and my CharBP is getting slower to compile, save, make backup copies. Thus I wished to use the NS hit code to Compartmentalize my code changes (makes it easier to backup, duplicate a NS asset instead of CharBP).
2. But _[Pro to put the Hit code in CharBP]:_@illspiritx is correct about “adding new notify states would just be a matter of duplicating and changing the attack type var.” Now I use DataTable to feed the different Hit Bones to use for each attack \> into the Hit function in CharBP [Pic 6].

- But _[Con to have one NS that handles all, and ‘change attack type’]:_ Is that I dont know how to feed the [NS tick Function] a variable? “Received Notify Tick” is an Epic Function, and they dont let me add Input pins?

* * *

- Update: now I need to know how to BPI send a Var from CharBP to NS?

1. Update: I posted my code pics at the link above. I’ll paste here for ease:

[Pic 0 below - the BPI setup now]

 ![0 BPI Input setup](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/0/c/f0c2a1420768a49ec227f9ccb3ef5bcda3b893b5.png)

[Pic 1 - Anim Montage contains the Anim Notify State duration]

 ![1 Anim Montage - ANS duration](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/b/1/9b104396aec1f9477b6ae92df0534d335aa096e2.png)

[New method: Pic 2 - ANS that calls BPI Event in CharBP - no var transfer needed, just call Event.]

 ![2 ANS - calls BPI in CharBP](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/f/9/3f96f2204016d5d79278e426bedd1462a6f21bb5.png)

[Pic 5 - CharBP where BPI event was triggered to start by ANS]

 ![5 CharBP - BPI Event called - go in Hit Function next - then out to Play montage code](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/3/f/13f2b3d3c2b9fce2a07a1e39d8f8d357a5a4234f.jpeg)

[Pic 6 - Hit function]

 ![6 Hit function in CharBP](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/9/8/4987fc3d31067aced0cef104b66024f3f4b9ba44.jpeg)

---

_[View the full topic](https://forums.unrealengine.com/t/how-do-i-bpi-pass-a-variable-in-anim-notify-to-char-bp-how-to-hit-trace-in-anim-montage/1144800)._
