Spectate Bugs

Fixious

Test Lead
You'll get AFK kicked if you're Spectating long enough.
Joining a team then going Spec will create a 'clone' of your body.

Both are sorta covered in this thread: http://forums.legionsoverdrive.com/threads/clone-appearing-due-to-spectator-mode.4760/

edit: Yeah the clone thing is a bit of an issue. Even if your clones are killed and you join a team, you'll still get kicked for being AFK even though you're not. I guess a hacky way of getting around this is to simply remove the AFK kick thing, unless someone really wants to dig into this. Or remove Spectator...again.
 
Last edited:

Belberith

Legions Developer
To fix the AFK kicking when in observer mode, simply add:
Code:
if (isEventPending($idleTimer[%client]))
      cancel($idleTimer[%client]);
to server/game/observer.cs near the beginning of the serverCmdSwitchToObserver function, like this:
Code:
function serverCmdSwitchToObserver( %client )
{
    if (%client.isObserver)
        return;

    %canSwitch = false;
    if (%client.playerInfo.adminLevel > 1 || $Server::ObserverCount < $Server::MaxObservers)
    {
        $Server::ObserverCount++;

        Game.destroyPlayer(%client.player);
        %client.team.removeClient(%client);
        %client.camera.delete();

        %client.isObserver = true;
        commandToClient(%client, 'SetClientIsObserver', true);
        SetObserveValuesServer(%client, "None", "None", false, "Toggle Camera Mode: Free");
    
        if (isEventPending($idleTimer[%client]))
             cancel($idleTimer[%client]);
 

Fixious

Test Lead
Nice. Unfortunately spec is now crashing on me regularly. Was working fine during one map, but during another it would crash when specing a player when they die and respawn.
 

Fixious

Test Lead
One way to 'fix' the clone bug is to simply disable the Spectate button after joining a team for x amount of seconds. I've fiddled around with it just now and it appears that clones won't be created if you wait 2-3 seconds after joining a team and entering spec, as noted by Poison in the original bug thread. I know this doesn't fix the underlying issue, but it'd very likely work for now. Perhaps the real issue is related to the brief invincibility players have after spawning? I know switching teams normally doesn't cause issue, but maybe this was overlooked when making spectate.

Also, apparently Spectator really hates Gorge? I've spectated people on several maps without issue, however on Gorge it crashes when spectating someone and they respawn. Very odd. I'll poke around the .mis to see if there are any noticeable changes.
 

Fixious

Test Lead
I was able to get Gorge working but only by commenting out like 90% of the code, so all that remained were player spawns. I got tired of trying to narrow it down, though I might give it another go later tonight. I also tested other maps and it seems the majority of user-made maps have this same respawn crash when spectating a player that respawns.

Good:

Zenith
WinterMelt
Whiteout
TheCore
Stygian
Nivosus
Moonshine
Mirage
Frostbyte
Forgotten
Elegiac
Chillout
AlderannCatwalks

Bad:

Gorge
Sleepwalker
Shoreline
Reactor
Qualm
Outcast
OttN
Grassy
Genesis
Fallout
BladeRun
 

Fixious

Test Lead
No progress on the crash unfortunately, though clones are (hopefully) fixed. Poponfu popped up out of no where and I told him about the issue. As I suspected, it is indeed related to the Fresh Meat Invincibility. Adding %client.player.setInvincible(false); to function serverCmdSwitchToObserver( %client ) in Legions\game\server\game\observer.cs fixes the issue. The clone wars have ended!

Code:
function serverCmdSwitchToObserver( %client )
{
    if (%client.isObserver)
        return;

    %canSwitch = false;
    if ($Server::ObserverCount < $Server::MaxObservers)
    {
        %client.player.setInvincible(false);  //required to kill clones when switching from a team to spec before fresh meat expires
        Game.destroyPlayer(%client.player);
        $Server::ObserverCount++;

        %client.team.removeClient(%client);
        %client.camera.delete();

        %client.isObserver = true;
        commandToClient(%client, 'SetClientIsObserver', true);
        SetObserveValuesServer(%client, "None", "None", false, "Toggle Camera Mode: Free");
        //commandToClient(%client, 'PushObserverCameraSpeedMap');

        if (%client.LastObservedFlag $= "")
        {
            %client.LastObservedFlag = "Flag1";
        }
        if (%client.ObserverCurrentZoomPercent $= "")
        {
            %client.ObserverCurrentZoomPercent = 0.5;
        }
        if (%client.ObserverCurrentZoomLevel $= "")
        {
            %client.ObserverCurrentZoomLevel = (($ObserverMaxZoom - $ObserverMinZoom) * %client.ObserverCurrentZoomPercent) + $ObserverMinZoom;
        }
        if (%client.PlayerAndProjectileSearchRadius $= "")
        {
            %client.PlayerAndProjectileSearchRadius = 200;
        }

        Observers.add(%client);
        Game.createObserverCamera(%client);
    }
    else
    {
        messageClient(%client, 'MsgObserverFull', "~gServer has reached maxium number of observers.");
    }
}

To clean it up and prevent console spam:

(12:37:40 AM) Poponfu --: so to make it legit and not waste resources and cause console spam
(12:37:44 AM) Poponfu --: you would do
(12:38:59 AM) Poponfu --: if(isObject(%client.player) && %client.player.isInvinsible() == 1)
{
%client.player.setInvincible(false);
}
 
Last edited:
Top