PDA

View Full Version : Tf2 arena waiting / team bug


friagram
10-27-2014, 08:47
It seems that client variables do not return back properly when arena mode gamestate is in the early stages (panel shows waiting for 1 player to join). If 2 players are on red for example, and none one blue, it would be easy to just balance teams. However, getclientteam returns some uninitialized variable like 35862 regardless of client team. Likewise, isplayeralive returns incorrect values. Anyone know what is up with this?

Powerlord
10-27-2014, 09:49
This is likely an artifact of the Arena queue system. Although it could just as easily be because Arena never spawns players until the first round.

Speaking of which, was this with tf_arena_use_queue set to 0 or set to 1? Does it exhibit the same behavior either way?

friagram
10-27-2014, 15:31
Use queue is set to 0.
Is there a way to enable use queue cvar somehow while disabling its harmful effects?

Powerlord
10-27-2014, 15:58
Use queue is set to 0.
Is there a way to enable use queue cvar somehow while disabling its harmful effects?

Actually, I was wondering if the queue was causing the issue you were seeing.

The only benefit I see the queue providing is re-enabling automatic scrambles.

friagram
10-27-2014, 16:44
I'll test in a moment, If it is, I could just disable it when waiting the round state is set to that, and set it back.
Usually I do something like this for mods I make for peopl (deathrun, dodgeball, etc):
Track player team selection with events and cache the value. Run a looping timer that checks the gamestate and re-balances the teams when it occurs. Possibly use a queue system to determine the next player for the boss team and balance around that.

However, for mods like Freak Fortress that are not written with this in mind, you get the bug often, and it's annoying. I've got something that works now, but it's sloppy. I just run this every few seconds on plugin start.. One problem is that the person who get's auto'd sees the VGUI class select screen. Not sure if i can cancel that menu on them. If I could, it would probably be fine. Might work if the queue system is the problem disabled, to enable it on tick 1 or something to allow re-balancing, and then disable it as soon as I can read teams.


public Action:Timer_Loop(Handle:timer)
{
static tick;
if(GameRules_GetRoundState() == RoundState_Pregame)
{
tick++;
if(tick > 2)
{
new players;
for(new i=1; i<=MaxClients; i++)
{
if(IsClientInGame(i))
{
players++;
if(players > 1)
{
FakeClientCommand(i, "jointeam auto");
tick = 0;
return;
}
}
}
}
}
else
{
tick = 0;
}
}


OK enabling the queue seems to fix it, so i'll just enable the cvar, swap the teams, and then disable it again.

friagram
10-27-2014, 17:05
Okay, thanks powerlord, this seems to have resolved the issue. Silly:

public Action:Timer_Loop(Handle:timer)
{
static tick;
if(GameRules_GetRoundState() == RoundState_Pregame)
{
tick++;
if(tick > 2)
{
SetConVarInt(gh_cvarArenaUseQueue, 1);

new red;
new lastred;
new blue;
new lastblue;
for(new i=1; i<=MaxClients; i++)
{
if(IsClientInGame(i))
{
switch(GetClientTeam(i))
{
case 2:
{
red++;
lastred = i;
}
case 3:
{
blue++;
lastblue = i;
}
}
}
}

if(!blue && red)
{
ChangeClientTeam(lastred, 3);
}
else if(!red && blue)
{
ChangeClientTeam(lastblue, 2);
}

SetConVarInt(gh_cvarArenaUseQueue, 0);
}
}
else
{
tick = 0;
}
}

Root_
10-28-2014, 12:45
One problem is that the person who get's auto'd sees the VGUI class select screen. Not sure if i can cancel that menu on them.
If you are still interested, I believe you can disable class selection thing. At least I do that in DoD:S Deathmatch (https://forums.alliedmods.net/showthread.php?p=1697565) by hooking VGUIMenu and re-showing new one.

friagram
10-28-2014, 17:23
Yeah,
ShowVGUIPanel(client, "class_red");
ShowVGUIPanel(client, "class_blue");

Chdata
10-29-2014, 00:17
By the way, there's TF2_OnWaitingForPlayersStart / End now.

tf2.inc has it I think

Anyway... perhaps this has something to do with why VSH can spawn players as a 'living spectator' usually around the "first round".

...

friagram
10-29-2014, 17:08
That bug is something else, where it forces client's lifestate to change and actually respawns them.
I've never bothered to fix it since it does not happen very often and nobody seems to care

Chdata
10-30-2014, 22:38
It happens a lot to me :c

And oh right, I forgot it was mostly due to m_LifeState.

Maybe I left forcespectohale enabled or something? Ought to just... get rid of that cvar.