Advertisement
Guest User

Untitled

a guest
Sep 29th, 2010
399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.57 KB | None | 0 0
  1. #include maps\mp\_utility;
  2. #include maps\mp\gametypes\_hud_util;
  3. /*
  4. War
  5. Objective: Score points for your team by eliminating players on the opposing team
  6. Map ends: When one team reaches the score limit, or time limit is reached
  7. Respawning: No wait / Near teammates
  8.  
  9. Level requirementss
  10. ------------------
  11. Spawnpoints:
  12. classname mp_tdm_spawn
  13. All players spawn from these. The spawnpoint chosen is dependent on the current locations of teammates and enemies
  14. at the time of spawn. Players generally spawn behind their teammates relative to the direction of enemies.
  15.  
  16. Spectator Spawnpoints:
  17. classname mp_global_intermission
  18. Spectators spawn from these and intermission is viewed from these positions.
  19. Atleast one is required, any more and they are randomly chosen between.
  20. */
  21.  
  22. /*QUAKED mp_tdm_spawn (0.0 0.0 1.0) (-16 -16 0) (16 16 72)
  23. Players spawn away from enemies and near their team at one of these positions.*/
  24.  
  25. /*QUAKED mp_tdm_spawn_axis_start (0.5 0.0 1.0) (-16 -16 0) (16 16 72)
  26. Axis players spawn away from enemies and near their team at one of these positions at the start of a round.*/
  27.  
  28. /*QUAKED mp_tdm_spawn_allies_start (0.0 0.5 1.0) (-16 -16 0) (16 16 72)
  29. Allied players spawn away from enemies and near their team at one of these positions at the start of a round.*/
  30.  
  31. main()
  32. {
  33. if(getdvar("mapname") == "mp_background")
  34. return;
  35.  
  36. maps\mp\gametypes\_globallogic::init();
  37. maps\mp\gametypes\_callbacksetup::SetupCallbacks();
  38. maps\mp\gametypes\_globallogic::SetupCallbacks();
  39.  
  40. registerRoundSwitchDvar( level.gameType, 0, 0, 9 );
  41. registerTimeLimitDvar( level.gameType, 10, 0, 1440 );
  42. registerScoreLimitDvar( level.gameType, 500, 0, 5000 );
  43. registerRoundLimitDvar( level.gameType, 1, 0, 10 );
  44. registerWinLimitDvar( level.gameType, 1, 0, 10 );
  45. registerRoundSwitchDvar( level.gameType, 3, 0, 30 );
  46. registerNumLivesDvar( level.gameType, 0, 0, 10 );
  47. registerHalfTimeDvar( level.gameType, 0, 0, 1 );
  48.  
  49. level.teamBased = true;
  50. level.onStartGameType = ::onStartGameType;
  51. level.getSpawnPoint = ::getSpawnPoint;
  52. level.onNormalDeath = ::onNormalDeath;
  53. //level.onTimeLimit = ::onTimeLimit; // overtime not fully supported yet
  54.  
  55. game["dialog"]["gametype"] = "tm_death";
  56.  
  57. if ( getDvarInt( "g_hardcore" ) )
  58. game["dialog"]["gametype"] = "hc_" + game["dialog"]["gametype"];
  59. else if ( getDvarInt( "camera_thirdPerson" ) )
  60. game["dialog"]["gametype"] = "thirdp_" + game["dialog"]["gametype"];
  61. else if ( getDvarInt( "scr_diehard" ) )
  62. game["dialog"]["gametype"] = "dh_" + game["dialog"]["gametype"];
  63. else if (getDvarInt( "scr_" + level.gameType + "_promode" ) )
  64. game["dialog"]["gametype"] = game["dialog"]["gametype"] + "_pro";
  65.  
  66. game["strings"]["overtime_hint"] = &"MP_FIRST_BLOOD";
  67. }
  68.  
  69.  
  70. onStartGameType()
  71. {
  72. setClientNameMode("auto_change");
  73.  
  74. if ( !isdefined( game["switchedsides"] ) )
  75. game["switchedsides"] = false;
  76.  
  77. if ( game["switchedsides"] )
  78. {
  79. oldAttackers = game["attackers"];
  80. oldDefenders = game["defenders"];
  81. game["attackers"] = oldDefenders;
  82. game["defenders"] = oldAttackers;
  83. }
  84.  
  85. setObjectiveText( "allies", &"OBJECTIVES_WAR" );
  86. setObjectiveText( "axis", &"OBJECTIVES_WAR" );
  87.  
  88. if ( level.splitscreen )
  89. {
  90. setObjectiveScoreText( "allies", &"OBJECTIVES_WAR" );
  91. setObjectiveScoreText( "axis", &"OBJECTIVES_WAR" );
  92. }
  93. else
  94. {
  95. setObjectiveScoreText( "allies", &"OBJECTIVES_WAR_SCORE" );
  96. setObjectiveScoreText( "axis", &"OBJECTIVES_WAR_SCORE" );
  97. }
  98. setObjectiveHintText( "allies", &"OBJECTIVES_WAR_HINT" );
  99. setObjectiveHintText( "axis", &"OBJECTIVES_WAR_HINT" );
  100.  
  101. level.spawnMins = ( 0, 0, 0 );
  102. level.spawnMaxs = ( 0, 0, 0 );
  103. maps\mp\gametypes\_spawnlogic::placeSpawnPoints( "mp_tdm_spawn_allies_start" );
  104. maps\mp\gametypes\_spawnlogic::placeSpawnPoints( "mp_tdm_spawn_axis_start" );
  105. maps\mp\gametypes\_spawnlogic::addSpawnPoints( "allies", "mp_tdm_spawn" );
  106. maps\mp\gametypes\_spawnlogic::addSpawnPoints( "axis", "mp_tdm_spawn" );
  107.  
  108. level.mapCenter = maps\mp\gametypes\_spawnlogic::findBoxCenter( level.spawnMins, level.spawnMaxs );
  109. setMapCenter( level.mapCenter );
  110.  
  111. allowed[0] = level.gameType;
  112. allowed[1] = "airdrop_pallet";
  113.  
  114. maps\mp\gametypes\_gameobjects::main(allowed);
  115. }
  116.  
  117.  
  118. getSpawnPoint()
  119. {
  120. spawnteam = self.pers["team"];
  121. if ( game["switchedsides"] )
  122. spawnteam = getOtherTeam( spawnteam );
  123.  
  124. if ( level.inGracePeriod )
  125. {
  126. spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_tdm_spawn_" + spawnteam + "_start" );
  127. spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random( spawnPoints );
  128. }
  129. else
  130. {
  131. spawnPoints = maps\mp\gametypes\_spawnlogic::getTeamSpawnPoints( spawnteam );
  132. spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam( spawnPoints );
  133. }
  134.  
  135. return spawnPoint;
  136. }
  137.  
  138.  
  139. onNormalDeath( victim, attacker, lifeId )
  140. {
  141. score = maps\mp\gametypes\_rank::getScoreInfoValue( "kill" );
  142. assert( isDefined( score ) );
  143.  
  144. attacker maps\mp\gametypes\_gamescore::giveTeamScoreForObjective( attacker.pers["team"], score );
  145.  
  146. if ( game["state"] == "postgame" && game["teamScores"][attacker.team] > game["teamScores"][level.otherTeam[attacker.team]] )
  147. attacker.finalKill = true;
  148. }
  149.  
  150.  
  151. onTimeLimit()
  152. {
  153. if ( game["status"] == "overtime" )
  154. {
  155. winner = "forfeit";
  156. }
  157. else if ( game["teamScores"]["allies"] == game["teamScores"]["axis"] )
  158. {
  159. winner = "overtime";
  160. }
  161. else if ( game["teamScores"]["axis"] > game["teamScores"]["allies"] )
  162. {
  163. winner = "axis";
  164. }
  165. else
  166. {
  167. winner = "allies";
  168. }
  169.  
  170. thread maps\mp\gametypes\_gamelogic::endGame( winner, game["strings"]["time_limit_reached"] );
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement