# BP interface question

**URL:** <https://forums.unrealengine.com/t/bp-interface-question/504528>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE4-27, Blueprint, question\
**Created:** [March 6, 2022, 8:30pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528 "2022-03-06T20:30:12Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [March 6, 2022, 8:30pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/1 "2022-03-06T20:30:12Z")

</div>

Well, Generally, I’m trying to replace all BP casting with BP interface, some of the stuff I’ve replaced already.  
Now I’m trying to do the same with my projectiles that cause damage. I replaced part in player BP like that. Projectile gets HP and then changes it - works well.

 ![UEbpi1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/4/0/e40976efc856d7a8e78af33578d3e132ff9f4152.png)  
But when I’m trying to do the same with enemy BP - it doesn’t work at all.

1. Do I need to make unique BP interface functions for the enemy BP?
2. How does it work with multiple enemies? I suppose that all of them will send their HP to each projectile, am I right? How it can be handled?

Thanks for any advice

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 6, 2022, 8:41pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/2 "2022-03-06T20:41:46Z")

</div>

Actors have this built in already:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/b/f/dbf368b8fa0352cfc188ddb4beae3df2e8a0dff3.png)

And damage type classes, too. Essentially, any actor can apply damage and any actor can receive it. No need for extra BPIs.

---

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [March 6, 2022, 8:45pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/3 "2022-03-06T20:45:45Z")

</div>

I made a custom damage system  
Is there a way to use the BP interface for this purpose or do I have to use this built-in system?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 6, 2022, 8:55pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/4 "2022-03-06T20:55:03Z")

</div>

You can use your own. The BPI is implemented in the actors receiving damage. When the projectiles hits them, it sends a message to that actor.

> Projectile gets HP and then changes it - works well.

I don’t understand this, can you explain? And special mechanics behind this?

---

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [March 6, 2022, 8:57pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/5 "2022-03-06T20:57:08Z")

</div>

But the question if I want to do such things that aren’t connected with the damage system, how can I do it with multiple targets, how to identify them to send/receive data properly

---

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [March 6, 2022, 9:00pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/6 "2022-03-06T21:00:14Z")

</div>

> [@Everynone](#):
>
> I don’t understand this, can you explain? And special mechanics behind this?

Yes, of course  
Here is part of my BP projectile  
The top line works for enemy BP  
The bottom line works for the player BP

 ![UEbpi2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/a/f/2afa21dca7a96d3aaf3c0efaedb3cf7702c1eeb0.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 6, 2022, 9:00pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/7 "2022-03-06T21:00:49Z")

</div>

You get actor references when projectiles hit actors:

- the BPI:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/9/4/e94e2884743b95e76c188fe527ac8f85f56a79ea.png)

- the enemy implementing the interface:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/4/a/f4a640d94f8811fe4af92c63b70e8aa8c9ff793f.png)

- projectile hitting stuff:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/6/9/969e12a476ebedbfa1d26ad2f3ec733589216fb0.png)

* * *

I would not pull out the Health out of the enemy, modify and set it. The enemy can handle its own health.

---

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [March 6, 2022, 9:05pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/8 "2022-03-06T21:05:37Z")

</div>

In my case it’s AOE damage, in this case I don’t have one target  
I tried to replace cast to the BPI and it doesn’t work for enemies  
It works well for single player BP

 ![UEbpi3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/b/d/abdc86903558adcf99d2c501c2bcaaa31b0c2bb5.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 6, 2022, 9:08pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/9 "2022-03-06T21:08:34Z")

</div>

You can use the built-in system:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/1/5/415724e53841438d407d12614ece3388f03c1f93.png)

Or your custom system:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/6/3/763386506668f55b019cc9afe3353dffc9ec9370.png)

_the falloff math needs to be better in my example_ 🤪

Here the projectiles have an overlapping collision sphere - anything trapped inside when it hits (whatever it hits) is sent a message, here filtered to one class only.

---

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [March 6, 2022, 9:11pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/10 "2022-03-06T21:11:46Z")

</div>

Thanks, I see that you did it in opposite way - you are sending damage from projectile and than in the pawn you are decreasing health.  
Will try your approach, hope it will work

---

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [March 6, 2022, 9:26pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/11 "2022-03-06T21:26:31Z")

</div>

It works only for one enemy

 ![UEbpi4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/9/6/796725803a9fa7cdaa9ba19954d0e64498dadaad.png)  
here is the code in the projectile  
 ![UEbpi5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/7/e/47e433362e6a608372b73274a6d436ca4b14341d.png)

---

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [March 6, 2022, 9:34pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/12 "2022-03-06T21:34:22Z")

</div>

Oh, I probably found the reason, by no reason, get all of actors of class gives only BP\_TargetPawn2

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 6, 2022, 9:38pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/13 "2022-03-06T21:38:51Z")

</div>

> [@Yaklakootmaa2](#):
>
> get all of actors of class gives only BP\_TargetPawn2

Why would you even use Get All here? is the goal to really hit ALL actors or the ones affected by the area damage only? it may be intended, I just hate the node for my own private reasons 😉

How many actors of BP\_TargetPawn2 class are in the scene? It returns what’s in the filter.

* * *

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/1/ea14ecb9b46e88c8ffdef10e7201f180e7aa8ef6.jpeg)

If you’re trying to hit stuff in range, use a sphere overlap, much more efficient than iterating and then discarding other actors based on range.

---

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [March 6, 2022, 9:44pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/14 "2022-03-06T21:44:43Z")

</div>

I don’t know alternative way. Yes, I’m trying to hit anyone in AOE, so I decided to get all actors and then check the distance from the position where projectile was blown.  
For now I have 2-4 enemies for testing purposes.

The strange thing, If I call the same inside player BP it gives me all BP\_TargetPawn, but in the case of BP\_Projectile it gives only one of them

 ![UEbpi6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/2/a/02ad8629c5880c32b98fc5848e16de81f9da84ac.png)

> [@Everynone](#):
>
> If you’re trying to hit stuff in range, use a sphere overlap, much more efficient than iterating and then discarding other actors based on range.

Thanks, will try

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 6, 2022, 10:02pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/15 "2022-03-06T22:02:54Z")

</div>

Also, in case you ever decide to revisit the native system, it has a falloff version with damage prevention channels:

> [@Radial Impulse to ignore specified actors](https://forums.unrealengine.com/t/radial-impulse-to-ignore-specified-actors/491573/2):
>
> Here’s a cheeky idea. We’ll be dealing damage instead: we deal radial damage will falloff on click Damage Prevention Channel is set to World Static the wall’s object type is set to World Static as well, it will prevent all damage [353495-staticwall.png] upon receiving said damage, the physics simulating actor does this: untick Vel Change if you want the mass of the object to be taken into account; if you do, you’ll need to crank u…

So you can have obstacles absorb damage _automagically_ without excessive tracing.

---

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [March 6, 2022, 10:07pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/16 "2022-03-06T22:07:22Z")

</div>

It sounds interesting, I’m going to rework AOE, earlier missed that it doesn’t work with multiple targets and still don’t know why get all actors of class doesn’t work properly for projectiles, I checked, for each loop node never completed

---

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [March 7, 2022, 8:35pm UTC](https://forums.unrealengine.com/t/bp-interface-question/504528/17 "2022-03-07T20:35:53Z")

</div>

Finally made this.  
Overlapping works well, also found the reason why I didn’t get full list of actors by using GetAllActorsofClass - it’s because Loop Body was connected with function return node.  
So, now code is clean and compact  
BP\_projectile AOE function

 ![UEbpi7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/9/2/a922cc6df73406a0c55d356d6e8255a40fa4a7f4.png)  
BP\_projectile event graph  
 ![UEbpi8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/f/9/8f9d28e5c535675a76ab22d46e3088fc86675512.png)  
Event for player and enemy pawns  
 ![UEbpi9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/d/d/4ddd69403a8cb1ff594de01d2ab6580cda4dbab4.png)
