I have a command in where the game restart when a play dies which is great it works amazing now the problem with this is it restarts when ever any player dies so how do i make it so that why it checks how many players are left alive then restarts after all players or dead or one team is dead. Visuals are a lot better for me if any one has any thanks.
How do i restart my level when all players die
It’s not hard to figure how to do it. In GameMode, keep in track number of players alive for each team (integer array?), when player spawns +1 and -1 when players dies. On event when player dies after -1 you check if number of players alive is 0, if it is you end the match (or round) and annouce winner and round point and restart game
Alright i get how that works but im not sure how the blueprint would look for that
Like what am i doing wrong here
Why doing this character? Do it in GameMode, inform GameMode by calling function in it that player died or been spawned and count there. Also did you checked this node: Restart Game | Unreal Engine Documentation
Thanks I did not know about that node but how do I do a player count in the game mode. I understand how its suppose to work I do not understand how to do it our how it looks.
You know how to do it., you already did one piece make functions in gamemode for increse and decrese of player count varable and call it when player dies and when player spawns. Make character call game mode when it dies or spawns (begin play), “Get Game Mode” (there should be node like that) cast it to you game mode class and then call function you made
call that when player spawns, class “-” version when player dies, simple as that. Just make sure that both always count, if player dies or spawn and count wont change it will go off sync.
im going to post a few picture i think i have it set up right but its not counting
Add spawn count on character too when they spawn (BeginPlay), you don’t need to create local player it already there, now you have 3 players on. Also i don’t think you should trush your GameMode with Create Player, or else you want to create static number of players.
Other then that there something wrong with it? does it work? Do you heck on death count if it’s 0 to toggle end of game?
Im missing something i dont believe the my game is counting the spawns and death
the game itself works fine its restarting when both players die