Download

Blueprint UI and Casting.

Hello UE Forums.

For sometime ive been trying to setup a simple Scoreboard UI feature similar to those you find in any FPS game, it displays the teams, the players and scores as well as what gametype and possibly the map the server is currently running. However im running into a small issue. I can safely get the gametype (which is an enum ive created and set correctly for the gamemode being used) and display it in a text element on my scoreboard hud for the server, however im having trouble getting it to work for clients.

The server correctly shows what gametype is running, however the clients all show the default value for the enum im retrieving from the gamemode. Im using an interface call to an implemented function that returns the gametype being used by the current gamemode which you can see in the screenshots below.

http://www.ltbb.org/devilsd/UnrealEngine/images/scoreboardBP.JPG

http://www.ltbb.org/devilsd/UnrealEngine/images/gameMode.JPG

I dont have much experience with how the new UMG works and finding helpful tutorials that achieve similar results to what im trying to do are non existent. I feel as though im making a simple mistake and i hope someone can point it out to me or point me in the right direction as to how to rectify my issue.

If you need any additional information i would be more than happy to provide it.

I guess this happens because the GameMode is only existing on the Server. You will need a replicated function that gets the GameType and sets it for the Players.

So you would need to have a function that runs on the server and (use Switch has authority) returns the GameType of the GameMode. The Clients aren’t getting the
GameMode here, that’s why it is still the standard value.

Ive put a replicated variable on the Player Controller called GameType and when the player connects to the server this variable is set. This solves my problem for the Gametype however this solution opens up an even bigger problem. Ultimately i want to display alot of information about the other players in the server as well. Is there a better way to pass all that information instead of creating a variable for each one on the player and then setting it like ive done with the GameType variable?

Im sure im looking at this all wrong, any suggestions?

Hm, for the Player you have the PlayerState. That is a Class that you can set in the Default Settings of your GameMode. It can’t be found in the Maps and Nodes, but if you open your custom
GameMode BP, you can click on Default settings and set your PlayerState Class.

This class already contains things like a PlayerName or the Ping. Sadly some of these are only setable in C++, but at least you can get them or create new variables.

In your GameState Class, you have an array called “PlayerArray”. This contains all your PlayerStates of every connected Player and the PlayerStates are replicated.

So all in all, this is the best place to store information about your players.

The GameType variable you used is something that needs to be implemented outside of the PlayerState. You could place it in the GameState if you want,
but since you want to change this enum based on the GameMode, you will want to just leave it there.

It is just the GameMode that only exists on the server. PlayerState exists on all clients, so you won’t have these problemes here.

Thanks, your help is much appreciated. I will have to change my design a little but in the end it will probably be for the best. I forgot about the GameState class.