Hello, so im having a problem with Binding an Event to an Event Dispatcher.
The Event Dispatcher is on my Player’s FSPlayerStats, and is getting called correctly, based on a test, as shown.
Here is a picture of where i am attempting to Bind an Event to the Dispatcher.
Notice, im not able to Bind the event in the HUD Blueprint’s Begin Play, because i must wait for the Rooms(Streamed Levels) to load first. Then once they are loaded RoomsCreated is called correctly.
Then the Event OnDamageTaken in the HUD Blueprint is Binded the the Player’s FSPlayerStats OnDamageRecieved Event Dispatcher.
For some reason, OnDamageTaken is never called, even though it is bound to the Event Dispatcher that the Player calls when taking damage. I know for a fact that the Event Dispatcher is being called because of the test case i built in the First Picture.
Is there a reason that the Event is not being binded? (The Player variable is definitely valid, as i am able to print out variables from it at runtime)
Or is it because im not binding the Event in Begin Play like the test case?(Which i cant do for the HUD, because the player isnt created yet when Begin Play is called for the HUD)
Thanks for taking a look!
There is nothing that prevents you from binding events in the HUD. The target simply needs to exist when binding is done and you need to be able to receive the event when it happens.
I did 2 quick setups similar to yours and it works for me. I bound to OnTakeAnyDamage in my HUD and then on the character every second I had the server deal him a damage. The bound event was called properly. I also used a custom dispatcher in the same manner and that also got called correctly.
There’s a lot going on in your BPs so it could be several things. I would suggest testing the setup I made in your environment and see if that fixes things.
Your right there is a couple of things happening in my BP’s let me try and explain.
I Have a LevelBuilder_BP with a LevelBuilder_BC that lives in the persistent level that loads all required Streaming Levels and then Create’s Instances of them.
At the current moment, i just place my pawn class, Player_BP in one of the Streaming Levels so that when it is loaded, it is possessed and can be played.
So the reason behind me not being able to Bind OnRecieveDamage from the Player variable in Begin Play like most Bind calls would be, I must wait until RoomsCreated is called, from the LevelBuilder_BP’s Event Dispatcher, so once the Rooms are Created, i can then try and find the Player_BP inside of the level, and Bind OnRecieveDamage to my event.
(Also the player variable is definitely valid, as I am able to print its health as it takes damage)
Hope that explains the situation.
At the moment the event is never getting called, so i dont know if it is a problem with Binding inside of an custom event called from a event dispatcher?