Advertisement
Guest User

war - Notesblok

a guest
Nov 19th, 2011
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.56 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. if ( isUsingMatchRulesData() )
  41. {
  42. level.initializeMatchRules = ::initializeMatchRules;
  43. [[level.initializeMatchRules]]();
  44. level thread reInitializeMatchRulesOnMigration();
  45. }
  46. else
  47. {
  48. registerRoundSwitchDvar( level.gameType, 0, 0, 9 );
  49. registerTimeLimitDvar( level.gameType, 10 );
  50. registerScoreLimitDvar( level.gameType, 500 );
  51. registerRoundLimitDvar( level.gameType, 1 );
  52. registerWinLimitDvar( level.gameType, 1 );
  53. registerNumLivesDvar( level.gameType, 0 );
  54. registerHalfTimeDvar( level.gameType, 0 );
  55.  
  56. level.matchRules_damageMultiplier = 0;
  57. level.matchRules_vampirism = 0;
  58. }
  59.  
  60. level.teamBased = true;
  61. level.onStartGameType = ::onStartGameType;
  62. level.getSpawnPoint = ::getSpawnPoint;
  63. level.onNormalDeath = ::onNormalDeath;
  64.  
  65. if ( level.matchRules_damageMultiplier || level.matchRules_vampirism )
  66. level.modifyPlayerDamage = maps\mp\gametypes\_damage::gamemodeModifyPlayerDamage;
  67.  
  68. game["dialog"]["gametype"] = "tm_death";
  69.  
  70. if ( getDvarInt( "g_hardcore" ) )
  71. game["dialog"]["gametype"] = "hc_" + game["dialog"]["gametype"];
  72. else if ( getDvarInt( "camera_thirdPerson" ) )
  73. game["dialog"]["gametype"] = "thirdp_" + game["dialog"]["gametype"];
  74. else if ( getDvarInt( "scr_diehard" ) )
  75. game["dialog"]["gametype"] = "dh_" + game["dialog"]["gametype"];
  76. else if (getDvarInt( "scr_" + level.gameType + "_promode" ) )
  77. game["dialog"]["gametype"] = game["dialog"]["gametype"] + "_pro";
  78.  
  79. game["strings"]["overtime_hint"] = &"MP_FIRST_BLOOD";
  80. }
  81.  
  82.  
  83. initializeMatchRules()
  84. {
  85. // set common values
  86. setCommonRulesFromMatchRulesData();
  87.  
  88. // set everything else (private match options, default .cfg file values, and what normally is registered in the 'else' below)
  89. SetDynamicDvar( "scr_war_roundswitch", 0 );
  90. registerRoundSwitchDvar( "war", 0, 0, 9 );
  91. SetDynamicDvar( "scr_war_roundlimit", 1 );
  92. registerRoundLimitDvar( "war", 1 );
  93. SetDynamicDvar( "scr_war_winlimit", 1 );
  94. registerWinLimitDvar( "war", 1 );
  95. SetDynamicDvar( "scr_war_halftime", 0 );
  96. registerHalfTimeDvar( "war", 0 );
  97.  
  98. SetDynamicDvar( "scr_war_promode", 0 );
  99. }
  100.  
  101.  
  102. onStartGameType()
  103. {
  104. setClientNameMode("auto_change");
  105.  
  106. if ( !isdefined( game["switchedsides"] ) )
  107. game["switchedsides"] = false;
  108.  
  109. if ( game["switchedsides"] )
  110. {
  111. oldAttackers = game["attackers"];
  112. oldDefenders = game["defenders"];
  113. game["attackers"] = oldDefenders;
  114. game["defenders"] = oldAttackers;
  115. }
  116.  
  117. setObjectiveText( "allies", &"OBJECTIVES_WAR" );
  118. setObjectiveText( "axis", &"OBJECTIVES_WAR" );
  119.  
  120. if ( level.splitscreen )
  121. {
  122. setObjectiveScoreText( "allies", &"OBJECTIVES_WAR" );
  123. setObjectiveScoreText( "axis", &"OBJECTIVES_WAR" );
  124. }
  125. else
  126. {
  127. setObjectiveScoreText( "allies", &"OBJECTIVES_WAR_SCORE" );
  128. setObjectiveScoreText( "axis", &"OBJECTIVES_WAR_SCORE" );
  129. }
  130. setObjectiveHintText( "allies", &"OBJECTIVES_WAR_HINT" );
  131. setObjectiveHintText( "axis", &"OBJECTIVES_WAR_HINT" );
  132.  
  133. level.spawnMins = ( 0, 0, 0 );
  134. level.spawnMaxs = ( 0, 0, 0 );
  135. maps\mp\gametypes\_spawnlogic::placeSpawnPoints( "mp_tdm_spawn_allies_start" );
  136. maps\mp\gametypes\_spawnlogic::placeSpawnPoints( "mp_tdm_spawn_axis_start" );
  137. maps\mp\gametypes\_spawnlogic::addSpawnPoints( "allies", "mp_tdm_spawn" );
  138. maps\mp\gametypes\_spawnlogic::addSpawnPoints( "axis", "mp_tdm_spawn" );
  139.  
  140. level.mapCenter = maps\mp\gametypes\_spawnlogic::findBoxCenter( level.spawnMins, level.spawnMaxs );
  141. setMapCenter( level.mapCenter );
  142.  
  143. allowed[0] = level.gameType;
  144. allowed[1] = "airdrop_pallet";
  145.  
  146. maps\mp\gametypes\_gameobjects::main(allowed);
  147. }
  148.  
  149.  
  150. getSpawnPoint()
  151. {
  152. spawnteam = self.pers["team"];
  153. if ( game["switchedsides"] )
  154. spawnteam = getOtherTeam( spawnteam );
  155.  
  156. if ( level.inGracePeriod )
  157. {
  158. spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_tdm_spawn_" + spawnteam + "_start" );
  159. spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random( spawnPoints );
  160. }
  161. else
  162. {
  163. spawnPoints = maps\mp\gametypes\_spawnlogic::getTeamSpawnPoints( spawnteam );
  164. spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam( spawnPoints );
  165. }
  166.  
  167. return spawnPoint;
  168. }
  169.  
  170.  
  171. onNormalDeath( victim, attacker, lifeId )
  172. {
  173. score = maps\mp\gametypes\_rank::getScoreInfoValue( "kill" );
  174. assert( isDefined( score ) );
  175.  
  176. attacker maps\mp\gametypes\_gamescore::giveTeamScoreForObjective( attacker.pers["team"], score );
  177.  
  178. if ( game["state"] == "postgame" && game["teamScores"][attacker.team] > game["teamScores"][level.otherTeam[attacker.team]] )
  179. attacker.finalKill = true;
  180. }
  181.  
  182.  
  183. onTimeLimit()
  184. {
  185. level.finalKillCam_winner = "none";
  186. if ( game["status"] == "overtime" )
  187. {
  188. winner = "forfeit";
  189. }
  190. else if ( game["teamScores"]["allies"] == game["teamScores"]["axis"] )
  191. {
  192. winner = "overtime";
  193. }
  194. else if ( game["teamScores"]["axis"] > game["teamScores"]["allies"] )
  195. {
  196. level.finalKillCam_winner = "axis";
  197. winner = "axis";
  198. }
  199. else
  200. {
  201. level.finalKillCam_winner = "allies";
  202. winner = "allies";
  203. }
  204.  
  205. thread maps\mp\gametypes\_gamelogic::endGame( winner, game["strings"]["time_limit_reached"] );
  206. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement