Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: COD2 MP: adding killing spree messages

  1. #1
    ... connecting
    Join Date
    Mar 2021
    Location
    Netherlands
    Posts
    9
    Thanks
    0
    Thanked 1 Time in 1 Post

    COD2 MP: adding killing spree messages

    I'd like to add killing spree messages to all my COD2 MP players. I have found this bit of script online, but if I add it to my maps\mp\gametypes\teams.gsc
    it does not work (nor do I get an error). I guess this script may not be complete and/or the 'killspree' needs to be initialized before this bit? Does anyone know?
    Thanks in advance!


    PHP Code:
        if( isplayer(attacker) && isAlive(attacker))
        {
            
            if ( (
    attacker != self) && (getcvar("g_gametype") != "dm") && (attacker.team != self.team) )
            {
                
    attacker.killspree++;
            }
            if ( (
    attacker != self) && (getcvar("g_gametype") == "dm")  )
            {
                
    attacker.killspree++;
            }
        
            
    rn randomint(16);
        
            if(
    attacker != self && isDefined(attacker.team) && isDefined(self.team) && attacker.team != self.team )
            {
                if (
    attacker.killspree == || attacker.killspree == 3)
                {
                    if(
    attacker.killspree == 3)
                        
    iprintln(attacker.name + &"^7is on a roll with ^1" attacker.killspree + &"^7 kills!");
                    
    rn randomint(10);
                }
                if (
    attacker.killspree == || attacker.killspree == 5)
                {
                    if(
    attacker.killspree == 5)
                        
    iprintln(attacker.name " ^7is on a killing spree with ^1" attacker.killspree " ^7 kills!");
                    
    rn randomint(8);
                }
                if (
    attacker.killspree && attacker.killspree 10)
                {    
                    if(
    attacker.killspree == 10)
                        
    iprintln(attacker.name " ^7is on fire with ^1" attacker.killspree " ^7 kills!");
                    
    rn randomint(5);
                }
                if (
    attacker.killspree >= 10)
                {    
                    if(
    attacker.killspree == 15)
                        
    iprintln(attacker.name " ^7is unstoppable with ^1" attacker.killspree "^7 kills!");
                    if(
    attacker.killspree == 20)
                        
    iprintln(attacker.name " ^7is dominating with ^1" attacker.killspree "^7 kills!");
                    
    rn randomint(5);
                }    
            }
        } 
    Edit by iznogod: Added code tags.

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,675
    Thanks
    17
    Thanked 1,012 Times in 636 Posts
    Be more specific how you add it to teams.gsc.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  3. #3
    ... connecting
    Join Date
    Mar 2021
    Location
    Netherlands
    Posts
    9
    Thanks
    0
    Thanked 1 Time in 1 Post
    I'm sorry, I meant dm.gsc, not teams.gsc.
    In there I placed it under:
    Callback_PlayerDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime)

  4. #4
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,675
    Thanks
    17
    Thanked 1,012 Times in 636 Posts
    Quote Originally Posted by michelboonstra74 View Post
    I'm sorry, I meant dm.gsc, not teams.gsc.
    In there I placed it under:
    Callback_PlayerDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime)
    Why is the Killing spree sound in playerDAMAGE and not in playerKILLED?

    Also, be more specific about how you added them. You cannot just throw them randomly in and expect them to work.

    Also, be more specific about your test setup. Developer mode enabled? Soundalias correct? Sound files loaded? Any errors in client console regarding sounds, especially when they're supposed to be playing? Any debug iprints you put in that get triggered (or not, that's also information), any info on whether or not the dm.gsc you're referring to is actually being executed or if a stock one is loaded instead?
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  5. #5
    ... connecting
    Join Date
    Mar 2021
    Location
    Netherlands
    Posts
    9
    Thanks
    0
    Thanked 1 Time in 1 Post
    Thanks for the reply. Clearly I have little knowledge of scripting.. I have placed the killing spree script in playerKilled - but with no effect, or error in the log file so far.
    ( Dev mode = CoD2MP_s.exe +set thereisacow 1337 +set developer 1 +set logfile 1 +set g_log server_mp.log )
    The modified dm.gsc is being executed instead of the stock version for sure. And as far as I can tell, the script doesn't need sound files.

    In the mean time I found out that the killing spree script was part of the Merciless Mod 2, so I will have a look at that and try to figure out if I can get the killing spree bit to run in my personal mod.
    If so, I'll post it in this thread.

  6. #6
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,675
    Thanks
    17
    Thanked 1,012 Times in 636 Posts
    Quote Originally Posted by michelboonstra74 View Post
    Thanks for the reply. Clearly I have little knowledge of scripting.. I have placed the killing spree script in playerKilled - but with no effect, or error in the log file so far.
    ( Dev mode = CoD2MP_s.exe +set thereisacow 1337 +set developer 1 +set logfile 1 +set g_log server_mp.log )
    The modified dm.gsc is being executed instead of the stock version for sure. And as far as I can tell, the script doesn't need sound files.

    In the mean time I found out that the killing spree script was part of the Merciless Mod 2, so I will have a look at that and try to figure out if I can get the killing spree bit to run in my personal mod.
    If so, I'll post it in this thread.
    I still have no information about where exactly you put this script. Post the entire callback_playerkilled.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  7. #7
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    455
    Thanks
    79
    Thanked 120 Times in 99 Posts
    try
    PHP Code:
    if( isplayer(attacker) && isAlive(attacker))
    {
        if (!
    isDefined(attacker.killspree))
            
    attacker.killspree 0;
        
        if ( (
    attacker != self) && (getcvar("g_gametype") != "dm") && (attacker.team != self.team) )
            
    attacker.killspree++;
        else
        if ( (
    attacker != self) && (getcvar("g_gametype") == "dm")  )
            
    attacker.killspree++;

        if(
    attacker != self && isDefined(attacker.team) && isDefined(self.team) && attacker.team != self.team )
        {
            
    iprintlnbold("attacker: " attacker.name " has killing spree: " attacker.killspree " when killing: " self.name);
            
            
    //if work, uncomment this
            
            /*
            switch (attacker.killspree)
            {
                case 1:
                    iprintln(attacker.name + " has 1 killing spree");
                    //just message();
                    break;
                case 2:
                    iprintln(attacker.name + " has 2 killing spree");
                    //LearnSomeSimpleDeveloperLessons();
                    break;
                case 3:
                    iprintln(attacker.name + " has 3 killing spree");
                    //Kick();
                    break;
                case 4:
                    iprintln(attacker.name + " has 4 killing spree");
                    //GiveSex();
                    break;
                case 5:
                    iprintln(attacker.name + " has 5 killing spree");
                    //GiveNades();
                    break;
                    
                default:
                    break;
            }
            */
        
    }

    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  8. #8
    ... connecting
    Join Date
    Mar 2021
    Location
    Netherlands
    Posts
    9
    Thanks
    0
    Thanked 1 Time in 1 Post
    Ok, thank you both for your replies! Based on the Merciless mod, I changed it a bit.
    In the maps\mp\gametypes\dm.gsc I just added these lines:
    self.killspree = 0;
    self thread cod2\_player::_KillSpree();

    PHP Code:
    spawnPlayer()
    {
        
    self endon("disconnect");
        
    self notify("spawned");
        
    self notify("end_respawn");

        
    resettimeout();

        
    // Stop shellshock and rumble
        
    self stopShellshock();
        
    self stoprumble("damage_heavy");

        
    self.sessionteam "none";
        
    self.sessionstate "playing";
        
    self.spectatorclient = -1;
        
    self.archivetime 0;
        
    self.psoffsettime 0;
        
    self.statusicon "";
        
    self.maxhealth 100;
        
    self.health self.maxhealth;

            
    self.killspree 0;     // KILL SPREE
        
        
    spawnpointname "mp_dm_spawn";
        
    spawnpoints getentarray(spawnpointname"classname");
        
    spawnpoint maps\mp\gametypes\_spawnlogic::getSpawnpoint_DM(spawnpoints);

        if(
    isdefined(spawnpoint))
            
    self spawn(spawnpoint.originspawnpoint.angles);
        else
            
    maps\mp\_utility::error("NO " spawnpointname " SPAWNPOINTS IN MAP");

        if(!
    isdefined(self.pers["savedmodel"]))
            
    maps\mp\gametypes\_teamsDM::model();
        else
            
    maps\mp\_utility::loadModel(self.pers["savedmodel"]);

        
    maps\mp\gametypes\_weapons::givePistol();
        
    maps\mp\gametypes\_weapons::giveGrenades();
        
    maps\mp\gametypes\_weapons::giveBinoculars();

        
    self giveWeapon(self.pers["weapon"]);
        
    self giveMaxAmmo(self.pers["weapon"]);
        
    self setSpawnWeapon(self.pers["weapon"]);

        if(!
    level.splitscreen)
        {
            if(
    level.scorelimit 0)
                
    self setClientCvar("cg_objectiveText", &"MP_GAIN_POINTS_BY_ELIMINATING"level.scorelimit);
            else
                
    self setClientCvar("cg_objectiveText", &"MP_GAIN_POINTS_BY_ELIMINATING_NOSCORE");
        }
        else
            
    self setClientCvar("cg_objectiveText", &"MP_ELIMINATE_ENEMIES");

        
    waittillframeend;
        
    self notify("spawned_player");

            
    self thread cod2\_player::_KillSpree(); // KILL SPREE


    And in cod2\_player.gsc I added:


    PHP Code:
    _KillSpree(attacker,killspree)
    {
        
    iprintlnbold("running killspree");     
        

        if( 
    isplayer(attacker) && isAlive(attacker))
        {
            if (!
    isDefined(attacker.killspree))
            
    attacker.killspree 0;
        
            if ( (
    attacker != self) && (getcvar("g_gametype") != "dm") && (attacker.team != self.team) )
                
    attacker.killspree++;
            else
            if ( (
    attacker != self) && (getcvar("g_gametype") == "dm")  )
                
    attacker.killspree++;

            if(
    attacker != self && isDefined(attacker.team) && isDefined(self.team) && attacker.team != self.team )
            {
                
    iprintlnbold("attacker: " attacker.name " has killing spree: " attacker.killspree " when killing: " self.name);
            
                switch (
    attacker.killspree)
                {
                    case 
    1:
                        
    iprintln(attacker.name " has 1 killing spree");
                        
    //just message();
                        
    break;
                    case 
    2:
                        
    iprintln(attacker.name " has 2 killing spree");
                        
    //LearnSomeSimpleDeveloperLessons();
                        
    break;
                    case 
    3:
                        
    iprintln(attacker.name " has 3 killing spree");
                        
    //Kick();
                        
    break;
                    case 
    4:
                        
    iprintln(attacker.name " has 4 killing spree");
                        
    //GiveSex();
                        
    break;
                    case 
    5:
                        
    iprintln(attacker.name " has 5 killing spree");
                        
    //GiveNades();
                        
    break;
                    
                    default:
                    break;
                }
            }
        }
     

    The "running killspree" iprint is showing up in game (after every respawn as the player got killed) , but I do not get any killspree messages, nor error messages about it in the log file..

  9. #9
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,675
    Thanks
    17
    Thanked 1,012 Times in 636 Posts
    Why are you calling the killing spree code every time a player spawns? And, on a more important note, your killspree code takes 2 arguments, and you provide none.

    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  10. #10
    ... connecting
    Join Date
    Mar 2021
    Location
    Netherlands
    Posts
    9
    Thanks
    0
    Thanked 1 Time in 1 Post
    Thanks for the reply! In the Merciless mod, it was also in the 'spawnPlayer', so that's why I thought it should be done every time a player spawns.
    But if i add the variables to the dm.gsc -> self thread cod2\_player::_KillSpree(attacker,killspree);
    I get a script compile error: uninitialised variable 'killspree'
    So I guess it needs to be initialised somewhere before? (again sorry, my knowledge about scripting is very limited)

Posting Permissions

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