If you want the player to have two lives, how can you compensate when they spawn in?

If I set the player lives counter integer to 2, it still translates to 3 total because the variable is not accounting for the player once play is it hit and one of those spawn beacons has been placed in the map. I imagine to get around I will have to remove that thing and somehow spawn the player manually. I am about to work my way up to a continue and this is about the furthest I have gotten on a UE4 project.

Anyone know what I’m talking about in this situation? Thanks.

bump

You need to overwrite spawning behavior in the Game Mode class. Your “Lives” value should be stored in the Player State class.

1 Like

Ok thank you, I will check into that now.

For anyone else out there trying this, this is how I got it to work.

  1. Go to your Project Settings - Maps and Modes - Default Pawn Class - and set it to None.

  2. Open your Third Person Character BP, go to the Viewport, Select the very top of your character - in the details panel search for auto - Look for Auto Possess Player (which should be disabled) and set it to “Player 0” per this suggestion.

  3. Go to where your Third Person Character BP is and drag and drop it into the world, position and rotate as needed.

While I did get this alternative method of spawning working. I may have spoken too soon.

When the game starts there is a player there on screen, and the lives counter reads X 2.
Image1

Player dies and respawns…
Image2

Dies and respawns again… And now it reads zero and is triggering my continue screen…
Image3

And if I temporarily bypass the continue screen here is what it shows…
Image4

And if the player dies again? Then there is no more players on screen.
Image5

Yet, I have the player lives counter set at 2 in the game instance.

So it is technically THREE lives, but the integer only reads TWO. How do have it sync better?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.