draoth 13 Posted March 18, 2018 Hello everyone, i'm trying to create a simple free for all gamemode and when you get killed you become spectator until there's only one guy left. When that's the case i want everybody to automatically get out of spectator mode and respawn. I tried immediately respawning the unit on death on an island and have force spectator mode but that doesn't seem to work as i hoped. Does anyone have a idea how to do this efficiently? (It's very quick paced so restarting the whole mission would be not an option) Draoth Share this post Link to post Share on other sites
draoth 13 Posted March 19, 2018 If you don't think it's possible please say so! I'm still trying to figure it out and the fact that no one is responding is making me worried. Or is this very easy to do and no one is responding because i'm asking a stupid question? Share this post Link to post Share on other sites
pierremgi 4736 Posted March 19, 2018 You should try something like this: In editor, choose the spectator mode for your respawn, avoid mission fail when everyone is dead No matter the respawn delay but more than zero. run this script in initPlayerLocal.sqf (or init.sqf, if you are aware of dedicated things: no player) 0= [] spawn { while {true} do { waitUntil {sleep 0.5; playerRespawnTime > 0}; setPlayerRespawnTime 10; if ({lifestate _x == "DEAD-RESPAWN"} count allPlayers == count allPlayers) then { sleep 1; setPlayerRespawnTime -1; } } } This script waits for your player(s) status "dead-respawn" and infinitely loop to overwrite the respawn time, till all players are in this state. Then all respawn. Note: the respawn counter reaches zero and stay at zero because I'm not scripting for this display control or inner variable. Too long to dig it. 1 Share this post Link to post Share on other sites
draoth 13 Posted March 19, 2018 2 hours ago, pierremgi said: You should try something like this: In editor, choose the spectator mode for your respawn, avoid mission fail when everyone is dead No matter the respawn delay but more than zero. run this script in initPlayerLocal.sqf (or init.sqf, if you are aware of dedicated things: no player) 0= [] spawn { while {true} do { waitUntil {sleep 0.5; playerRespawnTime > 0}; setPlayerRespawnTime 10; if ({lifestate _x == "DEAD-RESPAWN"} count allPlayers == count allPlayers) then { sleep 1; setPlayerRespawnTime -1; } } } This script waits for your player(s) status "dead-respawn" and infinitely loop to overwrite the respawn time, till all players are in this state. Then all respawn. Note: the respawn counter reaches zero and stay at zero because I'm not scripting for this display control or inner variable. Too long to dig it. First of all thanks alot for helping! I've got a couple of questions. I have to choose the spectator mode for respawning but the respawn delay option is greyed out. Do i have to set this in description.ext instead? Also, how can i define what respawning method is used after the infinite loop has ended? When i use the script on my server nothing really happens when i do what you said. So how exactly do i set this up. I'm very grateful that your willing to help me, and others with problems they encounter! Draoth Share this post Link to post Share on other sites
pierremgi 4736 Posted March 19, 2018 In editor: Choose respawn on custom position or position on death, (as classic respawn) / then tick spectator. Do not use the switch to spectator. Make sure you don't use the description.ext at the same time. (IMHO the editor is far more handy, the only missed thing I regret is no option for respawnOnstart here). Add a respawn delay An infinite loop doesn't end by definition. But you can hang it with a waitUntil, what I did. As said, this script is not for dedicated server because you need to have a player. It works on hosted server and any clients (players). You have to create a initPlayerLocal.sqf in mission root. Works also in init.sqf... 1 Share this post Link to post Share on other sites
draoth 13 Posted March 19, 2018 23 minutes ago, pierremgi said: In editor: Choose respawn on custom position or position on death, (as classic respawn) / then tick spectator. Do not use the switch to spectator. Make sure you don't use the description.ext at the same time. (IMHO the editor is far more handy, the only missed thing I regret is no option for respawnOnstart here). Add a respawn delay An infinite loop doesn't end by definition. But you can hang it with a waitUntil, what I did. As said, this script is not for dedicated server because you need to have a player. It works on hosted server and any clients (players). You have to create a initPlayerLocal.sqf in mission root. Works also in init.sqf... Thanks, but now only when all players die (tested with two players) the last one will respawn. Everybody should respawn when there is only one left, not when everybody has died. I tried this: Quote ({lifestate _x == "DEAD-RESPAWN"} count allPlayers == count allPlayers + 1) But that didn't work. Share this post Link to post Share on other sites
pierremgi 4736 Posted March 19, 2018 ({lifestate _x == "DEAD-RESPAWN"} count allPlayers == (count allPlayers - 1) ) Share this post Link to post Share on other sites