x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How do i restart my level when all players die

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.

Product Version: UE 4.8
Tags:
more ▼

asked Oct 29 '15 at 01:40 AM in Blueprint Scripting

avatar image

master041398
3 1 3 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

more ▼

answered Oct 29 '15 at 03:18 AM

avatar image

Shadowriver
36.6k 930 169 1111

avatar image master041398 Oct 29 '15 at 03:45 AM

Alright i get how that works but im not sure how the blueprint would look for that alt text Like what am i doing wrong here

playercount.png (163.8 kB)
playercount2.png (232.4 kB)
avatar image Shadowriver Oct 29 '15 at 04:34 AM

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: https://docs.unrealengine.com/latest/INT/BlueprintAPI/Game/RestartGame/index.html

avatar image master041398 Oct 29 '15 at 01:26 PM

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.

avatar image Shadowriver Oct 29 '15 at 04:20 PM

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

avatar image master041398 Nov 05 '15 at 02:28 PM

alt text

Is this how my count is suppose to look

playerdeath.png (193.8 kB)
playerspawn.png (166.5 kB)
avatar image Shadowriver Nov 05 '15 at 04:43 PM

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.

avatar image master041398 Nov 06 '15 at 02:07 PM

im going to post a few picture i think i have it set up right but its not counting

avatar image master041398 Nov 06 '15 at 02:16 PM

alt text

runcharacter.png (295.6 kB)
rungame.png (382.7 kB)
avatar image Shadowriver Nov 06 '15 at 03:50 PM

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?

avatar image master041398 Nov 12 '15 at 01:57 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question