MantisBT - Zandronum
View Issue Details
0001231Zandronum[All Projects] Suggestionpublic2012-12-29 17:032018-09-30 20:22
Cutman 
Torr Samaho 
normalfeatureN/A
closedfixed 
1.0 
1.11.1 
0001231: Queue management in modes such as Survival
I've recently made a survival game mode which is best played with 4 players. This is great and fun but I noticed that we had a lot of spectators that wanted to play but had to wait for someone to quit, so I came up with an idea for a server option.

If you die in survival (or run out of lives if sv_maxlives is set), you are kicked to spectator and the back of the queue. That way when everyone is dead, the next batch of players can play. I think this has use outside my mod for survival servers that can't handle lots of players but can handle lots of clients.

We have a hacky ACS script to handle this but I've been told others could benefit from this. Perhaps it could be implemented into other modes too such as LMS.
Here's an example of the hacky script we're using:

str ForceSpectate[32] = {
"kickfromgame_idx 0 Spectated",
"kickfromgame_idx 1 Spectated",
"kickfromgame_idx 2 Spectated",
"kickfromgame_idx 3 Spectated",
"kickfromgame_idx 4 Spectated",
"kickfromgame_idx 5 Spectated",
"kickfromgame_idx 6 Spectated",
"kickfromgame_idx 7 Spectated",
"kickfromgame_idx 8 Spectated",
"kickfromgame_idx 9 Spectated",
"kickfromgame_idx 10 Spectated",
"kickfromgame_idx 11 Spectated",
"kickfromgame_idx 12 Spectated",
"kickfromgame_idx 13 Spectated",
"kickfromgame_idx 14 Spectated",
"kickfromgame_idx 15 Spectated",
"kickfromgame_idx 16 Spectated",
"kickfromgame_idx 17 Spectated",
"kickfromgame_idx 18 Spectated",
"kickfromgame_idx 19 Spectated",
"kickfromgame_idx 20 Spectated",
"kickfromgame_idx 21 Spectated",
"kickfromgame_idx 22 Spectated",
"kickfromgame_idx 23 Spectated",
"kickfromgame_idx 24 Spectated",
"kickfromgame_idx 25 Spectated",
"kickfromgame_idx 26 Spectated",
"kickfromgame_idx 27 Spectated",
"kickfromgame_idx 28 Spectated",
"kickfromgame_idx 29 Spectated",
"kickfromgame_idx 30 Spectated",
"kickfromgame_idx 31 Spectated",
};

script 401 RESPAWN
{
//Print(s:"You Respawned!!! lets kick player ", i:PlayerNumber());
Delay(5);
if(GetCvar("survival")==0){terminate;}
ConsoleCommand(ForceSpectate[PlayerNumber()]);
}
No tags attached.
Issue History
2012-12-29 17:03CutmanNew Issue
2012-12-30 11:57Torr SamahoNote Added: 0005618
2013-01-02 17:29Torr SamahoNote Added: 0005663
2013-01-02 17:29Torr SamahoStatusnew => feedback
2013-01-02 17:51CutmanNote Added: 0005664
2013-01-02 17:51CutmanStatusfeedback => new
2013-01-02 18:08Torr SamahoNote Added: 0005665
2013-01-02 18:14hjalgNote Added: 0005666
2013-01-02 18:21Torr SamahoNote Added: 0005667
2013-01-02 18:22Torr SamahoNote Edited: 0005667
2013-01-02 18:24Torr SamahoNote Edited: 0005667bug_revision_view_page.php?bugnote_id=5667#r3107
2013-01-02 18:24Torr SamahoNote Revision Dropped: 5667: 0003105
2013-01-02 18:24Torr SamahoNote Revision Dropped: 5667: 0003106
2013-01-02 18:25Torr SamahoAssigned To => Torr Samaho
2013-01-02 18:25Torr SamahoStatusnew => needs testing
2013-01-02 20:02CutmanNote Added: 0005671
2013-01-12 21:27Torr SamahoNote Added: 0005744
2013-01-12 21:28Torr SamahoTarget Version => 1.1
2013-04-06 10:04DuskStatusneeds testing => resolved
2013-04-06 10:04DuskFixed in Version => 1.1
2013-04-06 10:04DuskResolutionopen => fixed
2018-09-30 20:22Blzut3Statusresolved => closed

Notes
(0005618)
Torr Samaho   
2012-12-30 11:57   
Interesting idea and should be pretty easy to implement. If enough players are interested in this, I can implement it.
(0005663)
Torr Samaho   
2013-01-02 17:29   
Thinking a bit more about this, I'd say this kind of idea is also a good reason to add an ACS command that allows to force a player to spectate, so I added KickFromGame (int playernumber, str reason). Combined with the new GetPlayerLivesLeft/SetPlayerLivesLeft commands from 0001229 this could be enough to properly implement the requested feature. So is this request still necessary?
(0005664)
Cutman   
2013-01-02 17:51   
Does the build in the lives management issue also have KickFromGame? If so I can test both features and get back to you (still need to know the ACS number for KickFromGame though)
(0005665)
Torr Samaho   
2013-01-02 18:08   
No, I made that build before adding KickFromGame. I'll make a new build that contains all of the new commands.
(0005666)
hjalg   
2013-01-02 18:14   
This feature is badly needed for LMS. CVAR "sv_dead2spec" for example. Because it's kinda annoying when you always have to say "dead spec please" (and they ignore it). I support.
(0005667)
Torr Samaho   
2013-01-02 18:21   
(edited on: 2013-01-02 18:24)
This build supports KickFromGame as well as GetPlayerLivesLeft/SetPlayerLivesLeft. To use all of these functions add

    -104:GetPlayerLivesLeft(1),
    -105:SetPlayerLivesLeft(2),
    -106:KickFromGame(2),

to your zspecial.acs. One way to implement the "dead2spec" feature this request is about would be to regularly loop over all players, use PlayerIsSpectator to find dead spectators (this command returns 2 if the player is a dead spectator) and KickFromGame to force the dead spectators to spectate. This way you don't even need to use GetPlayerLivesLeft. With a suitable delay you can probable even to this with a DEATH script instead of a loop.

(0005671)
Cutman   
2013-01-02 20:02   
Seems to work fine online. Here's the script I used for testing the new functions.

script 401 DEATH
{
Delay(2);
if(GetCvar("survival")==0){terminate;}

    if(GetPlayerLivesLeft(PlayerNumber())==0){
    PrintBold(s:"Kicking player ", i:PlayerNumber());
    KickFromGame(PlayerNumber(),"Game over!");
    terminate;
    }
}

script 408 (int lives) net // test
{
SetPlayerLivesLeft(PlayerNumber(),GetPlayerLivesLeft(PlayerNumber()) + lives);
}

Note: With SetPlayerLivesLeft you can go over the "maximum lives" set by sv_maxlives. Can easily get around this by using GetCvar but was wondering if it was intentional or not.
(0005744)
Torr Samaho   
2013-01-12 21:27   
Quote from Cutman
Note: With SetPlayerLivesLeft you can go over the "maximum lives" set by sv_maxlives.
That's intentional. If you want to give a player more lives than sv_maxlives, you can do so.