# Question about playerstates

**URL:** <https://forums.unrealengine.com/t/question-about-playerstates/28257>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [April 24, 2015, 5:25am UTC](https://forums.unrealengine.com/t/question-about-playerstates/28257 "2015-04-24T05:25:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_7a972e90](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7a972e90](https://forums.unrealengine.com/u/anonymous_user_7a972e90)\
**Post date:** [April 24, 2015, 5:25am UTC](https://forums.unrealengine.com/t/question-about-playerstates/28257/1 "2015-04-24T05:25:52Z")

</div>

Now, if i understand correctly, playerstate is used to keep track of value for a character(one for each character if multiplayer), suck as name, score, etc.

How do i make my own player state?

I want to create a player state that extends(i think) the current player list so it still has all the other information, but i want to create my own so i can add other things like health and mana. So how do i go about making this?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_741503d3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_741503d3](https://forums.unrealengine.com/u/anonymous_user_741503d3)\
**Post date:** [April 24, 2015, 6:13am UTC](https://forums.unrealengine.com/t/question-about-playerstates/28257/2 "2015-04-24T06:13:05Z")

</div>

It is rather easy, you just need to create a new class based off a PlayerState, then specify it in your game mode:

```auto

AYourCustomGameMode::AYourCustomGameMode(const FObjectInitializer& ObjectInitializer) 
    : Super(ObjectInitializer)
{
    // ...
    PlayerStateClass = AYourCustomPlayerState::StaticClass();
    // ...
}

```

As for the health & mana thing, you can add it inside of your newly created PlayerState class as properties.

---

<div class="post-metadata">

**Author:** ![MykonCodes](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MykonCodes](https://forums.unrealengine.com/u/MykonCodes)\
**Post date:** [April 24, 2015, 6:38am UTC](https://forums.unrealengine.com/t/question-about-playerstates/28257/3 "2015-04-24T06:38:17Z")

</div>

is right. The same goes for different GameModes / PlayerController (Player -\> Game communication) and GameStates, basically any class from UE4, to prevent upcoming questions 😃

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7a972e90](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7a972e90](https://forums.unrealengine.com/u/anonymous_user_7a972e90)\
**Post date:** [April 24, 2015, 7:40pm UTC](https://forums.unrealengine.com/t/question-about-playerstates/28257/4 "2015-04-24T19:40:56Z")

</div>

like this?

```auto

ASecretPlayerState::ASecretPlayerState(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
	PlayerStateclass = ASecretPlayerState::StaticClass();

}
	

```

or is PlayerStateclass supposed to be SecretPlayerStateclass. Both give me an error, says it can’t get to Playerstate.h

Also, i have a gamemode class, and i made a blueprint for it too. And inside the blueprint, i changed the playerstate to my custom playerstate. I changed the default Gamemode in the settings too. Is the code the same thing i just did in blueprints? how do i connect a thirdpersonplayer to the gamestate?

---

<div class="post-metadata">

**Author:** ![illYay](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@illYay](https://forums.unrealengine.com/u/illYay)\
**Post date:** [April 24, 2015, 8:17pm UTC](https://forums.unrealengine.com/t/question-about-playerstates/28257/5 "2015-04-24T20:17:37Z")

</div>

As I understand, is Player State only for things you want to travel between clients in a multiplayer game? Like name, score, etc… That way those things show up in a scoreboard for example.

Then things like mana might need to just be in the Pawn if other players never see another player’s mana.

I think back in UDK this was known as the PlayerReplicationInfo but PlayerState.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7a972e90](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7a972e90](https://forums.unrealengine.com/u/anonymous_user_7a972e90)\
**Post date:** [April 24, 2015, 8:32pm UTC](https://forums.unrealengine.com/t/question-about-playerstates/28257/6 "2015-04-24T20:32:28Z")

</div>

It holds things like skill levels and inventory too. And people will eventually be able to see your mana and health
