How to have two Character connect to one event actor begin overlap? ( Blueprint)

Hi, For my game, I have two Character and I want them to die when they hit a cube in the level. However, since the event actor begin overlap blueprint is only able to connect to one character, I can’t connect both of them to it. Is there a possible way that I can connect two people with the event actor begin to overlap blueprint and connect to my death function. Thank you. If you can, can u maybe show me a picture of the blueprint?

Hi,
so you want both Characters to die, if only one of them touches the cube?

In that case, put the logic in the Cube, not the character. Let it check if it hit a character and then you can use an Event Dispatcher.
The Characters are “listening” for that event to happen and will fire an event, that is bound to this dispatched Event.

Video example how it is done here:


Read here:

Recommend you watch this:
Blueprint Communications | Live Training | Unreal Engine

In this stream Zak demonstrates besides hit or overlap events also Event Dispatchers and Blueprint Interface, that are good to know about.

Good Luck!

Hello rryisthebest2,

It depends on how you set up your map and your characters, but you could store the references to both characters in the object being overlapped before the overlap occurs. That way you would just need to determine if the correct type of actor overlaps and call your death function. You can use “Get All Actors of Class” to grab all the actors you want to kill before or right before you want to kill the actors.

From,

Hi, I want to make exactly what u have said. I have two characters, and if one of them hit the cube and died, both of them is gonna die. However, I am not sure how to do that by using the event dispatcher. I saw the video but how can I make them both died. Can u maybe show me an example of how to perform that blueprint? Thank you.

, how did u create the On component begin overlap box?

It’s a box collision component inside the character/actor. Select it and scroll down to the bottom of details on the right hand side and you should get that event there.

, Do I replace the death with my death function?

and do I just use the top or both the top and bottom blueprint has to be used?

How did u create the reference of the two overlap actor and where can I find the cast to overlap actor?

Hello rryisthebest2,

None death functions do anything. It is just an example of where you can call it. How you plan to kill your characters and the details therein are up to you.

You could use either the top example or one of the bottom examples. The top example shows one way to get the references, but there are other ways.

OverlapActor is just a blueprint I made. You should cast to whatever actor you are using as mine was just named to demonstrate the concept. Eg. create a blueprint called “ExampleActor” and try to cast something to ExampleActor because the engine will create the cast function if the class exists in the engine.

From,

Blueprint Communication: https://docs.unrealengine.com/en-US/Engine/Blueprints/UserGuide/BlueprintComms/index.html

General Blueprint Information: Blueprints Visual Scripting in Unreal Engine | Unreal Engine 5.2 Documentation

Hey there,
all the information is already there, provided by .
To be able to cast to something you need to create it first. In this example Overlapping Actor is the character you’re playing, and the second one you want to destroy at the same time.
When an actor overlaps the collision box component, you cast to Overlapping Actor, then you get reference to all of the actors of this class (if cast was successful) and store them in an array. Then you run a loop and call death function for all the actors of that specific class.

Bottom part is essentially the same thing, but you are storing the reference to both characters before the collision occurs. That way you would just drag of the cast success and run your death function.

I suggest you check out some tutorials so you can get a good grasp of the basics.

, but I have two characters, how can I make the engine kill both of them at the same time?

because, the on component begin overlap has only one exec node, but I need to cast to two characters.

by the way, , where do I suppose to put the blueprint in? Is it the cube or the character blueprint?

Can anyone teach me how to create the cast to actor overlap part
, I am confused about how to make that because I have two characters.

Thank you for helping me, guys

In get all actors from class select ThirdPersonCharacter. Connect Array element with target on death note.

This is what happens now, I have two characters but I can only cast to one of them and the death function seems to have an error as well. It said that object actor can not connect to person 2.

I solve it, I found another really easy way to do it

1 Like