Using "cast to" nodes to set score

Hi
So, let’s say that in my player bp i have an event called “add +10 score” that does what its name says, and that i have an event called “death” on my enemy bp. How do i make it so that when the enemy dies, the “add +10 score” starts ? i think i have to use “cast to” nodes, but i don’t think i understand how to use them because that’s my blueprints and it doesn’t work (obviously)

In my player bp :
Capture d'écran_20230328_232652

In my enemy bp :


(Mob_RPG is my Enemy class)

I tried different things but i can’t get it to work :confused:

You want a blue-ish colored node that is “Cast to PBP_Player” not “to PBP_Player Class”. Then you should be able to connect the cast output to your “Add 10” node.

The node you have there is to cast to the UClass which is the reflection/meta data about the class. Not the actual class.

Score should be a value in the PlayerState class.

On hit (how you dmg the player/bot) you pass instigator & owner. You can use these references on the server to apply dmg and then have the server update the playerstate score.

Typically you’d be using “Apply Damage”.

And it will be your “Servers” Authoritative Proxy doing all of this.

I tried using the blue one but there is an error like “does not inherit so the cast would always fail”

What’s “playerstate class” ? And what does instigator and owner refer to ? Im sorry if i sound stupid lmao im completely new to unreal

@Risth Are you making a multiplayer game? If not and new to UE, you may want to ignore Player State, for now.


You want a blue-ish colored node that is “Cast to PBP_Player” not “to PBP_Player Class

This is what was meant above:

Note the Destroy should be called last. Also, start by dragging wires and then search, avoid placing orphaned nodes on their own in the graph if you can:

This will make it easier and prevents a lot of mistakes. If the node you’re searching does not show up, you know something is already wrong.


There are much better ways of doing this, but this is the method you asked about.

Thank you so much, it worked !