Need help with events; C++ and BP

I have tried for so long to wrap my head around events but I am failing miserably and need help. So essentially I will break down what I am trying to do.

As an exercise I am trying to recreate the combat system from FF7. I have a couple different level types (Streets, forest. etc) and I created an ENum to hold these types and when combat is triggered, look at the type of level we were in to be able to know what type of map to spawn me into for the combat sequence. I had two plans for this, one of which is using my already existing function that triggers combat and pass my Enum into it determine what map to spawn but that had complications of its own.

So I decided to use events. My idea was I would have an event trigger in my c++ function I already have that begins my combat. That event would tell something in my blueprint to take a look at the enum and spawn my character in the correct level. But when it comes to declaring events, binding them to something and calling them I have no idea how it works.

I declared my event like so:

DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCombatTriggered);

here as well:

    UPROPERTY(BlueprintAssignable)
    FCombatTriggered CombatTriggered;

And I added what I thought would trigger the even in my cpp:

        CombatTriggered.Broadcast();

I can see my event in my blueprint now. But when it comes to binding and calling I can’t wrap my head around how it works to actually make it work for me.

277313-untitled.png

Sorry if this seem inappropriate but I have tried reading others answer questions, reading documentation on unreal’s websites but sometimes it is easier to bounce ideas off someone, or get an answer for my situation so I can relate the info to something I am actively trying to accomplish and hopefully make it easier to learn because of it.

So to explain it quick once more: Trigger event in c++ → The event will run a series of code in BP.

I sort of figured it out. Since it is in my GameInstance I used the Init event to bind the event at the start of play. Still not entirely 100% sure on how it all works so I would still be ecstatic if someone could explain events to me like im a toddler, but at least this is working now!

You can just use the Assign/Bind Combat Triggered items in the context menu (the one from your screenshot). It will create the required nodes for binding and a new custom event node to handle the triggered event.

To make it work, you should bind the event in the beginning, then add your handler for the new custom node bound to the Combat Trigger.

Another way (which may be easier to use in your case) is to declare a UFUNCTION(BlueprintImplementableEvent) instead of the delegate. You will be able to call this event from C++ the same way as you calling a simple functions, and in the blueprint it will be just a new input node with the declared name, no need for any bindings.