Author Topic: Help with v2.2 for COD2 - adding code to .gsc files for CTF  (Read 2683 times)

Offline NickTheGrip

  • Rank: Private
  • *
  • Posts: 3
Help with v2.2 for COD2 - adding code to .gsc files for CTF
« on: March 02, 2008, 08:36:09 pm »
Help
(I am  sure you NEVER hear that)
I am one of the admins for a server (COD2) that currently uses the 2.2 version
I am pulling my hari out trying to add flag caps and returns to my stats. I know the normal log file does not have that but I developed the code to insert into the cft.gsc file to get it to print. The problem is when I rebuild my Extreme2.2.iwd file the game no longer 'sees' it and simply boots to the normal COD2 multiplayer screen

any help would be greatly appreciated


Nick The Grip
Admin               LCGExtreme gaming squad

Offline Joker{eXtreme}

  • Rank: Private
  • *
  • Posts: 6108
    • http://www.mycallofduty.com
Help with v2.2 for COD2 - adding code to .gsc files for CTF
« Reply #1 on: March 02, 2008, 10:29:21 pm »
Ok, slightly confused *L*

Any more info m8?

Offline NickTheGrip

  • Rank: Private
  • *
  • Posts: 3
Help with v2.2 for COD2 - adding code to .gsc files for CTF
« Reply #2 on: March 02, 2008, 11:04:10 pm »
Well I will try my best
My clan runs X2.2 and they want stats on caps and returns like the old UO days. The problem is COD2 does not write caps and returns to the log file mp_games.log like UO did.
So I started looking though the code and eventually found buried in the file ctf.gsc the code that determines the flag handling. I wrote some code to add in there to write to the log file and after some go around with the syntax got it to work and write to the log file, i think.
The problem is when i put the ctf.gsc back into the extremev2.2.iwd file it seems to corrupt it and now when I start my server back up with the mod  it wont access the extreme mod file. It just pops up into the normal unmodded start up screen (listen server, not dedicated). I am trying this out on my m/c at home because I dont want to screw up the gameservers server we have for the squad.
Is there a specific way you have to rebuild the .iwd file. I changed it over to zip filetype and extracted everything, made the change to ctf.gsc then rezipped it and changed the extension back to .iwd

Any help would be appreciated

Offline Joker{eXtreme}

  • Rank: Private
  • *
  • Posts: 6108
    • http://www.mycallofduty.com
Help with v2.2 for COD2 - adding code to .gsc files for CTF
« Reply #3 on: March 03, 2008, 12:10:28 am »
Ok, think I gotcha now.  Wanna post the code you wrote?

Offline NickTheGrip

  • Rank: Private
  • *
  • Posts: 3
Help with v2.2 for COD2 - adding code to .gsc files for CTF
« Reply #4 on: March 05, 2008, 11:43:04 pm »
Ok, the file I modified is found in the extreme .iwd file in the following location

maps\mp\gametypes\ctf.gsc

under the main object flag() this was the old code:

Code: [Select]
if(isdefined(other.flag)) // Captured flag
{
println("CAPTURED THE FLAG!");


Right after that I added

Code: [Select]
// BEGIN NICKCODE
lpothernum = other getEntityNumber();
lpotherguid = other getGuid();
lpothername = other.name;
lpotherteam = other.pers["team"];
logPrint("A;" + lpotherguid + ";" + lpothernum + ";" + lpotherteam + ";" + lpothername + ";" + "ctf_captured" + "\n");
// END NICKCODE


I did the same for a return

Its hard to read here so here is a link to the file on my website

http://thegripweb.aowc.net/user/119455/files/ctf.gsc

I hope this helps.


NickI

Offline Tally

  • Rank: Private
  • *
  • Posts: 65
Help with v2.2 for COD2 - adding code to .gsc files for CTF
« Reply #5 on: March 07, 2008, 05:05:39 pm »
This works:

Quote
            if(self.atbase)
            {
               if(isdefined(other.flag)) // Captured flag
               {
                  println("CAPTURED THE FLAG!");

                  friendlyAlias = "ctf_touchcapture";
                  enemyAlias = "ctf_enemy_touchcapture";

                  if(self.team == "axis")
                     enemy = "allies";
                  else
                     enemy = "axis";

                  thread playSoundOnPlayers(friendlyAlias, self.team);
                     thread playSoundOnPlayers(enemyAlias, enemy);

                  thread printOnTeamFIXED (&"MP_CTFB_ENEMY_FLAG_CAPTURED", self.team, other);
                  thread printOnTeamFIXED (&"MP_CTFB_YOUR_FLAG_WAS_CAPTURED", enemy, other);

                  other.flag returnFlag();
                  other detachFlag(other.flag);
                  other.flag = undefined;
                  other.statusicon = "";

                  other.score += level.ex_ctfpoints_playercf;
                  if(level.ex_ranksystem && !level.ex_score) other.pers["special"]+= level.ex_ctfpoints_playercf;
                  teamscore = getTeamScore(other.pers["team"]);
                  teamscore += level.ex_ctfpoints_teamcf;
                  setTeamScore(other.pers["team"], teamscore);
                  level notify("update_teamscore_hud");
                  
                  lpselfnum = other getEntityNumber();
                  lpselfguid = other getGuid();
                  logPrint("A;" + lpselfguid + ";" + lpselfnum + ";" + other.name + ";" + "ctf_captured_flag" + "\n");
                  
                  checkScoreLimit();
               }
            }