Results 1 to 2 of 2

Thread: [CoD2] Only about 0.2 sec of my roundcam is displayed

  1. #1
    Deleter/Deleted
    Join Date
    Jan 2023
    Posts
    76
    Thanks
    40
    Thanked 9 Times in 9 Posts

    [CoD2] Only about 0.2 sec of my roundcam is displayed

    Hi
    I am trying to make a roundcam inspired by CoDaM of CoD 1.1

    (by roundcam I mean the player who killed the last in opposing team, will produce a killcam that everyone will see)

    I have no errors, but after killing the last enemy, a few seconds pass, then only about 0.2 sec of the roundcam is displayed, and then the new round starts...

    Can you see the error in the following code parts?


    in _killcam.gsc
    PHP Code:
    roundcam(goaldelaymsgoffsetTime)
    {
        
    printf("######### _killcam: roundcam \n");

        
    self.sessionstate "spectator";

        if (
    isPlayer(goal))
        {
            
    self.spectatorclient goal getEntityNumber();
        }
        else
        {
            
    self.spectatorclient = -1;
            
    self spawn(goal.origin goal.angles);
        }

        
    self.archivetime delay 7;
        
    self.psoffsettime offsetTime;

        
    // ignore spectate permissions
        
    self allowSpectateTeam("allies"true);
        
    self allowSpectateTeam("axis"true);
        
    self allowSpectateTeam("freelook"true);
        
    self allowSpectateTeam("none"true);
        
        
    // wait till the next server frame to allow code a chance to update archivetime if it needs trimming
        
    wait 0.05;
        
    ...

        
    self removeKillcamElements();
        
    self.spectatorclient = -1;
        
    self.archivetime 0;
        
    self.psoffsettime 0;
        
        
    self thread maps\mp\gametypes\_spectating::setSpectatePermissions();

        
    level notify("roundcam_ended");


    in sd.gsc
    PHP Code:
    endRound(roundwinnercamoffset)
    {

    ...

            if (
    doRoundcam)
        {
            
    level roundCam(camroundwinneroffset);
        }
        else
        {
            
    level notify("restarting");
            
    map_restart(true);
        }
    }

    //////////////////////////////////////////////////////////

    roundCam(camroundwinneroffset)
    {
        if (!
    isdefined(cam) || !isdefined(roundwinner) || !isdefined(offset))
        {
            
    wait(3);
            return;
        }

        
    delay 2;
        
    wait(delay);

    ...

        
    viewers 0;
        
    players getentarray("player""classname");

        for (
    0players.sizei++)
        {
            
    player players[i];
            if (
    isdefined(player.killcam) || (player.archivetime 0))
            {
                
    // Already running killcam, stop it
                
    player notify("spawned");
                
    wait(0.05);
                
    player.spectatorclient = -1;
                
    player.archivetime 0;
            }
            
    player thread maps\mp\gametypes\_killcam::roundcam(camdelaytextoffset);
            
    viewers++;
        }

        if (
    viewers)
        {
            
    level waittill("roundcam_ended");

            
    level notify("restarting");
            
    map_restart(true);
        }
        else
        {
            
    wait(delay);
        }
    }

    //////////////////////////////////////////////////////////

    updateTeamStatus()
    {

    ...

            
    // if axis were alive and now they are not
        
    if(oldvalue["axis"] && !level.exist["axis"])
        {
            
    // if axis planted the bomb, continue the round
            
    if(level.bombplanted && level.planting_team == "axis")
                return;

            
    _announce = &"MP_AXISHAVEBEENELIMINATED";
            
    iprintln(&"MP_AXISHAVEBEENELIMINATED");
            
    level thread playSoundOnPlayers("mp_announcer_axiselim");

            
    level thread endRound("allies"level.playercamlevel.offsetTimeCam);

            return;
        }




    I know that the roundcam func of _killcam.gsc gets called because I see the following message in my server terminal:





    Could you please take a look?
    Last edited by raphael; 22nd May 2023 at 10:28.

  2. #2
    Deleter/Deleted
    Join Date
    Jan 2023
    Posts
    76
    Thanks
    40
    Thanked 9 Times in 9 Posts
    Is now fixed
    Couldn't explain precisely how/why, but I think the following code could

    PHP Code:
    endRound(roundwinnercamoffset)
    {

    ...

        else if(
    roundwinner == "axis")
        {
            
    doRoundcam true;

            
    game["axisscore"]++;
            
    setTeamScore("axis"game["axisscore"]);

            
    players getentarray("player""classname");
            for(
    0players.sizei++)
            {
                
    lpGuid players[igetGuid();
                if((
    isdefined(players[i].pers["team"])) && (players[i].pers["team"] == "axis"))
                    
    winners = (winners ";" lpGuid ";" players[i].name);
                else if((
    isdefined(players[i].pers["team"])) && (players[i].pers["team"] == "allies"))
                    
    losers = (losers ";" lpGuid ";" players[i].name);
            }
            
    logPrint("W;axis" winners "\n");
            
    logPrint("L;allies" losers "\n");
        }

        if (
    doRoundcam)
        {
            
    printf("######### sd: endRound: doRoundcam \n");
            
    level roundCam(camroundwinneroffset);
        }
        else
        {
            
    wait 7;
        }

    ...
        
        
    level notify("restarting");
        
    map_restart(true);
    }

    roundCam(camroundwinneroffset)
    {
        if (!
    isdefined(cam) || !isdefined(roundwinner) || !isdefined(offset))
        {
            
    wait(3);
            return;
        }

        
    delay 2;
        
    wait(delay);

    ...

        
    viewers 0;
        
    players getentarray("player""classname");

        for (
    0players.sizei++)
        {
            
    player players[i];
            if (
    isdefined(player.killcam) || (player.archivetime 0))
            {
                
    // Already running killcam, stop it
                
    player notify("spawned");
                
    wait(0.05);
                
    player.spectatorclient = -1;
                
    player.archivetime 0;
            }
            
    player thread maps\mp\gametypes\_killcam::roundcam(camdelaytextoffset);
            
    viewers++;
        }

        if (
    viewers)
        {
            
    level waittill("roundcam_ended");
        }
        else
        {
            
    wait(delay);
        }


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •