I can't catch events from player controller

I’m trying to catch events from my player controller but it does not works for me.
I’m applying damage to my character using a Line Trace as follow.

And then I’m trying to catch the event from my player controller as follow.

But it does not works.

NOTE: The “PointDamage” event work fine when is catched from my Character BluePrint. But it does not work from the Player Controller BluePrint.

What i doing wrong?
Thank you so much!!

1 Like

I’ve only done event dispatchers with widgets so maybe this is inapplicable.

But, your character should have an event dispatcher called “My Event Name” (in your case probably “take point damage” right after you apply point damage).
your controller is going to want to bind an event to that event dispatcher FROM the character, so you’ll need a reference to character, and you should be able to drag off of them and do bind event to “My Event Name”. (you’ve got self right now in “bind event to on take point damage” and i assume you want this player controller to pick up the event from the character)

dispatcher example from my inventory slot that wants to tell the rest of the inventory that it was indeed clicked

and the inventory subscribing to this event from the slot in begin play, running an event of its own afterward.

2 Likes

I tried it but it didn’t work.

First I created an event dispatcher in my character class (BluePrint) and called it as follows.

Then I bind it in my player BluePrint as follows


and a bunch of parameters were automatically created in the custom event. But it doesn’t run when it’s invoked.

It’s very strange. I’ve never seen this in UE4.

I’m thinking maybe it’s a new feature in UE5… Or maybe it’s a bug.

But when you click one of these buttons

Automatically something like this is created.

4 - Created Automaticly

This has confused me a lot.

Thank you so much for your help!! very appreciated!!

PlayerControllers do not take damage. Characters do. These events exist in PlayerController because they inherit from the common Actor class, but they are not used. Is there any reason you want to use damage events on PlayerController instead of Character?

2 Likes

Hi, thanks for the info, I didn’t know that. I’m a newbie.
I just want to update the health bar.
The health bar is a widget that is inside HUD BluePrint.
I was not able to get a HUD instance from the Character BluePrint.
But I got a HUD instance from the player controller BluePrint.

That’s why I thought to catch the damage event from the player controller.

But obviously this strategy is not feasible. I need to think of another way to do it.

Thank you so much for your help!!

You can do it all from Character blueprint :

2 Likes

Great!! Thank you so much for your help!! :sparkling_heart:

Can i ask you one more thing?

I get a “Cast Failed” when i’m using “Get Controller”. (On Server side)

I tried it using “Get Player Controller” instead, and it “work”, but only on the server side (more o less).

I mean, if the client shoot the server then the server health bar is updated well.

But if the server shoot the client then:
-The server health bar is updated
-The client health bar do nothing

So… i have a controller problem.

Could be because my pawn is really a derived class from “Character Base” class and not from “Pawn” class?

ParentClass
(“Character Base” is derived from “Character class”) it is a custom class;

How can i get the right controller?

Ok, I was able to solve the problem in a very easy way.
First I had to replicate the Health variable (with notification)

And then update the health variable on server

UpdateOnServer
Now all works perfect!! :grinning:

Thank you so much for your help!!!
It was very very useful for me!!
Very appreciated!! :sparkling_heart: