ItsMods

Full Version: Modding, the right way.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hello,

I am going to write a short tutorial here because it seems like most
everyone is just hacking up _rank.gsc. You don't need to do this and
it creates a lot of unused code. _rank.gsc is included in EVERYTHING
anyway, so you don't need it for any special functions or anything.

First, we are going to start of talking about making your own GSC file.

So, lets begin.

1. Make a new, blank file and save it as my.gsc

Then, you need to learn the way the code is executed, and what must be called
to start a game.

2. Define includes

These are the very top lines of the GSC file, and are executed each time the file
is processed, which will occur ~20 times a second. The most common and required
includes are:

C++ Code
  1. #include maps\mp\_utility;
  2. #include maps\mp\gametypes\_hud_util;
  3. #include common_scripts\utility;


3. Define Main()

Main is the section that sets things like, round timer and game type also defines
lots of other things for the level.

C++ Code
  1. main()
  2. {
  3. //Here we decide if we are staring the game or not...
  4. if( GetDvar( #"mapname" ) == "mp_background" )
  5. {
  6. return;
  7. }
  8.  
  9.  
  10. //Define our models/weapons/etc
  11. preCacheModel( "p_glo_barricade_wood_barb_pow" );
  12. precacheitem( "crayons_mp5" );
  13.  
  14. //Start the required files to "start a game"
  15. maps\mp\gametypes\_globallogic::init();
  16. maps\mp\gametypes\_callbacksetup::SetupCallbacks();
  17. maps\mp\gametypes\_globallogic::SetupCallbacks();
  18. maps\mp\gametypes\_damagefeedback::init();
  19. maps\mp\gametypes\_tweakables::init();
  20.  
  21. //Define our game dvars
  22. maps\mp\gametypes\_globallogic_utils::registerTimeLimitDvar( level.gameType, 3.75, 0, 1440 );
  23. maps\mp\gametypes\_globallogic_utils::registerScoreLimitDvar( level.gameType, 100, 0, 50000 );
  24. maps\mp\gametypes\_globallogic_utils::registerRoundLimitDvar( level.gametype, 3, 0, 10 );
  25. maps\mp\gametypes\_globallogic_utils::registerRoundWinLimitDvar( level.gametype, 2, 0, 10 );
  26. maps\mp\gametypes\_globallogic_utils::registerNumLivesDvar( level.gametype, 1, 0, 10 );
  27. maps\mp\gametypes\_serversettings::constrainMapSize(4);
  28.  
  29. //Define our gametype (this tricks the server into thinking its not custom)
  30. //Change this to match your gametype, obviously, I wanted rounds and no respawn.
  31.  
  32. level.gametype = "sd";
  33.  
  34. //Level pers, these decide variables and which default functions we will be using.
  35.  
  36. level.endGameOnScoreLimit = true;
  37. level.scoreRoundBased = false;
  38. level.teamBased = true;
  39. level.overrideTeamScore = true;
  40. level.maxPlayerCount = 24;
  41.  
  42. //For each one of these, we will need to define the function below in the GSC
  43. level.onPrecacheGameType = ::onPrecacheGameType;
  44. level.onStartGameType = ::onStartGameType;
  45. level.onSpawnPlayer = ::onSpawnPlayer;
  46. level.onSpawnPlayerUnified = ::onSpawnPlayerUnified;
  47. level.onRoundEndGame = ::onRoundEndGame;
  48. level.onPlayerKilled = ::onPlayerKilled;
  49. level.onOneLeftEvent = ::onOneLeftEvent;
  50. level.onRoundEndGame = ::onRoundEndGame;
  51. level.onPlayerDamage = ::onPlayerDamage;
  52. level.onRoundSwitch = ::onRoundSwitch;
  53. level.onDeadEvent = ::onDeadEvent;
  54.  
  55. //Load our FX
  56. level._effect[ "burn_barrier" ] = LoadFX( "env/fire/fx_fire_line_sm" );
  57. level._effect[ "player_infected" ] = LoadFX( "maps/zombie/fx_zombie_dog_lightning_spawn" );
  58. level._effect["player_got_infected"] = LoadFX( "env/light/fx_light_square_white" );
  59.  
  60. //Load our game sounds
  61. game["dialog"]["gametype"] = "snd_start";
  62. game["dialog"]["gametype_hardcore"] = "hcsnd_start";
  63. game["dialog"]["sudden_death"] = "generic_boost";
  64. game["dialog"]["last_one"] = "encourage_last";
  65. game["dialog"]["halftime"] = "sd_halftime";
  66.  
  67. //Set our scoreboard columns (requires additional work)
  68. setscoreboardcolumns( "Cleaned", "infected", "suicide", "assists" );
  69.  
  70. //Start any threads we will want to always monitor that belong to the level
  71. level thread onPlayerConnect();
  72. }



4. Define functions

As mentioned above, you will need to define each one of the functions you call in main.

I always start with this one:

C++ Code
  1. onStartGameType()
  2. {
  3. //This is hud text
  4. level.drawCopy = level CreateServerFontString( "objective", 1.0 );
  5. level.drawCopy setPoint( "LEFTBOTTOM", "LEFTBOTTOM", 0,0 );
  6. level.drawCopy setText( "^1INFECTED ^7::^1 2.3.2b ^7::^1 Build: 2034" );
  7.  
  8. //I set this dvar here, but could be set in cfg file.
  9. SetDvar( "xblive_privatematch", 0 );
  10.  
  11. //Define level pers that start over each round
  12. level.killstreaksenabled = 1;
  13. level.hardpointsenabled = 1;
  14. level.hardcoreMode = false;
  15. level.firstInfected = false;
  16. level.maxBarriers = 0;
  17. level.dogCount = 0;
  18. level.botCount = 0;
  19. setClientNameMode( "manual_change" );
  20.  
  21. //This calls a function (below) that sets the location strings
  22. infTeamSet();
  23.  
  24. //Set our objective text (can be custom from localized strings)
  25. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveText( game["attackers"], &"OBJECTIVES_SD_ATTACKER" );
  26. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveText( game["defenders"], &"OBJECTIVES_SD_DEFENDER" );
  27. if ( level.splitscreen )
  28. {
  29. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveScoreText( game["attackers"], &"OBJECTIVES_SD_ATTACKER" );
  30. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveScoreText( game["defenders"], &"OBJECTIVES_SD_DEFENDER" );
  31. }
  32. else
  33. {
  34. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveScoreText( game["attackers"], &"OBJECTIVES_SD_ATTACKER_SCORE" );
  35. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveScoreText( game["defenders"], &"OBJECTIVES_SD_DEFENDER_SCORE" );
  36. }
  37. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveHintText( game["attackers"], &"OBJECTIVES_SD_ATTACKER_HINT" );
  38. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveHintText( game["defenders"], &"OBJECTIVES_SD_DEFENDER_HINT" );
  39.  
  40. //Define spawn points
  41. level.spawnMins = ( 0, 0, 0 );
  42. level.spawnMaxs = ( 0, 0, 0 );
  43.  
  44. maps\mp\gametypes\_spawnlogic::placeSpawnPoints( "mp_tdm_spawn_allies_start" );
  45. maps\mp\gametypes\_spawnlogic::placeSpawnPoints( "mp_tdm_spawn_axis_start" );
  46. maps\mp\gametypes\_spawnlogic::addSpawnPoints( "allies", "mp_tdm_spawn" );
  47. maps\mp\gametypes\_spawnlogic::addSpawnPoints( "axis", "mp_tdm_spawn" );
  48. maps\mp\gametypes\_spawning::updateAllSpawnPoints();
  49.  
  50. level.spawn_axis_start= maps\mp\gametypes\_spawnlogic::getSpawnpointArray("mp_tdm_spawn_axis_start");
  51. level.spawn_allies_start= maps\mp\gametypes\_spawnlogic::getSpawnpointArray("mp_tdm_spawn_allies_start");
  52. level.mapCenter = maps\mp\gametypes\_spawnlogic::findBoxCenter( level.spawnMins, level.spawnMaxs );
  53. setMapCenter( level.mapCenter );
  54.  
  55. spawnpoint = maps\mp\gametypes\_spawnlogic::getRandomIntermissionPoint();
  56. setDemoIntermissionPoint( spawnpoint.origin, spawnpoint.angles );
  57.  
  58. //This is for the barriers in small map versions
  59. allowed[0] = "tdm";
  60.  
  61. //Misc Variables
  62. level.displayRoundEndText = true;
  63. maps\mp\gametypes\_gameobjects::main( allowed );
  64.  
  65. maps\mp\gametypes\_spawning::create_map_placed_influencers();
  66.  
  67. if ( !isOneRound() )
  68. {
  69. level.displayRoundEndText = true;
  70. if( isScoreRoundBased() )
  71. {
  72. maps\mp\gametypes\_globallogic_score::resetTeamScores();
  73. }
  74. }
  75. maps\mp\gametypes\_rank::registerScoreInfo( "infected", 0 );
  76. maps\mp\gametypes\_rank::registerScoreInfo( "cleaned", 0 );
  77. maps\mp\gametypes\_rank::registerScoreInfo( "assist", 0 );
  78. maps\mp\gametypes\_rank::registerScoreInfo( "suicide", 0 );
  79. maps\mp\gametypes\_rank::registerScoreInfo( "teamkill", 0 );
  80.  
  81. //Set threads that restart on round change or game start
  82.  
  83. level thread firstInfected( self );
  84. level thread doPlayerCount();
  85. }


We are going to continue to define functions...

C++ Code
  1. infTeamSet()
  2. {
  3. SetDvar( "g_TeamName_allies", &"INFECTED_SHORT" );
  4. SetDvar( "g_TeamName_axis", &"INFECTED_HUMANS_SHORT" );
  5. game[ "strings" ][ "allies_win" ] = &"INFECTED_WIN_MATCH";
  6. game[ "strings" ][ "allies_win_round" ] = &"INFECTED_WIN_ROUND";
  7. game[ "strings" ][ "allies_mission_accomplished" ] = &"INFECTED_MISSION_ACCOMPLISHED";
  8. game[ "strings" ][ "allies_eliminated" ] = &"INFECTED_ELIMINATED";
  9. game[ "strings" ][ "allies_forfeited" ] = &"INFECTED_FORFEITED";
  10. game[ "strings" ][ "allies_name" ] = &"INFECTED_NAME";
  11. }
  12.  
  13. checkAllowSpectating()
  14. {
  15. wait ( 0.05 );
  16. update = false;
  17. if( !level.aliveCount[ game[ "allies" ] ] )
  18. {
  19. level.spectateOverride[game[ "allies" ]].allowEnemySpectate = 1;
  20. update = true;
  21. }
  22. if( !level.aliveCount[ game[ "axis" ] ] )
  23. {
  24. level.spectateOverride[game[ "axis" ] ].allowEnemySpectate = 1;
  25. update = true;
  26. }
  27. if( update )
  28. {
  29. maps\mp\gametypes\_spectating::updateSpectateSettings();
  30. }
  31. }
  32.  
  33. onPrecacheGameType()
  34. {
  35.  
  36. }
  37.  
  38. onSpawnPlayerUnified()
  39. {
  40. self.usingObj = undefined;
  41. if ( level.useStartSpawns && !level.inGracePeriod )
  42. {
  43. level.useStartSpawns = true;
  44. }
  45. maps\mp\gametypes\_spawning::onSpawnPlayer_Unified();
  46. }
  47.  
  48. onOneLeftEvent( team )
  49. {
  50. self iPrintln("YOU ARE THE LAST PLAYER ON YOUR TEAM: " + team);
  51. }
  52. getSpawnPoint()
  53. {
  54. spawnteam = self.pers[ "team" ];
  55. if ( IsDefined( game[ "switchedsides" ] ) && game[ "switchedsides" ] )
  56. {
  57. spawnteam = getOtherTeam( spawnteam );
  58. }
  59. if ( level.inGracePeriod )
  60. {
  61. spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_tdm_spawn_" + spawnteam + "_start" );
  62. if ( !spawnPoints.size )
  63. spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_sab_spawn_" + spawnteam + "_start" );
  64. if ( !spawnPoints.size )
  65. {
  66. spawnPoints = maps\mp\gametypes\_spawnlogic::getTeamSpawnPoints( spawnteam );
  67. spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam( spawnPoints );
  68. }
  69. else
  70. {
  71. spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random( spawnPoints );
  72. }
  73. }
  74. else
  75. {
  76. spawnPoints = maps\mp\gametypes\_spawnlogic::getTeamSpawnPoints( spawnteam );
  77. spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam( spawnPoints );
  78. }
  79. return spawnPoint;
  80. }


Getting into the good functions now:

C++ Code
  1. onSpawnPlayer()
  2. {
  3. //What to do when a request to spawn player is called
  4. //This is not "onPlayerSpawned" which is a different function (below)
  5.  
  6. spawnteam = self.pers["team"];
  7. spawnteam = getOtherTeam( spawnteam );
  8.  
  9. if ( level.useStartSpawns )
  10. {
  11. if (spawnteam == "axis")
  12. spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random(level.spawn_axis_start);
  13. else
  14. spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random(level.spawn_allies_start);
  15. }
  16. else
  17. {
  18.  
  19. if (spawnteam == "axis")
  20. spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam(level.spawn_axis);
  21. else
  22. spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam(level.spawn_allies);
  23. }
  24.  
  25. assert( isDefined(spawnpoint) );
  26.  
  27. buildhud();
  28.  
  29. self spawn( spawnPoint.origin, spawnPoint.angles, "tdm");
  30.  
  31. //Everything from here down will occur only one time after player connects
  32. self takeAllWeapons();
  33. currentWeapon = "knife_mp";
  34. self giveWeapon( currentWeapon );
  35. self SwitchToWeapon( currentWeapon );
  36. self.MaxDecoys = 0;
  37. self.HealthPacks = 0;
  38. self.zPortalUses = 0;
  39. self FreezeControls(true);
  40. self openMenu( "inf_choose_cl");
  41. self thread onMenuResponse();
  42. self thread doBarrierDamage();
  43. self.rewardedStage1 = 0;
  44. self.isFrozen = false;
  45. self.canFreeze = true;
  46. self.freezeTimer = false;
  47. self thread updateDogScore();
  48. }


Now, we have to continue to define each function we called in main...

C++ Code
  1. onEndGame( winningTeam )
  2. {
  3.  
  4. if( IsDefined( winningTeam ) && ( winningTeam == "allies" || winningTeam == "axis" ) )
  5. {
  6. [[ level._setTeamScore ]]( winningTeam, [[ level._getTeamScore ]]( winningTeam ) + 1 );
  7. }
  8. }
  9.  
  10. onRoundSWitch()
  11. {
  12. //This can all be custom...
  13.  
  14. }
  15.  
  16.  
  17. onRoundEndGame( winningTeam )
  18. {
  19.  
  20. //this can all be custom...
  21.  
  22. }
  23.  
  24. onScoreCloseMusic()
  25. {
  26. //who really cares?
  27. while( !level.gameEnded )
  28. {
  29. axisScore = [[ level._getTeamScore ]]( "axis" );
  30. alliedScore = [[ level._getTeamScore ]]( "allies" );
  31. scoreLimit = level.scoreLimit;
  32. scoreThreshold = scoreLimit * .1;
  33. scoreDif = abs( axisScore - alliedScore );
  34. scoreThresholdStart = abs( scoreLimit - scoreThreshold );
  35. scoreLimitCheck = scoreLimit - 10;
  36. if ( alliedScore > axisScore )
  37. {
  38. currentScore = alliedScore;
  39. }
  40. else
  41. {
  42. currentScore = axisScore;
  43. }
  44. if ( scoreDif <= scoreThreshold && scoreThresholdStart <= currentScore )
  45. {
  46.  
  47. thread maps\mp\gametypes\_globallogic_audio:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />et_music_on_team( "TIME_OUT", "both" );
  48. thread maps\mp\gametypes\_globallogic_audio::actionMusicSet();
  49. return;
  50. }
  51. wait( .5 );
  52. }
  53. }
  54.  
  55.  
  56. onPlayerSpawned()
  57. {
  58.  
  59. self endon( "disconnect" );
  60. self waittill( "spawned_player" );
  61.  
  62. // This is all you need here, after this, can all be custom...
  63. }


C++ Code
  1. onPlayerKilled( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration )
  2. {
  3. //can be all custom...
  4.  
  5. }
  6.  
  7. onPlayerConnect()
  8. {
  9. for( ;; )
  10. {
  11. level waittill( "connected", player );
  12. wait 0.05;
  13. player thread onPlayerSpawned();
  14. player thread onPlayerDisconnect();
  15. // You want to attach any threads to the player here...
  16. }
  17. }
  18.  
  19. onPlayerDisconnect()
  20. {
  21. level endon( "game_ended" );
  22. self waittill( "disconnect" );
  23. //Again, can set custom code here.
  24. }
  25.  
  26. onPlayerDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime )
  27. {
  28.  
  29. // All custom code here
  30.  
  31. }
  32.  
  33. onDeadEvent( team )
  34. {
  35. //Again, this function is called in MAIN.
  36. //Can be all custom code...
  37. if(level.inMiniGame )
  38. {
  39. return;
  40. }
  41. if ( team == "all" )
  42. {
  43. inf_endGameWithKillcam( game["defenders"], "EVERYONE IS DEAD" );
  44. }
  45. else if ( team == game["attackers"] )
  46. {
  47. inf_endGameWithKillcam( game["defenders"], "ALL INFECTION CLEANED" );
  48. }
  49. else if ( team == game["defenders"] )
  50. {
  51. inf_endGameWithKillcam( game["attackers"], "ALL HUMANS INFECTED" );
  52. }
  53. }


And that's it.

Now, save it, change it, save it and add it to mod.csv as a raw file.

Follow the thread to create localized strings and get rid of all your
other hacked up rank.gsc files.

This is the only GSC file you will have to have in your mod folder.

Everything else you can call by reaching out to that file.

Here is the entire GSC file:

C++ Code
  1. #include maps\mp\_utility;
  2. #include maps\mp\gametypes\_hud_util;
  3. #include common_scripts\utility;
  4. #using_animtree( "generic_human" );
  5. main()
  6. {
  7. if( GetDvar( #"mapname" ) == "mp_background" )
  8. {
  9. return;
  10. }
  11.  
  12. preCacheModel( "p_glo_barricade_wood_barb_pow" );
  13. precacheitem( "satchel_charge_mp" );
  14. precacheitem( "commando_mp_wtf" );
  15. precacheitem( "ray_gun_zm" );
  16. precacheMenu( "inf_choose_cl" );
  17. precachemodel( "c_brt_fullahead_soldier_body_g_torso" );
  18. precacheitem( "crayons_mp5" );
  19. precachemodel( "infected_char_3" );
  20. precacheitem( "crayons_mp5" );
  21. precachemodel( "mp_cone" );
  22.  
  23.  
  24. maps\mp\gametypes\_globallogic::init();
  25. maps\mp\gametypes\_callbacksetup::SetupCallbacks();
  26. maps\mp\gametypes\_globallogic::SetupCallbacks();
  27. maps\mp\gametypes\_damagefeedback::init();
  28. maps\mp\gametypes\_tweakables::init();
  29. maps\mp\gametypes\_globallogic_utils::registerTimeLimitDvar( level.gameType, 3.75, 0, 1440 );
  30. maps\mp\gametypes\_globallogic_utils::registerScoreLimitDvar( level.gameType, 100, 0, 50000 );
  31. maps\mp\gametypes\_globallogic_utils::registerRoundLimitDvar( level.gametype, 3, 0, 10 );
  32. maps\mp\gametypes\_globallogic_utils::registerRoundWinLimitDvar( level.gametype, 2, 0, 10 );
  33. maps\mp\gametypes\_globallogic_utils::registerNumLivesDvar( level.gametype, 1, 0, 10 );
  34. maps\mp\gametypes\_serversettings::constrainMapSize(4);
  35. level.gametype = "sd";
  36.  
  37. level.endGameOnScoreLimit = true;
  38. level.scoreRoundBased = false;
  39. level.teamBased = true;
  40. level.overrideTeamScore = true;
  41. level.maxPlayerCount = 24;
  42. level.onPrecacheGameType = ::onPrecacheGameType;
  43. level.onStartGameType = ::onStartGameType;
  44. level.onSpawnPlayer = ::onSpawnPlayer;
  45. level.onSpawnPlayerUnified = ::onSpawnPlayerUnified;
  46. level.onRoundEndGame = ::onRoundEndGame;
  47. level.onPlayerKilled = ::onPlayerKilled;
  48. level.onOneLeftEvent = ::onOneLeftEvent;
  49. level.onRoundEndGame = ::onRoundEndGame;
  50. level.onPlayerDamage = ::onPlayerDamage;
  51. level.onRoundSwitch = ::onRoundSwitch;
  52. level.onDeadEvent = ::onDeadEvent;
  53.  
  54. level._effect[ "burn_barrier" ] = LoadFX( "env/fire/fx_fire_line_sm" );
  55. level._effect[ "player_infected" ] = LoadFX( "maps/zombie/fx_zombie_dog_lightning_spawn" );
  56. level._effect["player_got_infected"] = LoadFX( "env/light/fx_light_square_white" );
  57.  
  58. game["dialog"]["gametype"] = "snd_start";
  59. game["dialog"]["gametype_hardcore"] = "hcsnd_start";
  60. game["dialog"]["sudden_death"] = "generic_boost";
  61. game["dialog"]["last_one"] = "encourage_last";
  62. game["dialog"]["halftime"] = "sd_halftime";
  63.  
  64. setscoreboardcolumns( "Cleaned", "infected", "suicide", "assists" );
  65.  
  66. level thread onPlayerConnect();
  67. }
  68.  
  69. onStartGameType()
  70. {
  71.  
  72. level.drawCopy = level CreateServerFontString( "objective", 1.0 );
  73. level.drawCopy setPoint( "LEFTBOTTOM", "LEFTBOTTOM", 0,0 );
  74. level.drawCopy setText( "^1INFECTED ^7::^1 2.3.2b ^7::^1 Build: 2034" );
  75.  
  76. SetDvar( "xblive_privatematch", 0 );
  77.  
  78. level.killstreaksenabled = 1;
  79. level.hardpointsenabled = 1;
  80. level.hardcoreMode = false;
  81. level.firstInfected = false;
  82. level.maxBarriers = 0;
  83. level.dogCount = 0;
  84. level.botCount = 0;
  85. setClientNameMode( "manual_change" );
  86.  
  87. infTeamSet();
  88.  
  89.  
  90. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveText( game["attackers"], &"OBJECTIVES_SD_ATTACKER" );
  91. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveText( game["defenders"], &"OBJECTIVES_SD_DEFENDER" );
  92. if ( level.splitscreen )
  93. {
  94. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveScoreText( game["attackers"], &"OBJECTIVES_SD_ATTACKER" );
  95. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveScoreText( game["defenders"], &"OBJECTIVES_SD_DEFENDER" );
  96. }
  97. else
  98. {
  99. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveScoreText( game["attackers"], &"OBJECTIVES_SD_ATTACKER_SCORE" );
  100. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveScoreText( game["defenders"], &"OBJECTIVES_SD_DEFENDER_SCORE" );
  101. }
  102. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveHintText( game["attackers"], &"OBJECTIVES_SD_ATTACKER_HINT" );
  103. maps\mp\gametypes\_globallogic_ui:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />etObjectiveHintText( game["defenders"], &"OBJECTIVES_SD_DEFENDER_HINT" );
  104.  
  105. level.spawnMins = ( 0, 0, 0 );
  106. level.spawnMaxs = ( 0, 0, 0 );
  107.  
  108. maps\mp\gametypes\_spawnlogic::placeSpawnPoints( "mp_tdm_spawn_allies_start" );
  109. maps\mp\gametypes\_spawnlogic::placeSpawnPoints( "mp_tdm_spawn_axis_start" );
  110. maps\mp\gametypes\_spawnlogic::addSpawnPoints( "allies", "mp_tdm_spawn" );
  111. maps\mp\gametypes\_spawnlogic::addSpawnPoints( "axis", "mp_tdm_spawn" );
  112. maps\mp\gametypes\_spawning::updateAllSpawnPoints();
  113.  
  114. level.spawn_axis_start= maps\mp\gametypes\_spawnlogic::getSpawnpointArray("mp_tdm_spawn_axis_start");
  115. level.spawn_allies_start= maps\mp\gametypes\_spawnlogic::getSpawnpointArray("mp_tdm_spawn_allies_start");
  116. level.mapCenter = maps\mp\gametypes\_spawnlogic::findBoxCenter( level.spawnMins, level.spawnMaxs );
  117. setMapCenter( level.mapCenter );
  118.  
  119. spawnpoint = maps\mp\gametypes\_spawnlogic::getRandomIntermissionPoint();
  120. setDemoIntermissionPoint( spawnpoint.origin, spawnpoint.angles );
  121.  
  122. allowed[0] = "tdm";
  123.  
  124. level.displayRoundEndText = true;
  125. maps\mp\gametypes\_gameobjects::main( allowed );
  126.  
  127. maps\mp\gametypes\_spawning::create_map_placed_influencers();
  128.  
  129. if ( !isOneRound() )
  130. {
  131. level.displayRoundEndText = true;
  132. if( isScoreRoundBased() )
  133. {
  134. maps\mp\gametypes\_globallogic_score::resetTeamScores();
  135. }
  136. }
  137. maps\mp\gametypes\_rank::registerScoreInfo( "infected", 0 );
  138. maps\mp\gametypes\_rank::registerScoreInfo( "cleaned", 0 );
  139. maps\mp\gametypes\_rank::registerScoreInfo( "assist", 0 );
  140. maps\mp\gametypes\_rank::registerScoreInfo( "suicide", 0 );
  141. maps\mp\gametypes\_rank::registerScoreInfo( "teamkill", 0 );
  142.  
  143. level thread firstInfected( self );
  144. level thread doPlayerCount();
  145. }
  146.  
  147.  
  148. infTeamSet()
  149. {
  150. SetDvar( "g_TeamName_allies", &"INFECTED_SHORT" );
  151. SetDvar( "g_TeamName_axis", &"INFECTED_HUMANS_SHORT" );
  152. game[ "strings" ][ "allies_win" ] = &"INFECTED_WIN_MATCH";
  153. game[ "strings" ][ "allies_win_round" ] = &"INFECTED_WIN_ROUND";
  154. game[ "strings" ][ "allies_mission_accomplished" ] = &"INFECTED_MISSION_ACCOMPLISHED";
  155. game[ "strings" ][ "allies_eliminated" ] = &"INFECTED_ELIMINATED";
  156. game[ "strings" ][ "allies_forfeited" ] = &"INFECTED_FORFEITED";
  157. game[ "strings" ][ "allies_name" ] = &"INFECTED_NAME";
  158. }
  159.  
  160. checkAllowSpectating()
  161. {
  162. wait ( 0.05 );
  163. update = false;
  164. if( !level.aliveCount[ game[ "allies" ] ] )
  165. {
  166. level.spectateOverride[game[ "allies" ]].allowEnemySpectate = 1;
  167. update = true;
  168. }
  169. if( !level.aliveCount[ game[ "axis" ] ] )
  170. {
  171. level.spectateOverride[game[ "axis" ] ].allowEnemySpectate = 1;
  172. update = true;
  173. }
  174. if( update )
  175. {
  176. maps\mp\gametypes\_spectating::updateSpectateSettings();
  177. }
  178. }
  179.  
  180. onPrecacheGameType()
  181. {
  182.  
  183. }
  184.  
  185. onSpawnPlayerUnified()
  186. {
  187. self.usingObj = undefined;
  188. if ( level.useStartSpawns && !level.inGracePeriod )
  189. {
  190. level.useStartSpawns = true;
  191. }
  192. maps\mp\gametypes\_spawning::onSpawnPlayer_Unified();
  193. }
  194.  
  195. onOneLeftEvent( team )
  196. {
  197. self iPrintln("YOU ARE THE LAST PLAYER ON YOUR TEAM: " + team);
  198. }
  199.  
  200. makeDark( yORn )
  201. {
  202. if( yORn )
  203. {
  204.  
  205. start_dist = 240.413;
  206. half_dist = 600.047;
  207. half_height = 900.18;
  208. base_height = 900.00;
  209. fog_r = 0.000000;
  210. fog_g = 0.000000;
  211. fog_b = 0.000000;
  212. fog_scale = 100.14297;
  213. sun_col_r = 0.000000;
  214. sun_col_g = 0.000000;
  215. sun_col_b = 0.000000;
  216. sun_dir_x = -0.000000;
  217. sun_dir_y = -0.000000;
  218. sun_dir_z = 0.000000;
  219. sun_start_ang = 00.000;
  220. sun_stop_ang = 00.000;
  221. time = 0;
  222. max_fog_opacity = 1.25;
  223. setVolFog(start_dist, half_dist, half_height, base_height, fog_r, fog_g, fog_b, fog_scale,
  224. sun_col_r, sun_col_g, sun_col_b, sun_dir_x, sun_dir_y, sun_dir_z, sun_start_ang,
  225. sun_stop_ang, time, max_fog_opacity);
  226. }
  227. }
  228.  
  229. giveCustomLoadout( takeAllWeapons, alreadySpawned, health )
  230. {
  231. if( !IsDefined( self.gunProgress ) )
  232. {
  233. self.gunProgress = 0;
  234. }
  235. self.maxhealth = int( health );
  236. self.health = self.maxhealth;
  237.  
  238. self takeAllWeapons();
  239.  
  240. currentWeapon = "knife_ballistic_mp";
  241.  
  242. self giveWeapon( currentWeapon );
  243. self SwitchToWeapon( currentWeapon );
  244. self GiveWeapon( "knife_mp" );
  245.  
  246. self shellShock( "damage_mp", 3.0 );
  247.  
  248. self SetMoveSpeedScale( 1.45 );
  249.  
  250. self SetPerk( "specialty_fastreload" );
  251. self SetPerk( "specialty_fastads" );
  252. self SetPerk( "specialty_sprintrecovery" );
  253. self SetPerk( "specialty_longersprint" );
  254. self SetPerk( "specialty_quieter" );
  255. self SetPerk( "specialty_bulletpenetration" );
  256. self SetPerk( "specialty_armorpiercing" );
  257. self SetPerk( "specialty_bulletflinch" );
  258. self SetPerk( "specialty_scavenger" );
  259. self SetPerk( "specialty_extraammo" );
  260. self SetPerk( "specialty_nottargetedbyai" );
  261. self SetPerk( "specialty_noname" );
  262.  
  263. if( !IsDefined( alreadySpawned ) || !alreadySpawned )
  264. {
  265. self SetSpawnWeapon( currentWeapon );
  266. }
  267. if( IsDefined( takeAllWeapons ) && !takeAllWeapons )
  268. {
  269. self thread takeOldWeapons( currentWeapon );
  270. }
  271. else
  272. {
  273. self EnableWeaponCycling();
  274. }
  275. return currentWeapon;
  276. }
  277.  
  278. doPlayerCount()
  279. {
  280. level waittill( "prematch_over" );
  281. if( !IsDefined( level.inMiniGame ) )
  282. level.inMiniGame = false;
  283. for( ;; )
  284. {
  285. wait 5;
  286.  
  287. if( getsizeofteam( "axis" ) > 3 )
  288. {
  289. if( IsDefined( level.pCount ) )
  290. {
  291. level.pCount Destroy();
  292. }
  293. if( isDefined( level.mgAlert ) )
  294. {
  295. level.mgAlert Destroy();
  296. }
  297. level notify( "player_count_ok" );
  298. break;
  299. }
  300.  
  301.  
  302. if( !level.inMiniGame || !isDefined( level.inMiniGame ) )
  303. {
  304. level thread startMiniGame( "endless_dogs", 8, 4 );
  305. break;
  306. }
  307. }
  308. }
  309.  
  310.  
  311.  
  312.  
  313. firstInfected( dontIncludeMe )
  314. {
  315.  
  316. level endon( "first_infected_true" );
  317. level waittill ( "prematch_over" );
  318. level waittill ( "player_count_ok" );
  319. level.inMiniGame = false;
  320. if( isdefined( self.dScore ) )
  321. {
  322. self.dScore Destroy();
  323. }
  324. level thread maps\mp\inf_dogs::make_all_dogs_leave();
  325. level.drawTAlert = level CreateServerFontString( "objective", 1.5 );
  326. level.drawTAlert setPoint( 0, 0, 0, -20);
  327. level.drawTAlert setText( "^1SELECTING RANDOM HUMAN FOR INFECTION^7" );
  328. wait 0.5;
  329. x = 1;
  330. while (x <= 5)
  331. {
  332. if( IsDefined( level.drawWarning ) )
  333. {
  334. level.drawWarning Destroy();
  335. }
  336. level.drawWarning = level CreateServerFontString( "objective", 2.0 );
  337. level.drawWarning setPoint( 0, 0, 0, 0);
  338. level.drawWarning setText("^3" + x );
  339. wait 1.0;
  340. if( x == 1 )
  341. {
  342. VisionSetNaked( "mp_infected", 4.0 );
  343. }
  344. if( x == 5 )
  345. {
  346. level.drawWarning fadeOverTime( 1.25 );
  347. level.drawTAlert fadeOverTime( 1.25 );
  348. wait 1.5;
  349. level.drawWarning Destroy();
  350. level.drawTAlert Destroy();
  351.  
  352. }
  353. x++;
  354. }
  355.  
  356. wait 1.0;
  357.  
  358. candidates = [ ];
  359. axisPlayers = [ ];
  360. players = GetEntArray( "player", "classname" );
  361. for( x = 0; x < players.size; x++ )
  362. {
  363. player = players[ x ];
  364. if( IsDefined( player.pers[ "team" ] ) && player.pers[ "team" ] == "axis" )
  365. {
  366. axisPlayers[ axisPlayers.size ] = player;
  367. if( ( IsDefined( dontIncludeMe ) ) && ( dontIncludeMe == player ) )
  368. {
  369. continue;
  370. }
  371. candidates[ candidates.size ] = player;
  372. }
  373. }
  374. if( axisPlayers.size == 1 )
  375. {
  376. num = RandomInt( axisPlayers.size );
  377. axisPlayers[ num ] makeHuman( true, true );
  378. }
  379. else if( axisPlayers.size > 1 )
  380. {
  381. if( candidates.size > 0 )
  382. {
  383. num = RandomInt( candidates.size );
  384. candidates[ num ] makeHuman( true, true );
  385. return;
  386. }
  387. else
  388. {
  389. num = RandomInt( axisPlayers.size );
  390. axisPlayers[ num ] makeHuman( true, true );
  391. return;
  392. }
  393. }
  394.  
  395.  
  396. }
  397. getSizeOfTeam( team )
  398. {
  399. players = GetEntArray( "player", "classname" );
  400. playerNum = 0;
  401. for( x = 0; x < players.size; x++ )
  402. {
  403. if( IsDefined( players[ x ].pers[ "team" ] ) && players[ x ].pers[ "team" ] == team )
  404. {
  405. playerNum++;
  406. }
  407. }
  408. return playerNum;
  409. }
  410. getSpawnPoint()
  411. {
  412. spawnteam = self.pers[ "team" ];
  413. if ( IsDefined( game[ "switchedsides" ] ) && game[ "switchedsides" ] )
  414. {
  415. spawnteam = getOtherTeam( spawnteam );
  416. }
  417. if ( level.inGracePeriod )
  418. {
  419. spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_tdm_spawn_" + spawnteam + "_start" );
  420. if ( !spawnPoints.size )
  421. spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_sab_spawn_" + spawnteam + "_start" );
  422. if ( !spawnPoints.size )
  423. {
  424. spawnPoints = maps\mp\gametypes\_spawnlogic::getTeamSpawnPoints( spawnteam );
  425. spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam( spawnPoints );
  426. }
  427. else
  428. {
  429. spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random( spawnPoints );
  430. }
  431. }
  432. else
  433. {
  434. spawnPoints = maps\mp\gametypes\_spawnlogic::getTeamSpawnPoints( spawnteam );
  435. spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam( spawnPoints );
  436. }
  437. return spawnPoint;
  438. }
  439.  
  440.  
  441.  
  442. onSpawnPlayer()
  443. {
  444. spawnteam = self.pers["team"];
  445. spawnteam = getOtherTeam( spawnteam );
  446.  
  447. if ( level.useStartSpawns )
  448. {
  449. if (spawnteam == "axis")
  450. spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random(level.spawn_axis_start);
  451. else
  452. spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random(level.spawn_allies_start);
  453. }
  454. else
  455. {
  456.  
  457. if (spawnteam == "axis")
  458. spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam(level.spawn_axis);
  459. else
  460. spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam(level.spawn_allies);
  461. }
  462.  
  463. assert( isDefined(spawnpoint) );
  464.  
  465. buildhud();
  466.  
  467. self spawn( spawnPoint.origin, spawnPoint.angles, "tdm");
  468.  
  469. self takeAllWeapons();
  470. currentWeapon = "knife_mp";
  471. self giveWeapon( currentWeapon );
  472. self SwitchToWeapon( currentWeapon );
  473. self.MaxDecoys = 0;
  474. self.HealthPacks = 0;
  475. self.zPortalUses = 0;
  476. self FreezeControls(true);
  477. self openMenu( "inf_choose_cl");
  478. self thread onMenuResponse();
  479. self thread doBarrierDamage();
  480. self.rewardedStage1 = 0;
  481. self.isFrozen = false;
  482. self.canFreeze = true;
  483. self.freezeTimer = false;
  484. self thread updateDogScore();
  485.  
  486.  
  487. }
  488.  
  489. onEndGame( winningTeam )
  490. {
  491.  
  492. if( IsDefined( winningTeam ) && ( winningTeam == "allies" || winningTeam == "axis" ) )
  493. {
  494. [[ level._setTeamScore ]]( winningTeam, [[ level._getTeamScore ]]( winningTeam ) + 1 );
  495. }
  496. }
  497.  
  498. onRoundSWitch()
  499. {
  500. if( level.firstInfected )
  501. {
  502. level.firstInfected = false;
  503. }
  504. if( level.inMiniGame || !IsDefined(level.inMiniGame) )
  505. {
  506. level.inMiniGame = false;
  507. level.dogKills = 0;
  508. self.rewardedStage1 = 0;
  509. level thread mg_kickTeam("allies");
  510. }
  511.  
  512.  
  513.  
  514. }
  515.  
  516.  
  517. onRoundEndGame( winningTeam )
  518. {
  519. [[level._setTeamScore]]( "allies", game["roundswon"]["allies"] );
  520. [[level._setTeamScore]]( "axis", game["roundswon"]["axis"] );
  521.  
  522. if ( game["roundswon"]["allies"] == game["roundswon"]["axis"] )
  523. winner = "tie";
  524. else if ( game["roundswon"]["axis"] > game["roundswon"]["allies"] )
  525. winner = "axis";
  526. else
  527. winner = "allies";
  528.  
  529. return winner;
  530. }
  531.  
  532. onScoreCloseMusic()
  533. {
  534. while( !level.gameEnded )
  535. {
  536. axisScore = [[ level._getTeamScore ]]( "axis" );
  537. alliedScore = [[ level._getTeamScore ]]( "allies" );
  538. scoreLimit = level.scoreLimit;
  539. scoreThreshold = scoreLimit * .1;
  540. scoreDif = abs( axisScore - alliedScore );
  541. scoreThresholdStart = abs( scoreLimit - scoreThreshold );
  542. scoreLimitCheck = scoreLimit - 10;
  543. if ( alliedScore > axisScore )
  544. {
  545. currentScore = alliedScore;
  546. }
  547. else
  548. {
  549. currentScore = axisScore;
  550. }
  551. if ( scoreDif <= scoreThreshold && scoreThresholdStart <= currentScore )
  552. {
  553.  
  554. thread maps\mp\gametypes\_globallogic_audio:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />et_music_on_team( "TIME_OUT", "both" );
  555. thread maps\mp\gametypes\_globallogic_audio::actionMusicSet();
  556. return;
  557. }
  558. wait( .5 );
  559. }
  560. }
  561.  
  562.  
  563. onPlayerSpawned()
  564. {
  565.  
  566. self endon( "disconnect" );
  567. self waittill( "spawned_player" );
  568.  
  569. buildhud();
  570.  
  571. self giveWeapon( "crayons_mp5" );
  572.  
  573. if(self.pers[ "team" ] == "allies")
  574. {
  575. self thread makeHuman(false, false);
  576. }
  577. self notify( "ok_to_loadout" );
  578. }
  579.  
  580.  
  581. onPlayerKilled( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration )
  582. {
  583. buildhud();
  584.  
  585.  
  586. self iprintln( "^1DAMAGE:^7 Took " + idamage + " from " + attacker.name );
  587.  
  588.  
  589. if( IsDefined(level.inminiGame) && level.inMiniGame && self.pers[ "team" ] == "allies" )
  590. {
  591. if(level.mgLevel < 2 && level.dogCount < 4)
  592. {
  593.  
  594. level thread mg_add_bots(1);
  595. level.botCount ++;
  596.  
  597. }
  598. level.botCount--;
  599. kick( self getEntityNumber() );
  600. }
  601.  
  602. if( isDefined( level.inMiniGame) && level.inMiniGame )
  603. {
  604. self.pers["lives"] += 1;
  605. spawnPoint = self maps\mp\gametypes\_spawning::get_best_spawnpoint( "axis", "allies", self );
  606. self SetOrigin( spawnPoint.origin );
  607. self SetPlayerAngles( spawnPoint.angles );
  608. self notify( "weapon_change", "none" );
  609. self.rewardedStage1 = self.rewardedStage1;
  610. wait 2.0;
  611. }
  612.  
  613. [[level._setTeamScore]]( attacker.pers[ "team" ], [[level._getTeamScore]]( attacker.pers[ "team" ] ) + 1 );
  614.  
  615. self.MaxDecoys = 0;
  616. self.HealthPacks = 0;
  617. self.zPortalUses = 0;
  618.  
  619.  
  620. if( sWeapon == "dog_bite_mp" )
  621. {
  622. if( !isDefined( self.dogDeaths ) )
  623. {
  624. self.dogDeaths = 0;
  625. }
  626. self.dogDeaths++;
  627. }
  628.  
  629. if( isDefined( self.infEnt ) )
  630. {
  631. destroyBarrierOnDeath();
  632. }
  633. self endon( "spawned" );
  634. }
  635.  
  636. onPlayerConnect()
  637. {
  638. for( ;; )
  639. {
  640. level waittill( "connected", player );
  641. wait 0.05;
  642. player thread onPlayerSpawned();
  643. player thread onPlayerDisconnect();
  644. player thread monitorKeyPress();
  645. player thread updateDogScore();
  646. }
  647. }
  648.  
  649.  
  650.  
  651. onPlayerDisconnect()
  652. {
  653. level endon( "game_ended" );
  654. self waittill( "disconnect" );
  655. }
  656.  
  657. onPlayerDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime )
  658. {
  659.  
  660. buildhud();
  661.  
  662.  
  663. if( !isDefined( level.inMiniGame ) )
  664. level.inMiniGame = false;
  665.  
  666. if( isDefined( level.inMiniGame ) && level.inMiniGame )
  667. {
  668. if( sWeapon == "dog_bite_mp" && self.pers[ "team" ] == "axis" )
  669. {
  670. iDamage = 45;
  671. return iDamage;
  672. }
  673.  
  674. if( self.pers[ "team" ] == "allies" && level.inMiniGame)
  675. {
  676. iDamage = 55;
  677. return iDamage;
  678. }
  679. }
  680.  
  681.  
  682. if( !level.firstInfected && !level.inMiniGame )
  683. {
  684. iDamage = 1;
  685. return iDamage;
  686. }
  687.  
  688. if( self == eAttacker && sMeansOfDeath == "MOD_FALLING" )
  689. {
  690. iDamage = 35;
  691. return iDamage;
  692. }
  693.  
  694. if( self != eAttacker && sWeapon == "knife_ballistic_mp" && self.pers[ "team" ] == "axis" && !self.isFrozen && self.canFreeze != false)
  695. {
  696. self FreezeControls( true );
  697. self iprintln( "^1FROZEN: ^7 You have been frozen by: " + eAttacker.name );
  698. self iprintln( "^1FROZEN: ^7 Press MELEE to call for help" );
  699. self.isFrozen = true;
  700. self.freezeTimer = false;
  701. level.frozenPlayers++;
  702. maps\mp\_popups:<img src="https://www.itsmods.com/forum/images/smilies/biggrin.gif" alt="Big Grin" title="Big Grin" class="smilie smilie_4" />isplayTeamMessageToAll( "GOT FROZEN!", self );
  703. self thread doFreezeTimer( true, 10 );
  704. iDamage = 0;
  705. return iDamage;
  706. }
  707.  
  708. if( self.isFrozen && eAttacker.pers[ "team" ] == "axis" && sWeapon == "knife_mp" )
  709. {
  710. self FreezeControls( false );
  711. self iprintln( "^1FROZEN: ^7 You have been unfrozen by: " + eAttacker.name );
  712. self.isFrozen = false;
  713. level.frozenPlayers = level.frozenPlayers - 1;
  714. self.freezeTimer = true;
  715. level iprintln( "^1FROZEN: ^7" + self.name + " has been unfrozen!" );
  716. iDamage = 0;
  717. return iDamage;
  718. }
  719.  
  720. if( self.health <= 235 && self.isInfected == false && self != eAttacker && eAttacker.pers[ "team" ] == "allies" && self.isFrozen && sWeapon == "knife_ballistic_mp" )
  721. {
  722. self iprintlnbold( "^1YOU ARE INFECTED!" );
  723. self FreezeControls( false );
  724. self.isFrozen = false;
  725. self.freezeTimer = true;
  726. PlayFX( level._effect["player_got_infected"], self.origin + (0, 0, 0));
  727. self thread makeHuman(true, false);
  728. }
  729.  
  730. if( isDefined( level.infEnt ) && self.pers[ "team" ] != "axis" && sMeansOfDeath == "MOD_UNKNOWN" && self.pers[ "team" ] == "allies")
  731. {
  732. iDamage = 9000;
  733. return iDamage;
  734. }
  735. else if( self.pers[ "team" ] == "axis" && eAttacker.pers[ "team" ] == "allies" )
  736. {
  737. if(level.inMiniGame)
  738. {
  739. iDamage = 20;
  740. return iDamage;
  741. }
  742. else
  743. {
  744. iDamage = 80;
  745. return iDamage;
  746. }
  747. }
  748. else if( self.pers[ "team" ] == "axis" && sMeansOfDeath == "MOD_MELEE" && eAttacker.pers[ "team" ] == "allies" )
  749. {
  750. iDamage = 55;
  751. return iDamage;
  752. }
  753. else if( self.pers[ "team" ] == "allies" && sWeapon == "satchel_charge_mp" && getSizeOfTeam( "allies" ) > 3 )
  754. {
  755. iDamage = 0;
  756. self iprintlnbold ( "INFECTION CLEANED - YOU ARE HUMAN AGAIN" );
  757. self thread makeHuman( false, false);
  758. return iDamage;
  759. }
  760. else if( self.pers[ "team" ] == "allies" && self != eAttacker && eattacker.pers["team"] == "axis" )
  761. {
  762. iDamage = 50;
  763. return iDamage;
  764. }
  765. else
  766. {
  767. iDamage = 55;
  768. return iDamage;
  769. }
  770.  
  771. }
  772.  
  773.  
  774. makeHuman( isInfected, isLast )
  775. {
  776. self endon( "disconnect" );
  777.  
  778. if( IsDefined( isInfected ) && isInfected )
  779. {
  780. team = "allies";
  781. isInfected = true;
  782. cteam = "axis";
  783. }
  784. else
  785. {
  786. isInfected = false;
  787. team = "axis";
  788. cteam = "allies";
  789. }
  790.  
  791. playerAlive = IsAlive( self );
  792. self.pers[ "team" ] = team;
  793. self.team = team;
  794. self.pers[ "savedmodel" ] = undefined;
  795. self.pers[ "teamTime" ] = 0;
  796. self.sessionteam = team;
  797. self.tag_stowed_back = undefined;
  798. self.tag_stowed_hip = undefined;
  799.  
  800.  
  801. if( isInfected && playerAlive )
  802. {
  803. self.isInfected = true;
  804. if( isdefined( isLast ) && isLast == true )
  805. {
  806. self thread makeFirstInfected();
  807. buildhud();
  808. level notify( "first_infected_true" );
  809. self.isInfected = true;
  810. return;
  811. }
  812. else
  813. {
  814. self thread makeAfterInfected();
  815. buildhud();
  816. return;
  817. }
  818. }
  819. else
  820. {
  821. self DetachAll();
  822. self.isInfected = false;
  823. self.isInfectedDef = false;
  824. spawnPoint = self getSpawnPoint();
  825. self SetOrigin( spawnPoint.origin );
  826. self SetPlayerAngles( spawnPoint.angles);
  827. self thread maps\mp\gametypes\_friendicons:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />howFriendIcon();
  828. buildhud();
  829. }
  830. }
  831.  
  832. makeAfterInfected()
  833. {
  834. if( isDefined( self.isInfected ) && self.isInfected == true )
  835. {
  836. if( isDefined( self.infEnt ) )
  837. {
  838. self thread destroyBarrierOnDeath();
  839. }
  840. self.isInfected = true;
  841. self.voice = "american";
  842. self.skeleton = "base";
  843. self DetachAll();
  844. spawnPoint = self getSpawnPoint();
  845. self SetOrigin( spawnPoint.origin );
  846. self SetPlayerAngles( spawnPoint.angles );
  847. self notify( "weapon_change", "none" );
  848. self thread maps\mp\gametypes\_friendicons:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />howFriendIcon();
  849. self thread giveCustomLoadout(true, true, 1200);
  850. self.zPortalUses = 1;
  851. PlayFX( level._effect["player_infected"], self.origin + (0, 0, 0));
  852. [[level._setTeamScore]]( self.pers[ "team" ], [[level._getTeamScore]]( self.pers[ "team" ] ) + 1 );
  853.  
  854. }
  855. }
  856.  
  857. makeFirstInfected()
  858. {
  859. if( isDefined( self.isInfected ) && self.isInfected == true )
  860. {
  861. if( isDefined( self.infEnt ) )
  862. {
  863. self thread destroyBarrierOnDeath();
  864. }
  865. self.isFirst = true;
  866.  
  867. level.selectedAlert = level CreateServerFontString( "objective", 1.5 );
  868. level.selectedAlert setPoint( 0, 0, 0, 0 );
  869. level.selectedAlert setText( "^1 First Infected: ^7" + self.name );
  870. maps\mp\_popups:<img src="https://www.itsmods.com/forum/images/smilies/biggrin.gif" alt="Big Grin" title="Big Grin" class="smilie smilie_4" />isplayTeamMessageToAll( &"INFECTED_FIRST_INFECTED", self );
  871. self.voice = "american";
  872. self.skeleton = "base";
  873. self DetachAll();
  874. spawnPoint = self getSpawnPoint();
  875. self SetOrigin( spawnPoint.origin );
  876. self SetPlayerAngles( spawnPoint.angles );
  877. self notify( "weapon_change", "none" );
  878. self thread maps\mp\gametypes\_friendicons:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />howFriendIcon();
  879. self thread giveCustomLoadout(true, true, 1800);
  880. self.zPortalUses = 1;
  881. level.firstInfected = true;
  882. PlayFX( level._effect["player_infected"], self.origin + (0, 0, 0));
  883. wait 2.5;
  884. level.selectedAlert Destroy();
  885. }
  886. }
  887.  
  888. takeOldWeapons( currentWeapon )
  889. {
  890. self endon( "disconnect" );
  891. self endon( "death" );
  892. for( ;; )
  893. {
  894. self waittill( "weapon_change", newWeapon );
  895. if( newWeapon != "none" )
  896. {
  897. break;
  898. }
  899. }
  900. weaponsList = self GetWeaponsList();
  901. for( i = 0; i < weaponsList.size; i++ )
  902. {
  903. if( ( weaponsList[i] != currentWeapon ) && ( weaponsList[i] != "knife_mp" ) )
  904. {
  905. self TakeWeapon( weaponsList[i] );
  906. }
  907. }
  908. self EnableWeaponCycling();
  909. }
  910.  
  911. onDeadEvent( team )
  912. {
  913. if(level.inMiniGame )
  914. {
  915. return;
  916. }
  917. if ( team == "all" )
  918. {
  919. inf_endGameWithKillcam( game["defenders"], "EVERYONE IS DEAD" );
  920. }
  921. else if ( team == game["attackers"] )
  922. {
  923. inf_endGameWithKillcam( game["defenders"], "ALL INFECTION CLEANED" );
  924. }
  925. else if ( team == game["defenders"] )
  926. {
  927. inf_endGameWithKillcam( game["attackers"], "ALL HUMANS INFECTED" );
  928. }
  929. }
  930.  
  931. inf_endGame( winningTeam, endReasonText )
  932. {
  933. if( IsDefined( winningTeam ) )
  934. {
  935. [[level._setTeamScore]]( winningTeam, [[level._getTeamScore]]( winningTeam ) + 1 );
  936. }
  937. thread maps\mp\gametypes\_globallogic::endGame( winningTeam, endReasonText );
  938. }
  939.  
  940. inf_endGameWithKillcam( winningTeam, endReasonText )
  941. {
  942. level thread maps\mp\gametypes\_killcam:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />tartLastKillcam();
  943. inf_endGame( winningTeam, endReasonText );
  944. }
  945.  
  946. monitorKeyPress()
  947. {
  948. self endon( "disconnect" );
  949. self endon( "killed_player" );
  950. self endon( "death" );
  951. level endon( "game_ended" );
  952.  
  953. weapon = self GetCurrentWeapon();
  954.  
  955. for(;<img src="https://www.itsmods.com/forum/images/smilies/wink.gif" alt="Wink" title="Wink" class="smilie smilie_2" />
  956. {
  957. wait ( 0.05 );
  958.  
  959. if( self FragButtonPressed() && self.pers[ "team" ] == "axis" && level.maxBarriers < 10000 )
  960. {
  961.  
  962.  
  963. testEnt = spawn( "script_model", self.origin + (0, 0, 1 ));
  964. testEnt.angles = self.angles;
  965. testEnt SetModel( "mp_cone" );
  966. self iprintln( "do you see it?" );
  967. continue;
  968. // infEnt = spawn( "script_model", self.origin + (-15, 0, 1) );
  969. // infEnt.angles = self.angles;
  970. // infEnt.health = 200;
  971. // infEnt SetCanDamage( true );
  972. // infEnt SetModel( "p_glo_barricade_wood_barb_pow" );
  973. // level.infEnt = infEnt;
  974. // self.infEnt = infEnt;
  975. // infEnt rotateyaw( -90, 3, 0, 0 );
  976. // infent Linkto( level.barriers );
  977. // infEnt Solid();
  978. // self iPrintLn( "^1DEFENSE WALL:^7 Get clear of defense wall" );
  979. // wait 2.0;
  980. // PlayFX( level._effect["burn_barrier"], infEnt.origin + (0, 0, 2));
  981. // level notify( "barrier_active" );
  982. // level.maxBarriers++;
  983. // self.MaxDecoys++;
  984. // level iprintln( "^1DEFENSE WALL:^7 " + self.MaxDecoys + " of 1 used" );
  985. // buildhud();
  986. // continue;
  987. }
  988. if( self SecondaryOffhandButtonPressed() && self.pers[ "team" ] == "axis" && self.HealthPacks < 3 )
  989. {
  990. self.health = self.health + 50;
  991. self.maxhealth = self.health;
  992. self.HealthPacks++;
  993. self iprintln( "^1Health Packs:^7 " + self.HealthPacks + " of 3 used" );
  994. buildhud();
  995. wait 0.50;
  996. continue;
  997. }
  998.  
  999.  
  1000. if( self MeleeButtonPressed() && self.isFrozen )
  1001. {
  1002. iprintln( "^1FROZEN:^7 " + self.name + " is frozen and needs help!" );
  1003. wait 2.0;
  1004. continue;
  1005. }
  1006.  
  1007. if( self UseButtonPressed() && self.zPortalUses < 1 && self.pers[ "team " ] != "allies" && IsDefined( level.inMiniGame ) && !level.inMiniGame )
  1008. {
  1009. players = GetEntArray( "player", "classname" );
  1010. playerNum = 0;
  1011.  
  1012. for( x = 0; x < players.size; x++ )
  1013. {
  1014. wait 0.05;
  1015. if( IsDefined( players[ x ].pers[ "team" ] ) && players[ x ].pers[ "team" ] == "allies" )
  1016. {
  1017. spawnPoint = players[ x ] getSpawnPoint();
  1018. players[ x ] SetOrigin( spawnPoint.origin );
  1019. players[ x ] SetPlayerAngles( spawnPoint.angles );
  1020. players[ x ] notify( "weapon_change", "none" );
  1021. players[ x ] thread maps\mp\gametypes\_friendicons:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />howFriendIcon();
  1022. players[ x ] iprintln( "^1SCATTER:^7 " + self.name + " scattered you" );
  1023. PlayFX( level._effect["player_infected"], players[ x ].origin + (0, 0, 0));
  1024. wait 1.0;
  1025. }
  1026. }
  1027. wait 0.05;
  1028. self.zPortalUses++;
  1029. self iprintln( "^1INF TRAP:^7 " + self.zPortalUses + " of 1 used" );
  1030. self iprintln( "^1SCATTERING:^7 " + level.aliveCount[ "allies" ] + " players" );
  1031. buildhud();
  1032. continue;
  1033. }
  1034. else if( self UseButtonPressed() && level.inMiniGame )
  1035. {
  1036. self openMenu( "inf_choose_cl");
  1037. self thread onMenuResponse();
  1038. }
  1039. }
  1040. }
  1041.  
  1042. doBarrierDamage()
  1043. {
  1044. level endon("end_game");
  1045. self endon( "disconnect" );
  1046. self endon( "death" );
  1047. level waittill( "barrier_active" );
  1048. level waittill( "first_infected_true" );
  1049. for( ;; )
  1050. {
  1051. wait 0.05;
  1052. extraBoundary = ( 40, 40, 40 );
  1053. if( isDefined( level.infEnt ) && self IsTouching( level.infEnt, extraBoundary ) )
  1054. {
  1055. wait 0.25;
  1056. self DoDamage( 50, level.infEnt.origin, level.infEnt );
  1057. }
  1058. }
  1059. }
  1060.  
  1061. destroyBarrierOnDeath()
  1062. {
  1063. self endon ( "disconnect" );
  1064. while( 1 )
  1065. {
  1066. self.infEnt Delete();
  1067. wait ( 0.05 );
  1068. }
  1069. }
  1070.  
  1071. refreshHM( sColor )
  1072. {
  1073. self endon( "disconnect" );
  1074. self endon( "death" );
  1075. level endon( "game_ended" );
  1076.  
  1077. wait 0.25;
  1078. if( self.health > 250 )
  1079. {
  1080. sColor = "^2";
  1081. }
  1082. else if( self.health <= 250 )
  1083. {
  1084. sCOlor = "^1";
  1085. }
  1086. if( isDefined( self.healthMeter ) )
  1087. {
  1088. self.healthMeter Destroy();
  1089. }
  1090. self.healthMeter = self CreateFontString( "objective", 1.0 );
  1091. self.healthMeter setPoint( 0,0,213,221, undefined );
  1092. self.healthMeter setText( "Health: " + sColor + self.health );
  1093. }
  1094.  
  1095. onMenuResponse()
  1096. {
  1097. self endon( "death" );
  1098. self endon( "disconnect" );
  1099.  
  1100. while( true )
  1101. {
  1102. self waittill( "menuresponse", menu, response );
  1103.  
  1104. if( response == "open_inf_cl" )
  1105. self openMenu( "inf_choose_cl" );
  1106. if( response == "inf_cl_1" ) //"^11.^7 Defender (M60/K + 800 HP + S/B/H)"
  1107. {
  1108. if( isDefined( level.inMiniGame) && level.minigame )
  1109. {
  1110. doNothing();
  1111. }
  1112. else if(!isDefined( level.inMiniGame ) || !level.inMiniGame )
  1113. {
  1114. self.maxhealth = 800;
  1115. self.health = self.maxhealth;
  1116. self.zPortalUses = 0;
  1117. }
  1118. self.MaxDecoys = 0;
  1119. self.HealthPacks = 0;
  1120. self.isFrozen = false;
  1121. self.canFreeze = true;
  1122. self.isDefender = true;
  1123. self TakeAllWeapons();
  1124. currentWeapon = "sten_sp";
  1125. self giveWeapon( currentWeapon );
  1126. self SwitchToWeapon( currentWeapon );
  1127. self shellShock( "damage_mp", 1.0 );
  1128. self SetMoveSpeedScale( 0.90 );
  1129. self SetPerk( "specialty_fastreload" );
  1130. self SetPerk( "specialty_fastads" );
  1131. self SetPerk( "specialty_bulletpenetration" );
  1132. self SetPerk( "specialty_armorpiercing" );
  1133. self SetPerk( "specialty_bulletflinch" );
  1134. self SetPerk( "specialty_scavenger" );
  1135. self SetPerk( "specialty_extraammo" );
  1136. self GiveWeapon( "satchel_charge_mp" );
  1137. self GiveWeapon( "knife_mp" );
  1138. PlayFX( level._effect["player_infected"], self.origin + (0, 0, 0));
  1139. wait 1;
  1140. self FreezeControls(false);
  1141. break;
  1142. }
  1143. else if( response == "inf_cl_2" ) //"^12.^7 Attacker (MM/K + 300 HP + S/B/H) "
  1144. {
  1145. if( isDefined( level.inMiniGame) && level.minigame )
  1146. {
  1147. doNothing();
  1148. }
  1149. else if(!isDefined( level.inMiniGame ) || !level.inMiniGame )
  1150. {
  1151. self.maxhealth = 300;
  1152. self.health = self.maxhealth;
  1153. self.zPortalUses = 1;
  1154. }
  1155.  
  1156. self.MaxDecoys = 0;
  1157. self.HealthPacks = 0;
  1158. self.isFrozen = false;
  1159. self.canFreeze = true;
  1160. self.isAttacker = true;
  1161. currentWeapon = "commando_mp_wtf";
  1162. self giveWeapon( currentWeapon );
  1163. self SwitchToWeapon( currentWeapon );
  1164. self shellShock( "damage_mp", 1.0 );
  1165. self SetMoveSpeedScale( 1.10 );
  1166. self SetPerk( "specialty_fastreload" );
  1167. self SetPerk( "specialty_fastads" );
  1168. self SetPerk( "specialty_bulletpenetration" );
  1169. self SetPerk( "specialty_armorpiercing" );
  1170. self SetPerk( "specialty_bulletflinch" );
  1171. self SetPerk( "specialty_noname" );
  1172. self SetPerk( "specialty_scavenger" );
  1173. self SetPerk( "specialty_extraammo" );
  1174. self SetPerk( "specialty_sprintrecovery" );
  1175. self SetPerk( "specialty_longersprint" );
  1176. self SetPerk( "specialty_quieter" );
  1177. self GiveWeapon( "knife_mp" );
  1178. PlayFX( level._effect["player_infected"], self.origin + (0, 0, 0));
  1179. self FreezeControls(false);
  1180. break;
  1181. }
  1182. else if( response == "inf_cl_3" ) //"^13^7. Cleaner (SP/IC/K + 400 HP + NF)"
  1183. {
  1184. if( isDefined( level.inMiniGame) && level.minigame )
  1185. {
  1186. doNothing();
  1187. }
  1188. else if(!isDefined( level.inMiniGame ) || !level.inMiniGame )
  1189. {
  1190. self.maxhealth = 400;
  1191. self.health = self.maxhealth;
  1192. self.zPortalUses = 1;
  1193. }
  1194. self.MaxDecoys = 1;
  1195. self.HealthPacks = 3;
  1196. self.isFrozen = false;
  1197. self.canFreeze = false;
  1198. self.isCleaner = true;
  1199. currentWeapon = "spectre_grip_extclip_silencer_mp";
  1200. self giveWeapon( currentWeapon );
  1201. self SwitchToWeapon( currentWeapon );
  1202. self shellShock( "damage_mp", 1.0 );
  1203. self SetMoveSpeedScale( 1.45 );
  1204. self SetPerk( "specialty_scavenger" );
  1205. self SetPerk( "specialty_extraammo" );
  1206. self SetPerk( "specialty_sprintrecovery" );
  1207. self SetPerk( "specialty_longersprint" );
  1208. self SetPerk( "specialty_quieter" );
  1209. self GiveWeapon( "knife_mp" );
  1210. self GiveWeapon( "satchel_charge_mp" );
  1211. PlayFX( level._effect["player_infected"], self.origin + (0, 0, 0));
  1212. self FreezeControls(false);
  1213. break;
  1214. }
  1215. else if( response == "inf_cl_4" ) //"^14^7. Runner (RG/IC/K + 200 HP + H/S)"
  1216. {
  1217. if( isDefined( level.inMiniGame) && level.minigame )
  1218. {
  1219. doNothing();
  1220. }
  1221. else if(!isDefined( level.inMiniGame ) || !level.inMiniGame )
  1222. {
  1223. self.maxhealth = 200;
  1224. self.health = self.maxhealth;
  1225. self.zPortalUses = 0;
  1226. }
  1227. self.MaxDecoys = 1;
  1228. self.HealthPacks = 0;
  1229. self.isFrozen = false;
  1230. self.canFreeze = true;
  1231. self.isRunner = true;
  1232. currentWeapon = "ray_gun_zm";
  1233. self giveWeapon( currentWeapon );
  1234. self SwitchToWeapon( currentWeapon );
  1235. self shellShock( "damage_mp", 1.0 );
  1236. self SetMoveSpeedScale( 1.55 );
  1237. self SetPerk( "specialty_scavenger" );
  1238. self SetPerk( "specialty_extraammo" );
  1239. self SetPerk( "specialty_sprintrecovery" );
  1240. self SetPerk( "specialty_longersprint" );
  1241. self SetPerk( "specialty_quieter" );
  1242. self GiveWeapon( "knife_mp" );
  1243. self GiveWeapon( "satchel_charge_mp" );
  1244. PlayFX( level._effect["player_infected"], self.origin + (0, 0, 0));
  1245. self FreezeControls(false);
  1246. break;
  1247. }
  1248. else if( response == "inf_cl_5" )
  1249. {
  1250. if( isDefined( level.inMiniGame) && level.minigame )
  1251. {
  1252. doNothing();
  1253. }
  1254. else if(!isDefined( level.inMiniGame ) || !level.inMiniGame )
  1255. {
  1256. self.maxhealth = 300;
  1257. self.health = self.maxhealth;
  1258. self.zPortalUses = 0;
  1259. }
  1260. self.MaxDecoys = 0;
  1261. self.HealthPacks = 0;
  1262. self.isFrozen = false;
  1263. self.canFreeze = false;
  1264. self.isDecoy = true;
  1265. currentWeapon = "knife_mp";
  1266. self giveWeapon( currentWeapon );
  1267. self SwitchToWeapon( currentWeapon );
  1268. self shellShock( "damage_mp", 1.0 );
  1269. self SetMoveSpeedScale( 1.10 );
  1270. self SetPerk( "specialty_scavenger" );
  1271. self SetPerk( "specialty_extraammo" );
  1272. self SetPerk( "specialty_sprintrecovery" );
  1273. self SetPerk( "specialty_longersprint" );
  1274. self SetPerk( "specialty_quieter" );
  1275. PlayFX( level._effect["player_infected"], self.origin + (0, 0, 0));
  1276. iprintln( "^1INFECTION: ^7 Spawned " + self.name + " as Decoy" );
  1277. self FreezeControls(false);
  1278. break;
  1279. }
  1280. else if( response == "inf_cl_ex" )
  1281. {
  1282.  
  1283. }
  1284. }
  1285. }
  1286.  
  1287.  
  1288. // My favorite function!!!!!!!!!
  1289.  
  1290. doNothing()
  1291. {
  1292. self notify( "doing_nothing" );
  1293. }
  1294.  
  1295.  
  1296.  
  1297. doFreezeTimer( isFrozen, fDuration )
  1298. {
  1299. self endon( "death" );
  1300. self endon( "disconnect");
  1301.  
  1302. if( self.pers[ "team" ] == "allies" )
  1303. return;
  1304.  
  1305. x = 1;
  1306. while( x <= 15 )
  1307. {
  1308. if( isFrozen )
  1309. {
  1310. wait 1.0;
  1311. if( isDefined( self.fAlert ) )
  1312. {
  1313. self.fAlert Destroy();
  1314. }
  1315.  
  1316. if( isDefined( self.freezeTimer ) && self.freezeTimer )
  1317. {
  1318. return;
  1319. }
  1320. if( x == 15 )
  1321. {
  1322. self iprintlnbold( "^1YOU ARE INFECTED!" );
  1323. self FreezeControls( false );
  1324. self.isFrozen = false;
  1325. PlayFX( level._effect["player_got_infected"], self.origin + (0, 0, 0));
  1326. self thread makeHuman(true, false);
  1327. break;
  1328. }
  1329. else
  1330. {
  1331. self.fAlert = self CreateFontString( "objective", 1.0 );
  1332. self.fAlert setPoint( 0, 0, 0, 40 );
  1333. self.fAlert setText( "^1FROZEN:^7 15 Seconds to infection: (" + x + ")" );
  1334. x++;
  1335. }
  1336. }
  1337. else
  1338. {
  1339. self iprintln("DEBUG: NOT FROZEN BUT RUNNING TIMER" );
  1340. break;
  1341. }
  1342. }
  1343. }
  1344. buildHUD()
  1345. {
  1346. level endon( "game_ended" );
  1347. self endon( "death" );
  1348. self endon( "disconnect" );
  1349. //check if hud is already drawn
  1350. if( IsDefined( level.aText ) )
  1351. {
  1352. level.aText Destroy();
  1353. }
  1354. if( IsDefined( level.cText ) )
  1355. {
  1356. level.cText Destroy();
  1357. }
  1358. if( IsDefined( level.dText ) )
  1359. {
  1360. level.dText Destroy();
  1361. }
  1362. if( IsDefined( level.drawTitle ) )
  1363. {
  1364. level.drawTitle Destroy();
  1365. }
  1366. if( IsDefined( self.drawWarning ) )
  1367. {
  1368. self.drawWarning Destroy();
  1369. }
  1370. if( IsDefined( level.asText ) )
  1371. {
  1372. level.asText Destroy();
  1373. }
  1374. if( IsDefined( level.abText ) )
  1375. {
  1376. level.abText Destroy();
  1377. }
  1378. //define team scores & timer
  1379.  
  1380. aScore = level.aliveCount["allies"];
  1381. bScore = level.aliveCount["axis"];
  1382. tTime = maps\mp\gametypes\_globallogic_utils::getEstimatedTimeUntilScoreLimit( "allies" );
  1383. if( isDefined( self.barText ) )
  1384. {
  1385. self.barText Destroy();
  1386. }
  1387. if( isDefined( self.barText2 ) )
  1388. {
  1389. self.barText2 Destroy();
  1390. }
  1391. if( isDefined( self.barText3 ) )
  1392. {
  1393. self.barText3 Destroy();
  1394. }
  1395.  
  1396.  
  1397.  
  1398.  
  1399. if( !isDefined( self.maxDecoys ) )
  1400. {
  1401. self.maxDecoys = 0;
  1402. }
  1403. if( !isDefined( self.HealthPacks ) )
  1404. {
  1405. self.HealthPacks = 0;
  1406. }
  1407. if( !isDefined( self.zPortalUses ) )
  1408. {
  1409. self.zPortalUses = 0;
  1410. }
  1411. self.barText = self CreateFontString( "objective", 1.0 );
  1412. self.barText setPoint( "TOPRIGHT", "TOPRIGHT",0, 0);
  1413. self.barText setText( "^1Barriers(g): ^7 " + self.maxDecoys + "/1 used" );
  1414. self.barText2 = self CreateFontString( "objective", 1.0 );
  1415. self.barText2 setPoint( "TOPRIGHT", "TOPRIGHT", 0, 15);
  1416. self.barText2 setText( "^1Health Pack(4): ^7 " + self.HealthPacks + "/3 used" );
  1417. self.barText3 = self CreateFontString( "objective", 1.0 );
  1418. self.barText3 setPoint( "TOPRIGHT", "TOPRIGHT", 0, 30);
  1419. self.barText3 setText( "^1Scatter(f): ^7 " + self.zPortalUses + "/1 used" );
  1420. level.drawTitle = level CreateServerFontString( "objective", 1.5 );
  1421. level.aText = level CreateServerFontString( "objective", 1.0 );
  1422. level.cText = level CreateServerFontString( "objective", 1.5 );
  1423. level.dText = level CreateServerFontString( "objective", 1.0 );
  1424. level.asText = level CreateServerFontString( "objective", 1.0 );
  1425. level.abText = level CreateServerFontString( "objective", 1.0 );
  1426. level.drawTitle setPoint( "TOPCENTER", "TOPCENTER", 0, 0 );
  1427. level.aText setPoint( "TOPCENTER", "TOPCENTER", -40, 25);
  1428. level.cText setPoint( "TOPCENTER", "TOPCENTER", 0, 18);
  1429. level.dText setPoint( "TOPCENTER", "TOPCENTER", 40, 25);
  1430. level.abtext setPoint( "TOPCENTER", "TOPCENTER", 40, 15);
  1431. level.astext setPoint( "TOPCENTER", "TOPCENTER", -40, 15);
  1432. level.drawTitle setText( "^1INFECTION^7" );
  1433. level.astext setText( "^7" + bscore );
  1434. level.abtext setText( "^7" + ascore );
  1435. level.aText setText( "^1HUMANS^7" );
  1436. level.cText setText( "^3VS^7" );
  1437. level.dText setText( "^1INFECTED^7" );
  1438.  
  1439. }
  1440.  
  1441. infDogWave()
  1442. {
  1443. if(!IsDefined( level.MGLevel ) )
  1444. {
  1445. level.MGLevel = 0;
  1446. }
  1447. if( level.dogCount == 0 && level.MGLevel == 0 )
  1448. {
  1449. level thread maps\mp\inf_dogs::make_all_dogs_leave();
  1450. iPrintln( "^1MINIGAME: ^7ENDLESS DOGS, ROUND 2 - STARTS NOW" );
  1451. wait 2.0;
  1452. level thread startminigame( "endless_dogs", 12, 0);
  1453. level.MGLevel++;
  1454. return;
  1455. }
  1456. if( level.dogCount == 0 && level.MGLevel == 1 )
  1457. {
  1458. level thread maps\mp\inf_dogs::make_all_dogs_leave();
  1459. iPrintln( "^1MINIGAME: ^7ENDLESS DOGS, ROUND 3 - STARTS NOW" );
  1460. level thread startminigame( "endless_dogs", 16, 0);
  1461. wait 2.0;
  1462. level.MGLevel++;
  1463. return;
  1464. }
  1465. }
  1466.  
  1467. updateDogScore()
  1468. {
  1469. self endon( "disconnect" );
  1470. level endon( "game_ended" );
  1471.  
  1472. if( !isDefined( self.dogKills ) )
  1473. {
  1474. self.dogKills = 0;
  1475. }
  1476.  
  1477. if( !isDefined( level.dogCount ) )
  1478. {
  1479. level.dogCount = 0;
  1480. }
  1481.  
  1482.  
  1483.  
  1484. for ( ;; )
  1485. {
  1486. wait 0.10;
  1487. if( IsDefined( level.inMiniGame ) && !level.inMiniGame )
  1488. break;
  1489.  
  1490. if( level.inMiniGame )
  1491. {
  1492. if( isdefined( self.dScore ) )
  1493. {
  1494. self.dScore Destroy();
  1495. }
  1496.  
  1497. score = maps\mp\gametypes\_globallogic_score::_getPlayerScore( self );
  1498. self.dScore = self CreateFontString( "objective", 1.0 );
  1499. self.dScore SetPoint( "BOTTOMLEFT", "BOTTOMLEFT", 0,-12 );
  1500. self.dScore setText("^1Dogs Killed ^7" + self.dogKills + "^1 | Score ^7" + score + " ^1| Dogs Alive ^7" + level.dogCount + "^1 | Bots Alive^7 " + level.botCount );
  1501. }
  1502. }
  1503. }
  1504.  
  1505. checkMGRewards( MGgameType)
  1506. {
  1507.  
  1508.  
  1509. if( MGgameType == "endless_dogs" )
  1510. {
  1511. if( !isdefined( self.dogKills ) )
  1512. return;
  1513.  
  1514. if(self.dogKills < 10 )
  1515. return;
  1516.  
  1517. switch( self.dogKills )
  1518. {
  1519. case 10:
  1520. giveReward( 1 );
  1521. break;
  1522.  
  1523. case 20:
  1524. giveReward( 2 );
  1525. break;
  1526.  
  1527. case 30:
  1528. giveReward( 3 );
  1529. break;
  1530.  
  1531. case 40:
  1532. giveReward( 4 );
  1533. break;
  1534.  
  1535. case 50:
  1536. giveReward( 5 );
  1537. break;
  1538.  
  1539. default:
  1540. giveReward( 0 );
  1541. break;
  1542. }
  1543. }
  1544. }
  1545.  
  1546. giveReward( rewardStageNum, awardGiven )
  1547. {
  1548. weapon = self GetCurrentWeapon();
  1549. if( rewardStageNum == 1 && self.rewardedStage1 == 0)
  1550. {
  1551. self.rewardedStage1++;
  1552. self thread maps\mp\gametypes\_hardpoints::giveKillstreak( "supply_drop_mp", 0, false, true );
  1553. self GiveMaxAmmo( weapon );
  1554. self iprintln( "^1MINIGAME: ^7Care Package + Max Ammo" );
  1555. awardGiven = "Care Package";
  1556. }
  1557. else if( rewardStageNum == 2 && self.rewardedStage1 == 1 )
  1558. {
  1559. self.rewardedStage1++;
  1560. self thread maps\mp\gametypes\_hardpoints::giveKillstreak( "minigun_mp", 0, false, true );
  1561. self GiveMaxAmmo( weapon );
  1562. self iprintln( "^1MINIGAME: ^7Death Machine Awarded + Max Ammo" );
  1563. awardGiven = "Mini Gun";
  1564. }
  1565. else if( rewardStageNum == 3 && self.rewardedStage1 == 2)
  1566. {
  1567. self.rewardedStage1++;
  1568. self thread maps\mp\gametypes\_hardpoints::giveKillstreak( "autoturret_mp", 0, false, true );
  1569. self GiveMaxAmmo( weapon );
  1570. self iprintln( "^1MINIGAME: ^7Sentry Gun Awarded + Max Ammo" );
  1571. awardGiven = "Sentry Gun";
  1572. }
  1573. return awardGiven;
  1574. }
  1575. mg_kickTeam( team )
  1576. {
  1577. players = GetEntArray( "player", "classname" );
  1578. for( x = 0; x < players.size; x++ )
  1579. {
  1580. if( IsDefined( players[ x ].pers[ "team" ] ) && players[ x ].pers[ "team" ] == team && players[x].pers[ "isBot" ])
  1581. {
  1582. kick( players[x] getEntityNumber() );
  1583. }
  1584. }
  1585. }
  1586.  
  1587. startMiniGame( gameType, numDogs, numBots )
  1588. {
  1589.  
  1590. self endon("disconnect");
  1591.  
  1592. level.inMiniGame = true;
  1593.  
  1594.  
  1595. if( gameType == "endless_dogs" )
  1596. {
  1597. if( isDefined( level.mgAlert ) )
  1598. {
  1599. level.mgAlert Destroy();
  1600. }
  1601. level.mgAlert = level CreateServerFontString( "objective", 1.0 );
  1602. level.mgAlert SetPoint( "BOTTOMLEFT", "BOTTOMLEFT", 0, -24 );
  1603. level.mgAlert setText("^2Mini Game^1: ENDLESS DOGS^1" );
  1604. level thread mg_add_bots( numBots );
  1605. if ( level.no_dogs )
  1606. {
  1607. return;
  1608. }
  1609.  
  1610. team = maps\mp\inf_dogs::get_debug_team("allies");
  1611.  
  1612. requiredDeathCount = 10;
  1613.  
  1614. level notify( "start_dog_score" );
  1615.  
  1616. level.dog_spawner = getent("dog_spawner","targetname" );
  1617.  
  1618. if ( !isdefined( level.dog_spawner ) )
  1619. return;
  1620.  
  1621. level.dogs = [];
  1622.  
  1623. level thread maps\mp\inf_dogs::dog_manager_game_ended();
  1624. level thread maps\mp\inf_dogs::dog_manager_dog_alive_tracker( team );
  1625. level thread maps\mp\inf_dogs::dog_manager_dog_time_limit();
  1626. level thread maps\mp\inf_dogs::dog_usage_monitor();
  1627.  
  1628.  
  1629.  
  1630. for ( i = 0; i < numDogs ; i++ )
  1631. {
  1632. node = self maps\mp\inf_dogs::get_spawn_node( team );
  1633. level.dogs[i] = maps\mp\inf_dogs::dog_manager_spawn_dog( self, team, node, i, requiredDeathCount );
  1634. wait ( 1 );
  1635. level.dogCount++;
  1636. }
  1637.  
  1638. iPrintln( "^1MINIGAME:^7 dogs spawned, good luck!");
  1639.  
  1640. level notify( "mg_round_1" );
  1641. level notify( "mini_game_started" );
  1642.  
  1643. }
  1644.  
  1645. if( gameType == "bots" )
  1646. {
  1647. if( isDefined( level.mgAlert ) )
  1648. {
  1649. level.mgAlert Destroy();
  1650. }
  1651. level.mgAlert = level CreateServerFontString( "objective", 1.0 );
  1652. level.mgAlert SetPoint( "BOTTOMLEFT", "BOTTOMLEFT", 0, -24 );
  1653. level.mgAlert setText("^2Mini Game^1: Combat Training^1 - ^9USE ^7for MENU" );
  1654. level thread mg_add_bots( numBots );
  1655. }
  1656.  
  1657. }
  1658.  
  1659. mg_add_bots( numBots, team )
  1660. {
  1661. team = "allies";
  1662. for( i = 0; i < numBots ; i++ )
  1663. {
  1664. wait 0.50;
  1665. bot[i] = AddTestClient();
  1666. while(!IsDefined(bot[i]))
  1667. {
  1668. bot[i] = AddTestClient();
  1669. continue;
  1670. }
  1671.  
  1672. bot[i].origin = self.origin;
  1673. bot[i].angles = self.angles+ (0,180,0);
  1674. bot[i].pers[ "isBot" ] = true;
  1675. bot[i].name = "BOT [ " + i + " ]";
  1676. bot[i] thread maps\mp\gametypes\_bot::bot_spawn_think("allies");
  1677. bot[i] thread maps\mp\gametypes\_bot::bot_set_difficulty( "hard" );
  1678. bot[i] waittill("ok_to_loadout");
  1679. bot[i] takeAllWeapons();
  1680. currentWeapon = "knife_mp";
  1681. bot[i] giveWeapon( currentWeapon );
  1682. bot[i] SwitchToWeapon( currentWeapon );
  1683. bot[i] FreezeControls(false);
  1684. bot[i].maxhealth = 500;
  1685. bot[i].health = bot[i].maxhealth;
  1686. //bot[i] setmodel("infected_char_3");
  1687. bot[i].pers[ "team" ] = team;
  1688. bot[i].team = team;
  1689. bot[i].pers[ "savedmodel" ] = undefined;
  1690. bot[i].pers[ "teamTime" ] = 0;
  1691. bot[i].sessionteam = team;
  1692. bot[i].isInfected = false;
  1693. bot[i].isInfectedDef = false;
  1694. spawnPoint = bot[i] getSpawnPoint();
  1695. bot[i] SetOrigin( spawnPoint.origin );
  1696. bot[i] SetPlayerAngles( spawnPoint.angles);
  1697. bot[i] thread maps\mp\gametypes\_friendicons:<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />howFriendIcon();
  1698. buildhud();
  1699. bot[i].tag_stowed_back = undefined;
  1700. bot[i].tag_stowed_hip = undefined;
  1701. bot[i] SetAnim( %ai_zombie_walk_v1 );
  1702. level.botCount++;
  1703. }
  1704. iPrintln("^1MINIGAME: ^7bots spawned, good luck!");
  1705. }



I hope this helps you guys get away from hacking up rank.

Making me feel sick Sad
tl;dr = Don't use _rank.gsc it's nooby.

It seems that the _Rank.gsc is very popular for noobs, don't ask me why...
But it came from the Modern Warfare 2 modding, where the xbox'er and PC modders joined together (Because of no offical mod support)
Agentgod1337, the creator of mod loader, mw2 liberation and so, made a example mod called "Scoutknivez" which used the _rank.gsc.
I think that's the reason why people use the _rank.gsc.

But I'd like to know why there wasn't as many modders in COD4 as there is in MW2/BO...

I can't stand all the support questions that come from hacking up rank.gsc.

It drives me insane for 2 reasons.

1. If you created your own GSC you would know where everything was
2. If you created your own GSC you wouldn't be asking me that quesiton

I love to help, but I can only help if it's being done the right way.

I can't help you hack up a file that makes no sense to anyone because
you're calling functions 37 times because you're running two rank gsc files.

Sorry, I have been a little on edge since I moved out of my home and
separated from my wife.
Crayon mind comming on steam so I can talk to you?
(08-11-2011, 18:24)Rendflex Wrote: [ -> ]But I'd like to know why there wasn't as many modders in COD4 as there is in MW2/BO...

LOL there are 100 times more cod4/codWAW modders than mw2/BO modders.


Back on topic thanks for this tut. Its about time someone did this because i too was wondering why everyone just jams 3000 lines of extra code into _rank.
(08-11-2011, 18:32)boe44 Wrote: [ -> ]LOL there are 100 times more cod4/codWAW modders than mw2/BO modders.


Yeah, but these were pro's, and in MW2 there's/were TONS of noobs who tried modding.
(08-11-2011, 18:32)boe44 Wrote: [ -> ]LOL there are 100 times more cod4/codWAW modders than mw2/BO modders.

Not true the cod4/waw modding community is really small, BO is much bigger

@deadcrayon nice tutorial but you shouldn't use php tags. Now it looks like this:
//Start the required files to "start a game"
mapsmpgametypes_globallogic::init();
mapsmpgametypes_callbacksetup::SetupCallbacks();
mapsmpgametypes_globallogic::SetupCallbacks();
mapsmpgametypes_damagefeedback::init();
mapsmpgametypes_tweakables::init();

use [code= cpp][ /code]
nice tutorial, replaced php tags with c++ tags.
its highlighting either

pls dont use php to highlight C/C++ cause it wont show \ and people are running into trouble when copy pasting

(08-11-2011, 18:32)deadcrayon Wrote: [ -> ]...
Sorry, I have been a little on edge since I moved out of my home and
separated from my wife.

sounds bad, hope you get over it or you both will find together soon.
thanks for you effort
(08-11-2011, 19:09)d0h! Wrote: [ -> ]nice tutorial, replaced php tags with c++ tags.
its highlighting either

pls dont use php to highlight C/C++ cause it wont show \ and people are running into trouble when copy pasting

I changed it either right before, or right after you did.

Thanks though.

Very nice Tutorial.

Thank you !
Pages: 1 2 3