Hey everyone, I’m having an issue with getting my HUD’s to display correctly. I have Two player characters, two player controllers and two HUDs. They’re almost pretty much identical, however I’ve been trying to do a couple of things:
Get player two to stop using player 2’s HUD
Get player two to use their own characters instead of using player one.
I’ve been messing around with player indexes but to no avail. I’m really in need of some advice in getting player two to use their own stuff instead of player one. I know player one can take damage and die, however it’s not reflected on their HUD. However if they shoot player 1, their HUD will display as player 1’s and display the exact same data. So if player 1 was shot to 0 HP, player 2 would display 0 HP on their screen.
My game is fairly simple, however it’s my first time trying split screen multiplayer so any help and advice would be appreciated!
HUD is generated for each PlayerController, as each player has it’s own PlayerController which possess each pawn tha player controls. There for you should control HUD from PlayerController from it refrence inside this class or from HUD get data using Get Owning Player Controller or Get Owning Pawn and as you use them like that and don’t relay on global scope data (you mentioned player indexes) and such work out by it’s own. But i’m not 100% if this is how it works with splitscreen as i din’t play with it yet, if both HUDs for both players a drawed
So obviously when I set my game up, and choose one of the ships huds I get this (Player 0 is a red HUD and player 1 is a blue HUD, I’ve also tested it with HUD as the default class in which it draws neither of the HUDs) Which comes to the playercontroller, which is going to be controlling it.
This is what I have found in the playercontroller class, but I’m stumped whether I should make this into a construction script, regular event script or even create a function. I’ve also been hooking them up to try and set the HUD but to no avail still. Either I get Errors/Warnings and it still won’t show.
(Sorry, had lots of trouble uploading screenshots!)
you are getting the player character for player 0, not for the owning player. Make sure you aren’t using that setup elsewhere as well, otherwise it will always reference the first player, not the one it should!