I may be overthinking or underthinking this....

So I am making a simple shooting game.

Right now I am using the same character blueprint for every player (which allowing different characters stems from this questions).

Its a simple shooting game, but I am unsure how to make each player get a point when they kill someone?

Right now I have a branch test that compares of the player id that dies and give a global team point to the other player. However right now it gives a point wether the player died from getting hit with a projectile, or walking over fire. How do I track who killed which player and how to give the point/score to the correct player? ::scratches head :: Right now my code is a mess because i am testing different solutions but I am sure i am missing something…

So far I have the score being tracked in the GameMode.

The apply damage is on the projectile.

The receive damage and The player score is kept on the character blueprint.

This is my first real attempt at anything Multiplayer, so my knowledge has solely been single player and never ran into multiple HUDs and replication stuff, so please be patient and kind with me.

Hi man,
One way to do it could be:

Add a playercharacter variable to the thing that does damage, Bullet, Arrow, Beam…
When your player/weapon spawn something, set the variable to the player who created it.
When a bullet kill someone , check who is in the variable, and give point to him

Ahhhhhhh Okay I forgot about passing the variable on the spawn projectile.

So Something like this so far?

Now the last part is where I am stuck, how do i send that player the point? Through a cast? Where should the point be held? The player controller? The Character Blueprint? or the game mode?

the “GameMode” is a good place where share all the scores,
the players should read all the scores there, and so the game should upload the points up there!

If you plan to have any sort of widget you should send the point to the players too,
so he can properly show to the player

This concept is called the “instigator” in Unreal speak, and there’s already some support for this in the existing classes.

awesome!!! this makes sense and really helps clarify the logic for me. i will pass the point to the game mode and save it on an individual variable for each player via an update event and then trigger an update on a variable in the player. Thanks!

I will have to read up more on this Thanks!

I am stuck on getting the player ID from the damage causer or instigator output pins. Any idea? I got the scoring system up using a check for player id that gets sent to the custom event in the game mode base, but i cant seem to get the player id from the receive any damage

SO I just noticed that when I pass the player ID of the Instigator type I am getting the literal name of the player as being the “character name”

for example the character blueprint I am using is “Moto_Man” when link from instigator to the Player State-> Player Id I get back either “Moto_Man” “Moto_Man2” “Moto_Man3”… How Do I just get the player controller Id of “0” “1” “2” etc?

172Th Attempt

I now added each player controller to an array at spawn

I then got the display name from player state sending that to an update score section where I compare an array of players, which was previously created, comparing teh display name coming in with the display name of each array index. lets see if using this will help LOL

:Fingers Crossed:

So I have Isolated the issue I am having. As Per Est_Engine said I am passing the variable of the actor who is shooting the projectile in the spawn actor function.

I am passing and saving that as a variable in the Projectile blueprint.

I am plugging the passed variable info of Damage Causer

So I believe I did it exactly how oyu said but for some reason, it doesn’t pass the info into the variable. Do you have any images of blueprints?

Here is what I have, but it never transfers ANY info… Display names, Controllers are always blank. What am I missing?

My personal preference is to store score, health etc in the Player State class. Update the Game State’s player state values via Game Mode, then replicate the changes to the specific player directly.

Get Game State → cast to GS class → get player array → for each loop with break → use the player ID to compare branch → cast to player state class → Set value … call replication event → break

additionally I have each player get an update of the game state at a set interval (1 sec).


I am an idiot!!!

I accidentally had the ENTIRE projectile firing script in 2 places. I Was triggering it with an animNotify in the ABP and I had it firing in the Character Bleprint.

The one in the animNotify Was running PRIOR to other programming additions, but was overriding ANYTHING I was doing!