Skip to content

Multiplayer Series UE4 [3] – Character

Player State

For replicating correctly health bar we need Player State.

Player State exists in server and every client has their own Player States too.

Create new Player State in GameMode folder.

Open Gamemode and change Player State Class to what you just created.

In Player State add all these variables.

Values that you wan’t to display to client simply set them to Replicated.

Create PawnBegin Event. This will be used when game spawns a new pawn.

UpdateDamage Event.

This should also have Death recording but i’ll leave that to you.

Go to Player Controller and find RetrievePlayerId

At the end of it send Player id to Player State’s PlayerIDCustom variable.

Also go back to GameHUD and add this in Event Tick.

Pages: 1 2 3 4 5 6 7 8 9 10 11
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
Level Paradox
0
Would love your thoughts, please comment.x
()
x