Guest User

Untitled

a guest
Aug 21st, 2015
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 63.48 KB | None | 0 0
  1. //**********************************************************************************
  2. //**********************************************************************************
  3. //
  4. // _ _ _ ___ ___ _ ___ ___ _
  5. // | | | | | | | \/ | | | | \/ | | |
  6. // | |_| | ___ | |_ _ | . . | ___ | |_ _ | . . | ___ __| |___
  7. // | _ |/ _ \| | | | | | |\/| |/ _ \| | | | | | |\/| |/ _ \ / _` / __|
  8. // | | | | (_) | | |_| | | | | | (_) | | |_| | | | | | (_) | (_| \__ \
  9. // \_| |_/\___/|_|\__, | \_| |_/\___/|_|\__, | \_| |_/\___/ \__,_|___/
  10. // __/ | __/ |
  11. // |___/ |___/
  12. //
  13. // Website: http://www.holymolymods.com
  14. //*********************************************************************************
  15. // Coded for Openwarfare Mod by [105]HolyMoly Sept 15/2012
  16. // V.0.Final
  17.  
  18. #include common_scripts\utility;
  19. #include maps\mp\_utility;
  20. #include maps\mp\gametypes\_hud_util;
  21. #include InfectedScript\_utility;
  22. #include InfectedScript\mp\_playerdvars;
  23.  
  24. /*
  25. Infection
  26.  
  27. Teams: Allies = Infected, Axis = Survivors
  28. Objective: Infected must knife kill all the Survivors to win.
  29. Map ends: When there are no more Survivors or time limit is reached.
  30. Respawning: No wait / Near teammates
  31. Spectating: No Spectating at all.......... Really screws with the code! :(
  32.  
  33. Level requirements
  34. ------------------
  35. Spawnpoints:
  36. classname mp_tdm_spawn
  37. All players spawn from these. The spawnpoint chosen is dependent on the current locations of teammates and enemies
  38. at the time of spawn. Players generally spawn behind their teammates relative to the direction of enemies.
  39.  
  40. Spectator Spawnpoints:
  41. classname mp_global_intermission
  42. Spectators spawn from these and intermission is viewed from these positions.
  43. Atleast one is required, any more and they are randomly chosen between.
  44.  
  45. Level script requirements
  46. -------------------------
  47. Team Definitions:
  48. game["allies"] = "marines";
  49. game["axis"] = "opfor";
  50. This sets the nationalities of the teams. Allies can be american, british, or russian. Axis can be german.
  51.  
  52. If using minefields or exploders:
  53. maps\mp\_load::main();
  54.  
  55. Optional level script settings
  56. ------------------------------
  57. Soldier Type and Variation:
  58. game["american_soldiertype"] = "normandy";
  59. game["german_soldiertype"] = "normandy";
  60. This sets what character models are used for each nationality on a particular map.
  61.  
  62. Valid settings:
  63. american_soldiertype normandy
  64. british_soldiertype normandy, africa
  65. russian_soldiertype coats, padded
  66. german_soldiertype normandy, africa, winterlight, winterdark
  67. */
  68.  
  69. /*QUAKED mp_tdm_spawn (0.0 0.0 1.0) (-16 -16 0) (16 16 72)
  70. Players spawn away from enemies and near their team at one of these positions.*/
  71.  
  72. /*QUAKED mp_tdm_spawn_axis_start (0.5 0.0 1.0) (-16 -16 0) (16 16 72)
  73. Axis players spawn away from enemies and near their team at one of these positions at the start of a round.*/
  74.  
  75. /*QUAKED mp_tdm_spawn_allies_start (0.0 0.5 1.0) (-16 -16 0) (16 16 72)
  76. Allied players spawn away from enemies and near their team at one of these positions at the start of a round.*/
  77.  
  78. main()
  79. {
  80.  
  81. if(getdvar("mapname") == "mp_background")
  82. return;
  83.  
  84. if ( !isdefined( game["switchedsides"] ) )
  85. game["switchedsides"] = false;
  86.  
  87. // Shut Off Dvars
  88. setDvar( "scr_forfeit_enable_inf", "0" );
  89. setDvar( "scr_force_autoassign_inf", "1" );
  90. setDvar( "scr_force_autoassign_clan_tags_inf", "" );
  91. setDvar( "scr_clan_vs_all_team_inf", "" );
  92. setDvar( "scr_health_death_sound_inf", "0" );
  93. setDvar( "scr_jump_slowdown_enable_inf", "1" );
  94. setDvar( "scr_cap_enable_inf", "0" );
  95. setDvar( "scr_deleteexplosivesondeath_inf", "1" );
  96. setDvar( "scr_teambalance_inf", "0" );
  97.  
  98. // Game Dvars.......... Too many :P Ya think!!!!!!
  99. level.scr_inf_forcestartspawns = getdvarx( "scr_inf_forcestartspawns", "int", 0, 0, 1 );
  100. level.scr_inf_pick_time = getdvarx( "scr_inf_pick_time", "int", 9, 5, 60 );
  101. level.scr_inf_ammo_bag_removal_time = getdvarx( "scr_inf_ammo_bag_removal_time", "int", 15, 1, 60 );
  102. level.scr_inf_allow_ammo_bags = getdvarx( "scr_inf_allow_ammo_bags", "int", 0, 0, 0 );
  103. level.scr_inf_rand_ammo_bag = getdvarx( "scr_inf_rand_ammo_bag", "int", 0, 0, 0 );
  104. level.scr_inf_percent_primary_ammo_bag = getdvarx( "scr_inf_percent_primary_ammo_bag", "int", 0, 0, 0 );
  105. level.scr_inf_nep_message = getdvarx( "scr_inf_nep_message", "string", "" );
  106. level.scr_inf_min_players = getdvarx( "scr_inf_min_players", "int", 3, 2, 10 );
  107. level.scr_inf_survival_points = getdvarx( "scr_inf_survival_points", "int", 100, 0, 1000 );
  108. level.scr_inf_last_survivor_points = getdvarx( "scr_inf_last_survivor_points", "int", 250, 0, 1000 );
  109. level.scr_inf_allow_last_survivor_enemy_ping = getdvarx( "scr_inf_allow_last_survivor_enemy_ping", "int", 0, 0, 0 );
  110. level.scr_inf_death_sounds = getdvarx( "scr_inf_death_sounds", "int", 0, 0, 0 );
  111. level.scr_inf_attack_sounds = getdvarx( "scr_inf_attack_sounds", "int", 0, 0, 0 );
  112. level.scr_inf_ambient_sounds = getdvarx( "scr_inf_ambient_sounds", "int", 0, 0, 0 );
  113. level.scr_inf_scream_on_spawn = getdvarx( "scr_inf_scream_on_spawn", "int", 0, 0, 0 );
  114. level.scr_inf_vision_infected_on = getdvarx( "scr_inf_vision_infected_on", "int", 0, 0, 0 );
  115. level.scr_inf_ammo_infected = getdvarx( "scr_inf_ammo_infected", "int", 0, 0, 100 );
  116. level.scr_inf_infected_ammo_amount = getdvarx( "scr_inf_infected_ammo_amount", "int", 0, 0, 100 );
  117. level.scr_inf_base_speed_infected = getdvarx( "scr_inf_base_speed_infected", "float", 1, 1, 1 );
  118. level.scr_inf_kill_points_infected = getdvarx( "scr_inf_kill_points_infected", "int", 10, 0, 1000 );
  119. level.scr_inf_kill_points_infected_last_kill = getdvarx( "scr_inf_kill_points_infected_last_kill", "int", 80, 0, 1000 );
  120. level.scr_inf_kill_points_last_survivor = getdvarx( "scr_inf_kill_points_last_survivor", "int", 140, 0, 1000 );
  121. level.scr_inf_use_infected_model = getdvarx( "scr_inf_use_infected_model", "int", 1, 0, 1 );
  122. level.scr_inf_ammo_bag_messages = getdvarx( "scr_inf_ammo_bag_messages", "int", 0, 0, 0 );
  123. level.scr_inf_limit_planted_c4s = getdvarx( "scr_inf_limit_planted_c4s", "int", 6, 0, 999 );
  124. level.scr_inf_limit_planted_claymores = getdvarx( "scr_inf_limit_planted_claymores", "int", 6, 0, 999 );
  125. level.scr_inf_custom_teams_disable = getdvarx( "scr_inf_custom_teams_disable", "int", 0, 0, 1 );
  126. level.scr_inf_scavenger_icon = getdvarx( "scr_inf_scavenger_icon", "int", 0, 0, 0 );
  127. level.scr_inf_infected_burn = getdvarx( "scr_inf_infected_burn", "int", 0, 0, 0 );
  128. level.scr_inf_infected_burn_sounds = getdvarx( "scr_inf_infected_burn_sounds", "int", 0, 0, 0 );
  129. level.scr_inf_allow_hardpoint_ammobags = getdvarx( "scr_inf_allow_hardpoint_ammobags", "int", 0, 0, 0 );
  130. level.scr_inf_last_survivor_weapon_enable = getdvarx( "scr_inf_last_survivor_weapon_enable", "int", 0, 0, 1 );
  131. level.scr_inf_extra_knife_kill = getdvarx( "scr_inf_extra_knife_kill", "int", 0, 0, 0 );
  132. level.scr_inf_allow_hardpoints_infected = getdvarx( "scr_inf_allow_hardpoints_infected", "int", 0, 0, 1 );
  133. level.scr_inf_count_respawns = getdvarx( "scr_inf_count_respawns", "int", 0, 0, 0 );
  134. level.scr_inf_count_respawns_amount = getdvarx( "scr_inf_count_respawns_amount", "int", 0, 0, 0 );
  135. level.scr_inf_night_mode = getdvarx( "scr_inf_night_mode", "int", 0, 0, 0 );
  136. level.scr_inf_night_mode_startDist = getdvarx( "scr_inf_night_mode_startDist", "int", 50, 0, 500 );
  137. level.scr_inf_night_mode_halfwayDist = getdvarx( "scr_inf_night_mode_halfwayDist", "int", 700, 0, 1000 );
  138.  
  139. // Trickery! Must have default setting in gametype :)
  140. setDvar( "scr_limit_planted_c4s_inf", level.scr_inf_limit_planted_c4s );
  141. setDvar( "scr_limit_planted_claymores_inf", level.scr_inf_limit_planted_claymores );
  142. setDvar( "scr_custom_teams_enable_inf", level.scr_inf_custom_teams_disable );
  143.  
  144. level.scr_inf_sur_force_weapon = toLower( getdvarx( "scr_inf_sur_force_weapon", "string", "winchester1200_mp;winchester1200_reflex_mp;winchester1200_grip_mp" ) );
  145. level.scr_inf_sur_force_weapon = strtok( level.scr_inf_sur_force_weapon, ";" );
  146.  
  147. level.scr_inf_sur_force_pistol = toLower( getdvarx( "scr_inf_sur_force_pistol", "string", "" ) );
  148. level.scr_inf_sur_force_pistol = strtok( level.scr_inf_sur_force_pistol, ";" );
  149.  
  150. level.scr_inf_sur_weapon_secondary = toLower( getdvarx( "scr_inf_sur_weapon_secondary", "string", "claymore_mp" ) );
  151. level.scr_inf_sur_weapon_secondary = strtok( level.scr_inf_sur_weapon_secondary, ";" );
  152.  
  153. level.scr_inf_sur_specialty_slot0 = getdvarx( "scr_inf_sur_specialty_slot0", "string", "specialty_parabolic" );
  154. if ( !issubstr( "specialty_null;specialty_parabolic;specialty_bulletdamage", level.scr_inf_sur_specialty_slot0 ) ) {
  155. level.scr_inf_sur_specialty_slot0 = "specialty_parabolic";
  156. }
  157.  
  158. level.scr_inf_sur_specialty_slot1 = getdvarx( "scr_inf_sur_specialty_slot1", "string", "specialty_fastreload" );
  159. if ( !issubstr( "specialty_null;specialty_fastreload;specialty_rof;specialty_explosivedamage", level.scr_inf_sur_specialty_slot1 ) ) {
  160. level.scr_inf_sur_specialty_slot1 = "specialty_fastreload";
  161. }
  162.  
  163. level.scr_inf_sur_specialty_slot2 = getdvarx( "scr_inf_sur_specialty_slot2", "string", "specialty_bulletaccuracy" );
  164. if ( !issubstr( "specialty_null;specialty_bulletaccuracy;specialty_bulletpenetration", level.scr_inf_sur_specialty_slot2 ) ) {
  165. level.scr_inf_sur_specialty_slot2 = "specialty_bulletaccuracy";
  166. }
  167.  
  168. level.scr_inf_force_weapon = toLower( getdvarx( "scr_inf_force_weapon", "string", "deserteaglegold_mp" ) );
  169. level.scr_inf_force_weapon = strtok( level.scr_inf_force_weapon, ";" );
  170.  
  171. level.scr_inf_sur_weapon_flash = getdvarx( "scr_inf_sur_weapon_flash", "string", "concussion_grenade_mp" );
  172. if ( !issubstr( "beretta_mp;concussion_grenade_mp;colt45_mp;usp_mp;deserteagle_mp;deserteaglegold_mp", level.scr_inf_sur_weapon_flash ) ) {
  173. level.scr_inf_sur_weapon_flash = "concussion_grenade_mp";
  174. }
  175.  
  176. level.scr_inf_force_weapon_secondary = getdvarx( "scr_inf_force_weapon_secondary", "string", "throwingknife_mp" );
  177. if ( !issubstr( "throwingknife_mp", level.scr_inf_force_weapon_secondary ) ) {
  178. level.scr_inf_force_weapon_secondary = "throwingknife_mp";
  179. }
  180.  
  181. level.scr_inf_specialty_slot0 = getdvarx( "scr_inf_specialty_slot0", "string", "specialty_fastreload" );
  182. if ( !issubstr( "specialty_null;specialty_fastreload", level.scr_inf_specialty_slot0 ) ) {
  183. level.scr_inf_specialty_slot0 = "specialty_fastreload";
  184. }
  185.  
  186. level.scr_inf_specialty_slot1 = getdvarx( "scr_inf_specialty_slot1", "string", "specialty_longersprint" );
  187. if ( !issubstr( "specialty_null;specialty_longersprint;specialty_specialty_gpsjammer", level.scr_inf_specialty_slot1 ) ) {
  188. level.scr_inf_specialty_slot1 = "specialty_longersprint";
  189. }
  190.  
  191. level.scr_inf_specialty_slot2 = getdvarx( "scr_inf_specialty_slot2", "string", "specialty_tactical_insertion" );
  192. if ( !issubstr( "specialty_tactical_insertion;specialty_quieter;specialty_longersprint", level.scr_inf_specialty_slot2 ) ) {
  193. level.scr_inf_specialty_slot2 = "specialty_tactical_insertion";
  194. }
  195.  
  196. level.scr_inf_last_survivor_weapon = getdvarx( "scr_inf_last_survivor_weapon", "string", "winchester1200_reflex_mp" );
  197. if ( !issubstr( "saw_mp;winchester1200_reflex_mp;m60e4_mp", level.scr_inf_last_survivor_weapon ) ) {
  198. level.scr_inf_last_survivor_weapon = "winchester1200_reflex_mp";
  199. }
  200.  
  201. maps\mp\gametypes\_globallogic::init();
  202. maps\mp\gametypes\_callbacksetup::SetupCallbacks();
  203. maps\mp\gametypes\_globallogic::SetupCallbacks();
  204.  
  205. maps\mp\gametypes\_globallogic::registerNumLivesDvar( level.gameType, 0, 0, 0 );
  206. maps\mp\gametypes\_globallogic::registerRoundLimitDvar( level.gameType, 1, 1, 1 );
  207. maps\mp\gametypes\_globallogic::registerRoundSwitchDvar( level.gameType, 0, 0, 0 );
  208. maps\mp\gametypes\_globallogic::registerScoreLimitDvar( level.gameType, 0, 0, 0 );
  209. maps\mp\gametypes\_globallogic::registerTimeLimitDvar( level.gameType, 12, 0, 1440 );
  210.  
  211. level.teamBased = true;
  212.  
  213. level.onStartGameType = ::onStartGameType;
  214. level.onSpawnPlayer = ::onSpawnPlayer;
  215. level.onLoadoutGiven = ::onLoadoutGiven;
  216. level.onPrecacheGametype = ::onPrecacheGametype;
  217. level.onPlayerKilled = ::onPlayerKilled;
  218. level.onPlayerDisconnect = ::onPlayerDisconnect;
  219. level.onTimeLimit = ::onTimeLimit;
  220.  
  221. }
  222.  
  223.  
  224. onStartGameType()
  225. {
  226. setClientNameMode("auto_change");
  227.  
  228. maps\mp\gametypes\_globallogic::setObjectiveText( "allies", &"OW_OBJECTIVES_INF_ALLIES" );
  229. maps\mp\gametypes\_globallogic::setObjectiveText( "axis", &"OW_OBJECTIVES_INF_AXIS" );
  230.  
  231. if ( level.splitscreen )
  232. {
  233. maps\mp\gametypes\_globallogic::setObjectiveScoreText( "allies", &"OW_OBJECTIVES_INF_ALLIES" );
  234. maps\mp\gametypes\_globallogic::setObjectiveScoreText( "axis", &"OW_OBJECTIVES_INF_AXIS" );
  235. }
  236. else
  237. {
  238. maps\mp\gametypes\_globallogic::setObjectiveScoreText( "allies", &"OW_OBJECTIVES_INF_SCORE_ALLIES" );
  239. maps\mp\gametypes\_globallogic::setObjectiveScoreText( "axis", &"OW_OBJECTIVES_INF_SCORE_AXIS" );
  240. }
  241. maps\mp\gametypes\_globallogic::setObjectiveHintText( "allies", &"OW_OBJECTIVES_INF_HINT_ALLIES" );
  242. maps\mp\gametypes\_globallogic::setObjectiveHintText( "axis", &"OW_OBJECTIVES_INF_HINT_AXIS" );
  243.  
  244. level.spawnMins = ( 0, 0, 0 );
  245. level.spawnMaxs = ( 0, 0, 0 );
  246. maps\mp\gametypes\_spawnlogic::placeSpawnPoints( "mp_tdm_spawn_allies_start" );
  247. maps\mp\gametypes\_spawnlogic::placeSpawnPoints( "mp_tdm_spawn_axis_start" );
  248. maps\mp\gametypes\_spawnlogic::addSpawnPoints( "allies", "mp_tdm_spawn" );
  249. maps\mp\gametypes\_spawnlogic::addSpawnPoints( "axis", "mp_tdm_spawn" );
  250.  
  251. level.mapCenter = maps\mp\gametypes\_spawnlogic::findBoxCenter( level.spawnMins, level.spawnMaxs );
  252. setMapCenter( level.mapCenter );
  253.  
  254. allowed[0] = "war";
  255.  
  256. if ( getDvarInt( "scr_oldHardpoints" ) > 0 )
  257. allowed[1] = "hardpoint";
  258.  
  259. level.displayRoundEndText = false;
  260.  
  261. maps\mp\gametypes\_gameobjects::main(allowed);
  262.  
  263. level thread onPlayerConnecting();
  264. level thread updateTeamScores();
  265. level thread serverCheck();
  266.  
  267. // Night Mode
  268. if( level.scr_inf_night_mode == 1 ) thread infectionNightMode();
  269. }
  270.  
  271. onPrecacheGametype()
  272. {
  273. // Precache Model and View Hands Infected
  274. precacheModel( "mp_body_infected_a" );
  275.  
  276. // Precache Shaders
  277. precacheShader( "hud_infection" );
  278. precacheShader( "hud_survivor" );
  279. precacheShader( "hud_scavenger" );
  280.  
  281. // Precache strings
  282. precacheString( &"OW_INF_NEW_TIMER" );
  283. precacheString( &"OW_INF_SURVIVORS_WIN" );
  284. precacheString( &"OW_INF_INFECTED_WINS" );
  285. precacheString( &"OW_INF_START_OVER" );
  286. precacheString( &"OW_INF_PICK_AGAIN" );
  287. precacheString( &"OW_INF_NOT_ENOUGH_PLAYERS" );
  288. precacheString( &"OW_INF_INFECTED" );
  289. precacheString( &"OW_INF_SURVIVORS" );
  290.  
  291.  
  292. }
  293.  
  294. onSpawnPlayer()
  295. {
  296.  
  297. if ( isDefined( self.inf_scavengerIcon ) ) self.inf_scavengerIcon destroy();
  298.  
  299. if( isDefined( self.firstSpawn ) && self.firstSpawn == true )
  300. {
  301. self.firstSpawn = false;
  302.  
  303. if( self.pers["team"] == "allies" )
  304. {
  305. self.switching_teams = true;
  306. self.joining_team = "axis";
  307. self.leaving_team = "allies";
  308. self.sessionteam = "axis";
  309. self.pers["team"] = "axis";
  310. self.team = "axis";
  311. self notify("joined_team");
  312. self maps\mp\gametypes\_globallogic::updateObjectiveText();
  313. self maps\mp\gametypes\_spectating::setSpectatePermissions();
  314. self notify( "end_respawn" );
  315.  
  316. }
  317.  
  318. self.isSurvivor = true;
  319. self.isInfected = false;
  320. self.isFirstInfected = false;
  321. self.isLastSurvivor = false;
  322. self.lastSurvivorRespawns = 0;
  323. self.getsSurvivorAmmo = true;
  324.  
  325. }
  326.  
  327. if( self.pers["team"] == "allies" ) {
  328. self.isSurvivor = false;
  329. self.isInfected = true;
  330. }
  331.  
  332. // Check which spawn points should be used
  333. if ( game["switchedsides"] ) {
  334. spawnTeam = level.otherTeam[ self.pers["team"] ];
  335. } else {
  336. spawnTeam = self.pers["team"];
  337. }
  338.  
  339. self.usingObj = undefined;
  340.  
  341. if ( level.inGracePeriod || level.scr_inf_forcestartspawns )
  342. {
  343. spawnPoints = getentarray("mp_tdm_spawn_" + spawnTeam + "_start", "classname");
  344.  
  345. if ( !spawnPoints.size )
  346. spawnPoints = getentarray("mp_sab_spawn_" + spawnTeam + "_start", "classname");
  347.  
  348. if ( !spawnPoints.size )
  349. {
  350. spawnPoints = maps\mp\gametypes\_spawnlogic::getTeamSpawnPoints( spawnTeam );
  351. spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam( spawnPoints );
  352. }
  353. else
  354. {
  355. spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random( spawnPoints );
  356. }
  357. }
  358. else
  359. {
  360. spawnPoints = maps\mp\gametypes\_spawnlogic::getTeamSpawnPoints( spawnTeam );
  361. spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam( spawnPoints );
  362. }
  363.  
  364. self spawn( spawnPoint.origin, spawnPoint.angles );
  365.  
  366. // Scavenger Icon
  367. if ( !isDefined( self.inf_scavengerIcon ) ) {
  368. self.inf_scavengerIcon = self createIcon( "hud_scavenger", 65, 65 );
  369. self.inf_scavengerIcon setPoint( "CENTER", "CENTER", 290, 130 );
  370. self.inf_scavengerIcon.archived = true;
  371. self.inf_scavengerIcon.hideWhenInMenu = true;
  372. self.inf_scavengerIcon.sort = -3;
  373. self.inf_scavengerIcon.alpha = 0;
  374. }
  375.  
  376. self.isBurning = false;
  377.  
  378. }
  379.  
  380. onPlayerConnecting()
  381. {
  382. for ( ;; )
  383. {
  384.  
  385. level waittill( "connected", player );
  386. player.firstSpawn = true;
  387.  
  388. }
  389.  
  390. }
  391.  
  392. updateTeamScores()
  393. {
  394.  
  395. for(;;)
  396. {
  397. // Infected - Allies
  398. game["teamScores"]["allies"] = getInfectedPlayers();
  399. setTeamScore( "allies", getInfectedPlayers() );
  400.  
  401. // Survivor - Axis
  402. game["teamScores"]["axis"] = getSurvivorPlayers();
  403. setTeamScore( "axis", getSurvivorPlayers() );
  404.  
  405. wait( 0.05 );
  406.  
  407. }
  408.  
  409. }
  410.  
  411. onPlayerDisconnect()
  412. {
  413.  
  414. howManySurvivors = getSurvivorPlayers();
  415. howManyInfected = getInfectedPlayers();
  416.  
  417. // More than 2 Survivors, so pick Infected
  418. if ( howManyInfected == 0 && howManySurvivors > 1 ) {
  419.  
  420. // Pick Infected Player again
  421. players = level.players;
  422. for(i = 0; i < players.size; i++)
  423. if( isDefined( players[i] ) && players[i].pers["team"] == "axis" )
  424. players[i] thread maps\mp\gametypes\_hud_message::oldNotifyMessage( &"OW_INF_START_OVER", &"OW_INF_PICK_AGAIN" );
  425.  
  426. level thread timer();
  427. }
  428.  
  429. // Only 1 Survivor left, not enough to pick Infected, End game!
  430. if ( howManyInfected == 0 && howManySurvivors == 1 ) {
  431. game["teamScores"]["allies"] = 0;
  432. setTeamScore( "allies", 0 );
  433. thread maps\mp\gametypes\_finalkillcam::endGameFK( "axis", game["strings"]["score_limit_reached"] );
  434. level thread maps\mp\gametypes\_globallogic::endGame( "axis", &"OW_INF_SURVIVORS_WIN" );
  435. }
  436.  
  437. // Survivors are scared! End game!
  438. if ( howManySurvivors == 0 ) {
  439. game["teamScores"]["axis"] = 0;
  440. setTeamScore( "axis", 0 );
  441. thread maps\mp\gametypes\_finalkillcam::endGameFK( "allies", game["strings"]["score_limit_reached"] );
  442. level thread maps\mp\gametypes\_globallogic::endGame( "allies", &"OW_INF_INFECTED_WINS" );
  443. }
  444.  
  445. }
  446.  
  447. onTimeLimit()
  448. {
  449.  
  450. // Check on how many Survivors left
  451. howManySurvivors = getSurvivorPlayers();
  452. howManyInfected = getInfectedPlayers();
  453.  
  454. // Survivors higher score than Infected, Survivors Win!
  455. if( howManySurvivors > howManyInfected ) {
  456. thread maps\mp\gametypes\_finalkillcam::endGameFK( "axis", game["strings"]["time_limit_reached"] );
  457. thread maps\mp\gametypes\_globallogic::endGame( "axis", &"OW_INF_SURVIVORS_WIN" );
  458.  
  459. // Survivors still have 1 player left, Survivors Win!
  460. } else if( howManySurvivors < howManyInfected ) {
  461.  
  462. game["teamScores"]["axis"] = howManyInfected + 1;
  463. setTeamScore( "axis", howManyInfected + 1 );
  464. thread maps\mp\gametypes\_finalkillcam::endGameFK( "axis", game["strings"]["time_limit_reached"] );
  465.  
  466. thread maps\mp\gametypes\_globallogic::endGame( "axis", &"OW_INF_SURVIVORS_WIN" );
  467.  
  468. // Score tied, Survivors alive, give extra point to Survivors to Win!
  469. } else if( howManySurvivors == howManyInfected ) {
  470.  
  471. game["teamScores"]["axis"] = howManyInfected + 1;
  472. setTeamScore( "axis", howManyInfected + 1 );
  473.  
  474. thread maps\mp\gametypes\_finalkillcam::endGameFK( "axis", game["strings"]["time_limit_reached"] );
  475.  
  476. thread maps\mp\gametypes\_globallogic::endGame( "axis", &"OW_INF_SURVIVORS_WIN" );
  477.  
  478. }
  479.  
  480. }
  481.  
  482. timer()
  483. {
  484. level endon( "game_over" );
  485. level endon( "timer_over" );
  486. level endon( "intermission" );
  487.  
  488. tickSounds = 5;
  489.  
  490. while ( level.inPrematchPeriod )
  491. wait( 0.05 );
  492.  
  493. xWait( 1.0 );
  494.  
  495. timerDisplay = [];
  496. timerDisplay = createServerTimer( "objective", 1.4 );
  497. timerDisplay setPoint( "TOPRIGHT", "TOPRIGHT", 0, 0 );
  498.  
  499. timerDisplay.label = &"OW_INF_NEW_TIMER";
  500.  
  501. timerDisplay.alpha = 1;
  502. timerDisplay.archived = false;
  503. timerDisplay.hideWhenInMenu = true;
  504.  
  505. timeLeft = level.scr_inf_pick_time;
  506. timerDisplay.color = ( 1, 1 ,1 );
  507. timerDisplay setTimer( timeLeft );
  508.  
  509. while ( timeLeft > 0 ) {
  510. // Do we need to play a tick sound?
  511. if ( timeLeft <= tickSounds ) {
  512. timerDisplay.color = ( 1, 0.5 ,0 );
  513. for ( p = 0; p < level.players.size; p++ ) {
  514. player = level.players[p];
  515. if ( isDefined( player ) ) {
  516. player playLocalSound( "ui_mp_suitcasebomb_timer" );
  517.  
  518. }
  519. }
  520.  
  521. }
  522.  
  523. wait( 1.0 );
  524. timeLeft--;
  525.  
  526. }
  527.  
  528. // Hide timer
  529. timerDisplay.alpha = 0;
  530.  
  531. level thread pickFirstInfected();
  532.  
  533. level notify( "timer_over" );
  534.  
  535. }
  536.  
  537. pickFirstInfected()
  538. {
  539. level endon( "infected_picked" );
  540.  
  541. // Build an array with all the players that are alive
  542. infCandidates = [];
  543.  
  544. for ( index = 0; index < level.players.size; index++ )
  545. {
  546. wait( 0.05 );
  547.  
  548. player = level.players[index];
  549. if ( isDefined( player ) && isAlive( player ) && player.pers["team"] != "spectator" && player.pers["team"] == "axis" )
  550. {
  551. infCandidates[infCandidates.size] = player;
  552.  
  553. }
  554.  
  555. }
  556.  
  557.  
  558. // Get a random player from the list of candidates
  559. infPlayer = randomIntRange( 0, infCandidates.size );
  560.  
  561. // Infected is picked
  562. player = infCandidates[infPlayer];
  563.  
  564. // Set new player info
  565. player switchPlayerTeam( level.otherTeam[ player.pers["team"] ], false );
  566.  
  567. notifyData = spawnStruct();
  568. notifyData.titleText = "First Infected";
  569. notifyData.notifyText = "Kill Survivors to Win";
  570. notifyData.iconName = "hud_infection";
  571. notifyData.glowColor = ( 1, 0, 0 ); // Red
  572. notifyData.sound = "mp_enemy_obj_captured";
  573. notifyData.duration = 4.0;
  574.  
  575. player thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
  576.  
  577. player.isSurvivor = false;
  578. player.isInfected = true;
  579. player.isFirstInfected = true;
  580.  
  581. // Play a sound to tell Infected has been picked
  582. players = level.players;
  583. for(i = 0; i < players.size; i++)
  584. if( players[i].pers["team"] != "spectator" && isAlive( players[i] ) && players[i] != player ) {
  585. players[i] playLocalSound( "mp_challenge_complete" );
  586. players[i] thread maps\mp\gametypes\_hud_message::oldNotifyMessage( &"OW_INF_FIRST_INFECTED", player.name );
  587. }
  588.  
  589. level notify( "infected_picked" );
  590.  
  591.  
  592. }
  593.  
  594. onLoadoutGiven()
  595. {
  596. if( isDefined( self.isSurvivor ) && self.isSurvivor == true )
  597. {
  598. if( !level.inPrematchPeriod && level.infReady == true )
  599. {
  600. howManySurvivors = getSurvivorPlayers();
  601.  
  602. if( howManySurvivors == 1 ) {
  603.  
  604. self.isLastSurvivor = true;
  605.  
  606. } else {
  607.  
  608. self.isLastSurvivor = false;
  609. self.lastSurvivorRespawns = 0;
  610. }
  611. }
  612.  
  613. self getSurvivorLoadout();
  614. }
  615.  
  616. if( isDefined( self.isInfected ) && self.isInfected == true ) self getInfectedLoadout();
  617.  
  618.  
  619. }
  620.  
  621. getSurvivorLoadout()
  622. {
  623. self endon( "disconnect" );
  624.  
  625. survivorWeapon = "";
  626. secondaryWeapon = "";
  627. pistolWeapon = "";
  628.  
  629. // Remove all weapons and perks from the survivor
  630. self thread maps\mp\gametypes\_gameobjects::_disableWeapon();
  631.  
  632. self takeAllWeapons();
  633. self clearPerks();
  634.  
  635. self.isInfected = false;
  636. self.isSurvivor = true;
  637.  
  638. // Give the Survivor fixed specialties
  639. self.specialty = [];
  640. self.specialty[0] = level.scr_inf_sur_specialty_slot0;
  641. if ( self.specialty[0] != "specialty_null" )
  642. self setPerk( self.specialty[0] );
  643.  
  644. self.specialty[1] = level.scr_inf_sur_specialty_slot1;
  645. if ( self.specialty[1] != "specialty_null" )
  646. self setPerk( self.specialty[1] );
  647.  
  648. self.specialty[2] = level.scr_inf_sur_specialty_slot2;
  649. if ( self.specialty[2] != "specialty_null" )
  650. self setPerk( self.specialty[2] );
  651.  
  652. // Process Time
  653. wait( 0.05 );
  654.  
  655. // Check if the Survivor has no weapon, then force default
  656. if ( level.scr_inf_sur_force_weapon != "" ) {
  657. survivorWeapon = level.scr_inf_sur_force_weapon[ randomIntRange( 0, level.scr_inf_sur_force_weapon.size ) ];
  658. }
  659.  
  660. // Give start ammo for Survivor weapon and switch to it
  661. self giveWeapon( survivorWeapon );
  662.  
  663. if( self.getsSurvivorAmmo == true ) {
  664. self giveStartAmmo( survivorWeapon );
  665. } else {
  666. self setWeaponAmmoClip( survivorWeapon, 0 );
  667. self setWeaponAmmoStock( survivorWeapon, 0 );
  668. }
  669.  
  670. self setSpawnWeapon( survivorWeapon );
  671. self switchToWeapon( survivorWeapon );
  672.  
  673. // Check if the Survivor has secondary weapon
  674. if ( level.scr_inf_sur_weapon_secondary != "" ) {
  675. secondaryWeapon = level.scr_inf_sur_weapon_secondary[ randomIntRange( 0, level.scr_inf_sur_weapon_secondary.size ) ];
  676.  
  677. // Give secondary weapon and start ammo
  678. self giveWeapon( secondaryWeapon );
  679.  
  680. if( self.getsSurvivorAmmo == true ) {
  681. self giveMaxAmmo( secondaryWeapon );
  682. } else {
  683. self setWeaponAmmoClip( secondaryWeapon, 1 );
  684. self setWeaponAmmoStock( secondaryWeapon, 1 );
  685. }
  686.  
  687. self thread giveActionSlot3AfterDelay( secondaryWeapon );
  688. self setActionSlot( 4, "" );
  689.  
  690. }
  691.  
  692.  
  693. // Check if the Survivor has a pistol
  694. if ( level.scr_inf_sur_force_pistol != "" ) {
  695. pistolWeapon = level.scr_inf_sur_force_pistol[ randomIntRange( 0, level.scr_inf_sur_force_pistol.size ) ];
  696.  
  697.  
  698. // Give secondary weapon and start ammo
  699. self giveWeapon( pistolWeapon );
  700.  
  701. if( self.getsSurvivorAmmo == true ) {
  702. self giveMaxAmmo( pistolWeapon );
  703. } else {
  704. self setWeaponAmmoClip( pistolWeapon, 0 );
  705. self setWeaponAmmoStock( pistolWeapon, 0 );
  706. }
  707.  
  708. }
  709.  
  710. if( isDefined( self.isLastSurvivor ) && self.isLastSurvivor == true )
  711. {
  712. if( level.scr_inf_count_respawns == 1 ) self.lastSurvivorRespawns++;
  713.  
  714. if( level.scr_inf_last_survivor_weapon_enable == 1 )
  715. {
  716. self takeWeapon( survivorWeapon );
  717. self giveWeapon( level.scr_inf_last_survivor_weapon );
  718.  
  719. if( self.getsSurvivorAmmo == false )
  720. {
  721. self setWeaponAmmoClip( level.scr_inf_last_survivor_weapon, 0 );
  722. self setWeaponAmmoStock( level.scr_inf_last_survivor_weapon, 0 );
  723. self setSpawnWeapon( level.scr_inf_last_survivor_weapon );
  724. self switchToWeapon( level.scr_inf_last_survivor_weapon );
  725.  
  726. } else {
  727.  
  728. self giveStartAmmo( level.scr_inf_last_survivor_weapon );
  729. self setSpawnWeapon( level.scr_inf_last_survivor_weapon );
  730. self switchToWeapon( level.scr_inf_last_survivor_weapon );
  731. }
  732.  
  733. }
  734.  
  735. // Give player max health
  736. self.maxhealth = getDvarInt( "scr_player_maxhealth" );
  737. self.health = getDvarInt( "scr_player_maxhealth" );
  738.  
  739. if( level.scr_inf_allow_last_survivor_enemy_ping == 1 ) self setClientDvar( "g_compassshowenemies", "1" );
  740.  
  741. notifyData = spawnStruct();
  742. notifyData.titleText = "Last Survivor!";
  743. notifyData.notifyText = "Kick Ass, Soldier!";
  744. notifyData.glowColor = ( 0, 1, 0 ); // Green
  745. notifyData.iconName = "hud_survivor";
  746. notifyData.sound = "mp_obj_captured";
  747. notifyData.duration = 4.0;
  748.  
  749. self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
  750. if( self.lastSurvivorRespawns == 1 ) {
  751. self givePlayerScore( "challenge", level.scr_inf_last_survivor_points );
  752. }
  753.  
  754. }
  755.  
  756. // Enable the Weapons
  757. self thread maps\mp\gametypes\_gameobjects::_enableWeapon();
  758.  
  759. }
  760.  
  761. getInfectedLoadout()
  762. {
  763. self endon( "disconnect" );
  764.  
  765. chanceScream = randomIntRange( 1, 101 );
  766.  
  767. chanceAmmo = randomIntRange( 1, 101 );
  768.  
  769. chanceBurn = randomIntRange( 1, 101 );
  770.  
  771. // Random or Fixed Ammo
  772. if( level.scr_inf_infected_ammo_amount > 0 ) {
  773.  
  774. howMuchAmmo = level.scr_inf_infected_ammo_amount;
  775. }else {
  776. howMuchAmmo = randomIntRange( 1, 11 );
  777. }
  778.  
  779. // Scream on spawn
  780. if( chanceScream <= level.scr_inf_scream_on_spawn ) self playLocalSound( "attack" );
  781.  
  782. // Remove all weapons and perks from the survivor
  783. self thread maps\mp\gametypes\_gameobjects::_disableWeapon();
  784.  
  785. self takeAllWeapons();
  786. self clearPerks();
  787.  
  788. // Change to Infected Model
  789. if( level.scr_inf_use_infected_model == 1 )
  790. {
  791. self detachHead();
  792. self setModel( "mp_body_infected_a" );
  793. self setViewModel( "viewmodel_jap_infantry_arms" );
  794. }
  795.  
  796. self.isInfected = true;
  797. self.isSurvivor = false;
  798.  
  799. // Remove any hardpoints from the infected player
  800. if ( isDefined( self.pers["hardPointItem"] ) ) {
  801. self.pers["hardPointItem"] = undefined;
  802. self.cur_kill_streak = 0;
  803. }
  804.  
  805. // Give the Infected fixed specialties
  806. self.specialty = [];
  807. self.specialty[0] = level.scr_inf_specialty_slot0;
  808. if ( self.specialty[0] != "specialty_null" )
  809. self setPerk( self.specialty[0] );
  810.  
  811. self.specialty[1] = level.scr_inf_specialty_slot1;
  812. if ( self.specialty[1] != "specialty_null" )
  813. self setPerk( self.specialty[1] );
  814.  
  815. self.specialty[2] = level.scr_inf_specialty_slot2;
  816. if ( self.specialty[2] != "specialty_null" )
  817. self setPerk( self.specialty[2] );
  818.  
  819. infectedWeapon = "";
  820. infthrowingknife = "";
  821.  
  822. // Check if the Infected has no weapon, then force default
  823. if ( level.scr_inf_force_weapon != "" ) {
  824. infectedWeapon = level.scr_inf_force_weapon[ randomIntRange( 0, level.scr_inf_force_weapon.size ) ];
  825.  
  826. }
  827.  
  828. // Check if the Infected has secondary weapon
  829. if ( level.scr_inf_force_weapon_secondary != "" ) {
  830. infthrowingknife = level.scr_inf_force_weapon_secondary;
  831.  
  832. // Give secondary weapon and start ammo
  833. self giveWeapon( infthrowingknife );
  834.  
  835. if( self.getsSurvivorAmmo == false ) {
  836. self giveMaxAmmo( infthrowingknife );
  837. } else {
  838. self setWeaponAmmoClip( infthrowingknife, 1 );
  839. self setWeaponAmmoStock( infthrowingknife, 1 );
  840. }
  841.  
  842. self thread giveActionSlot3AfterDelay( infthrowingknife );
  843. self setActionSlot( 4, "" );
  844.  
  845. }
  846.  
  847. // Give ammo for Infected weapon and switch to it
  848. self giveWeapon( infectedWeapon );
  849.  
  850. if( chanceAmmo <= level.scr_inf_ammo_infected ) {
  851.  
  852. self setWeaponAmmoClip( infectedWeapon, 0 );
  853. self setWeaponAmmoStock( infectedWeapon, howMuchAmmo );
  854.  
  855. } else {
  856.  
  857. self setWeaponAmmoClip( infectedWeapon, 0 );
  858. self setWeaponAmmoStock( infectedWeapon, 0 );
  859. }
  860.  
  861. self setSpawnWeapon( infectedWeapon );
  862. self switchToWeapon( infectedWeapon );
  863.  
  864. // Enable the Weapons
  865. self thread maps\mp\gametypes\_gameobjects::_enableWeapon();
  866.  
  867. // Move speed for Infected
  868. self thread InfectedScript\mp\_speedcontrol::setBaseSpeed( level.scr_inf_base_speed_infected );
  869.  
  870. // Burn Infected player
  871. if( chanceBurn <= level.scr_inf_infected_burn ) {
  872. self.isBurning = true;
  873. self thread infectedBurn();
  874. }
  875.  
  876. // Attack Sounds when Melee
  877. if( level.scr_inf_attack_sounds >= 1 && self.isBurning == false ) self thread watchMeleeButton();
  878.  
  879. // Ambient Growl Sounds
  880. if( level.scr_inf_ambient_sounds == 1 && self.isBurning == false ) self thread ambientSounds();
  881.  
  882. // Infected Vision
  883. if( level.scr_inf_vision_infected_on == 1 ) { // Green
  884. self setClientDvar( "cg_fovscale", 1.33 );
  885. self setGlowTweaks( 1, 0.6, 0.5, 8, 8 );
  886. self setFilmTweaks( 1, 0, 1, "1 1 1 1", "0 2 0 0.001", 0, 1.3 );
  887. self setDepthOfField( 40, 80, 100, 900, 5, 1.5 ); // ( nearstart, nearend, farstart, farend, nearblur, farblur )
  888. }
  889.  
  890. if( level.scr_inf_vision_infected_on == 2 ) { // Clear
  891. self setClientDvar( "cg_fovscale", 1.33 );
  892. self setGlowTweaks( 1, 0.6, 0.5, 8, 8 );
  893. self setFilmTweaks( 1, 0, 1, "1 1 1 1", "1 1 1 0.001", 0, 1.3 );
  894. self setDepthOfField( 40, 80, 100, 900, 5, 1.5 ); // ( nearstart, nearend, farstart, farend, nearblur, farblur )
  895. }
  896.  
  897. }
  898.  
  899. infectedBurn()
  900. {
  901. self endon("disconnect");
  902. self endon("death");
  903.  
  904. if( level.scr_inf_infected_burn_sounds == 1 ) self thread infectedBurnSounds();
  905.  
  906. for(;;)
  907. {
  908. playFXOnTag( level.fx_infected_burn, self, "back_low" );
  909. wait( 0.08 );
  910. }
  911.  
  912. }
  913.  
  914. infectedBurnSounds()
  915. {
  916. self endon("disconnect");
  917. self endon("death");
  918. self endon( "joined_spectators" );
  919.  
  920. for(;;)
  921. {
  922. self playSound( "death" );
  923. wait( randomFloatRange( 1.5, 3.0 ) );
  924. }
  925.  
  926. }
  927.  
  928. setGlowTweaks( on, cutoff, desaturation, intensity, radius )
  929. {
  930.  
  931. self setClientDvars( "r_glowUseTweaks", 1, "r_glow", 1, "r_glowTweakEnable", on, "r_glowTweakBloomCutOff", cutoff, "r_glowTweakBloomDesaturation", desaturation, "r_glowTweakBloomIntensity0", intensity, "r_glowTweakRadius0", radius );
  932.  
  933. }
  934.  
  935. setFilmTweaks( on, invert, desaturation, darktint, lighttint, brightness, contrast )
  936. {
  937.  
  938. self setClientDvars( "r_filmusetweaks", 1, "r_filmtweaks", 1, "r_filmtweakenable", on, "r_filmtweakinvert", invert, "r_filmtweakdesaturation", desaturation , "r_filmtweakdarktint", darktint, "r_filmtweaklighttint", lighttint, "r_filmtweakbrightness", brightness, "r_filmtweakcontrast", contrast );
  939.  
  940. }
  941.  
  942. watchMeleeButton()
  943. {
  944. self endon( "disconnect" );
  945. self endon( "death" );
  946. self endon ( "game_ended" );
  947. self endon( "joined_spectators" );
  948.  
  949. level endon( "intermission" ); // End game
  950.  
  951. for (;;)
  952. {
  953. self.isAttacking = false;
  954. chanceAttack = randomIntRange( 1, 101 );
  955.  
  956. // Check if Melee button pressed & not Growling
  957. if ( ( isDefined( self.isGrowling ) && self.isGrowling == false ) && chanceAttack <= level.scr_inf_attack_sounds && self meleeButtonPressed() ) {
  958. self.isAttacking = true;
  959. self playSound( "attack" );
  960. wait( 1.14 ); // Longest attack sound, so sounds do not overlap
  961.  
  962. while( self meleeButtonPressed() ) wait( 0.05 );
  963. }
  964.  
  965. wait( 0.05 );
  966.  
  967. }
  968.  
  969.  
  970. }
  971.  
  972. ambientSounds()
  973. {
  974. self endon( "disconnect" );
  975. self endon( "death" );
  976. self endon ( "game_ended" );
  977. self endon( "joined_spectators" );
  978.  
  979. for (;;)
  980. {
  981. self.isGrowling = false;
  982. wait( randomIntRange( 15, 31 ) );
  983.  
  984. if( isDefined( self.isAttacking ) && self.isAttacking == false ) {
  985. self.isGrowling = true;
  986. self playSound( "ambient" );
  987. wait( 1.99 ); // Longest growling sound
  988. }
  989. }
  990.  
  991. }
  992.  
  993. onPlayerKilled( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration )
  994. {
  995.  
  996. thread maps\mp\gametypes\_finalkillcam::onPlayerKilled(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration);
  997. if( isDefined( self.isSurvivor ) && self.isSurvivor == true )
  998. {
  999. // Switch player to allies
  1000. self switchPlayerTeam( level.otherTeam[ self.pers["team"] ], false );
  1001.  
  1002. // Give attacker extra points for kill
  1003. attacker givePlayerScore( "kill", level.scr_inf_kill_points_infected );
  1004.  
  1005. howManySurvivors = getSurvivorPlayers();
  1006.  
  1007. if( howManySurvivors == 0 ) {
  1008. wait( 0.08 );
  1009.  
  1010. // Give Infected Player Bonus for Last Kill
  1011. attacker givePlayerScore( "kill", level.scr_inf_kill_points_infected_last_kill );
  1012.  
  1013. // End Game
  1014. thread maps\mp\gametypes\_finalkillcam::endGameFK( "allies", game["strings"]["score_limit_reached"] );
  1015. thread maps\mp\gametypes\_globallogic::endGame( "allies", &"OW_INF_INFECTED_WINS" );
  1016. }
  1017.  
  1018. if( !level.gameEnded )
  1019. {
  1020. notifyData = spawnStruct();
  1021. notifyData.titleText = "Infected";
  1022. notifyData.notifyText = "Knife Survivors to Win";
  1023. notifyData.iconName = "hud_infection";
  1024. notifyData.glowColor = ( 1, 0, 0 ); // Red
  1025. notifyData.sound = "mp_enemy_obj_captured";
  1026. notifyData.duration = 4.0;
  1027.  
  1028. self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
  1029.  
  1030. iprintln( "^2" + self.name + " ^7got Infected" );
  1031.  
  1032. // Debug
  1033. // iprintln( "Infected" );
  1034. }
  1035.  
  1036. // Sound and rewards for Surviving a kill
  1037. if( howManySurvivors > 1 ) {
  1038.  
  1039. players = level.players;
  1040. for(i = 0; i < players.size; i++)
  1041.  
  1042. if( isDefined( players[i] ) && players[i].pers["team"] == "axis" ) {
  1043.  
  1044. notifyData = spawnStruct();
  1045. notifyData.titleText = "Survivor!";
  1046. notifyData.notifyText = "Bonus";
  1047. notifyData.glowColor = ( 0, 1, 0 ); // Green
  1048. notifyData.iconName = "hud_survivor";
  1049. notifyData.sound = "mp_enemy_obj_captured";
  1050. notifyData.duration = 4.0;
  1051.  
  1052. players[i] thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
  1053. players[i] givePlayerScore( "challenge", level.scr_inf_survival_points );
  1054.  
  1055. //Debug
  1056. // iprintln( "Survival Bonus" );
  1057. }
  1058.  
  1059. }
  1060.  
  1061. // Last Survivor
  1062. if( howManySurvivors == 1 )
  1063. {
  1064. players = level.players;
  1065. for(i = 0; i < players.size; i++)
  1066.  
  1067. if( isDefined( players[i] ) && players[i].pers["team"] == "axis" ) {
  1068.  
  1069. notifyData = spawnStruct();
  1070. notifyData.titleText = "Last Survivor!";
  1071. notifyData.notifyText = "Kick Ass, Soldier!";
  1072. notifyData.glowColor = ( 0, 1, 0 ); // Green
  1073. notifyData.iconName = "hud_survivor";
  1074. notifyData.sound = "mp_obj_captured";
  1075. notifyData.duration = 4.0;
  1076.  
  1077. players[i] thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
  1078. players[i] givePlayerScore( "challenge", level.scr_inf_last_survivor_points );
  1079. players[i].isLastSurvivor = true;
  1080.  
  1081. if( level.scr_inf_allow_last_survivor_enemy_ping == 1 ) players[i] setClientDvar( "g_compassshowenemies", "1" );
  1082.  
  1083. if( level.scr_inf_last_survivor_weapon_enable == 1 )
  1084. {
  1085. // Remove all weapons from the last survivor
  1086. players[i] thread maps\mp\gametypes\_gameobjects::_disableWeapon();
  1087. players[i] takeAllWeapons();
  1088.  
  1089. lastSurvivorWeapon = "";
  1090.  
  1091. // Check if the Survivor has no weapon, then force default
  1092. if ( level.scr_inf_last_survivor_weapon != "" ) {
  1093. lastSurvivorWeapon = level.scr_inf_last_survivor_weapon;
  1094. }
  1095.  
  1096. // Give max ammo for Survivor weapon and switch to it
  1097. players[i] giveWeapon( lastSurvivorWeapon );
  1098. players[i] giveMaxAmmo( lastSurvivorWeapon );
  1099. players[i] setSpawnWeapon( lastSurvivorWeapon );
  1100. players[i] switchToWeapon( lastSurvivorWeapon );
  1101.  
  1102. // Enable the Weapons
  1103. players[i] thread maps\mp\gametypes\_gameobjects::_enableWeapon();
  1104.  
  1105. // Give player max health
  1106. players[i].maxhealth = getDvarInt( "scr_player_maxhealth" );
  1107. players[i].health = getDvarInt( "scr_player_maxhealth" );
  1108.  
  1109. }
  1110.  
  1111. // Debug
  1112. // iprintln( "Last Survivor" );
  1113.  
  1114. if( level.scr_inf_count_respawns == 1 ) self.lastSurvivorRespawns++;
  1115.  
  1116. }
  1117.  
  1118.  
  1119. }
  1120.  
  1121. }
  1122.  
  1123. if( isDefined( self.isInfected ) && self.isInfected == true )
  1124. {
  1125. chanceDeath = randomIntRange( 1, 101 );
  1126.  
  1127. // Death Sounds
  1128. if( chanceDeath <= level.scr_inf_death_sounds ) self playSound( "death" );
  1129.  
  1130. chanceBags = randomIntRange( 1, 101 );
  1131.  
  1132. if( chanceBags <= level.scr_inf_allow_ammo_bags )
  1133. {
  1134.  
  1135. if( isHardpointWeapon( sWeapon ) && level.scr_inf_allow_hardpoint_ammobags == 0 )
  1136. return;
  1137.  
  1138. // Place spawnpoint on the ground based on player box size
  1139. basePosition = playerPhysicsTrace( self.origin, self.origin + ( 0, 0, -99999 ) );
  1140.  
  1141. // Create pickup trigger and ammo bag
  1142. ammoBagTrigger = spawn( "trigger_radius", basePosition, 0, 15, 10 );
  1143. ammoBag = spawn( "script_model", basePosition );
  1144. ammoBag setmodel( "ap_luggage03" );
  1145. ammoBag.angles = ( 0, randomint( 360 ), 0 );
  1146. ammobag solid();
  1147.  
  1148. // Wait for Survivor to pickup the ammoBag
  1149. ammoBagTrigger thread onBagPickup( ammoBag, ammoBagTrigger );
  1150.  
  1151. // Remove the trigger and ammoBag on time limit
  1152. ammoBagTrigger thread removeAmmoBagTriggerOnTimeout( ammoBag, ammoBagTrigger );
  1153.  
  1154. }
  1155.  
  1156. if( isDefined( attacker.isLastSurvivor ) && attacker.isLastSurvivor )
  1157. {
  1158. // Give extra points to last Survivor on every kill if desired
  1159. if( level.scr_inf_kill_points_last_survivor > 0 )
  1160. attacker givePlayerScore( "kill", level.scr_inf_kill_points_last_survivor );
  1161. }
  1162.  
  1163. if( isDefined( self.isBurning ) && self.isBurning == true )
  1164. {
  1165. phyExpMagnitude = 2.5;
  1166. minDamage = 1;
  1167. maxDamage = 250;
  1168. blastRadius = 190;
  1169.  
  1170. self radiusDamage( self.origin + ( 0, 0, 30 ), blastRadius, maxDamage, minDamage, self, "MOD_PROJECTILE_SPLASH" );
  1171. physicsExplosionSphere( self.origin + ( 0, 0, 30 ), blastRadius, blastRadius/2, phyExpMagnitude );
  1172. self maps\mp\gametypes\_shellshock::barrel_earthQuake();
  1173.  
  1174. //Death FX
  1175. playfx( level.fx_infected_explode, self.origin );
  1176. self playSound( "explo_metal_rand" );
  1177. }
  1178. }
  1179.  
  1180.  
  1181. if( isDefined( self.isLastSurvivor ) && self.isLastSurvivor == true ) {
  1182. // Do not count kills from pistol, rifle, Infected Burn Explosions, and headshots!
  1183. if( sMeansofDeath != "MOD_PISTOL_BULLET" && sMeansofDeath != "MOD_RIFLE_BULLET" && sMeansofDeath != "MOD_HEAD_SHOT" ) {
  1184. if( self.lastSurvivorRespawns >= level.scr_inf_count_respawns_amount ) {
  1185. game["teamScores"]["axis"] = 0;
  1186. setTeamScore( "axis", 0 );
  1187. thread maps\mp\gametypes\_finalkillcam::endGameFK( "allies", game["strings"]["score_limit_reached"] );
  1188. level thread maps\mp\gametypes\_globallogic::endGame( "allies", &"OW_INF_INFECTED_WINS" );
  1189. }
  1190. }
  1191. }
  1192.  
  1193. }
  1194.  
  1195. onBagPickup( ammoBag, ammoBagTrigger )
  1196. {
  1197.  
  1198. while( true )
  1199. {
  1200. ammoBagTrigger waittill( "trigger", player );
  1201.  
  1202. chancePrimary = randomIntRange( 1, 101 );
  1203.  
  1204. if( isAlive( player ) && player.pers["team"] == "axis" )
  1205. {
  1206. if( chancePrimary <= level.scr_inf_percent_primary_ammo_bag ) {
  1207. if( level.scr_inf_rand_ammo_bag == 0 ) {
  1208. if( player hasWeapon( level.scr_inf_last_survivor_weapon ) ) {
  1209. player giveMaxAmmo( level.scr_inf_last_survivor_weapon );
  1210. }
  1211.  
  1212. if( player hasWeapon( level.scr_inf_sur_force_weapon ) ) {
  1213. player giveMaxAmmo( level.scr_inf_sur_force_weapon );
  1214. }
  1215.  
  1216. if( level.scr_inf_ammo_bag_messages == 1 ) player iprintln( "You have ^1MAX ^2Primary Ammo!" );
  1217.  
  1218. } else {
  1219.  
  1220. if( player hasWeapon( level.scr_inf_last_survivor_weapon ) ) {
  1221. player giveRandomAmmoPrimary( level.scr_inf_last_survivor_weapon );
  1222. }
  1223.  
  1224. if( player hasWeapon( level.scr_inf_sur_force_weapon ) ) {
  1225. player giveRandomAmmoPrimary( level.scr_inf_sur_force_weapon );
  1226. }
  1227.  
  1228. }
  1229.  
  1230. } else {
  1231. if( level.scr_inf_rand_ammo_bag == 0 ) {
  1232. if( level.scr_inf_sur_weapon_secondary != "" ) {
  1233. player giveMaxAmmo( level.scr_inf_sur_weapon_secondary );
  1234. if( level.scr_inf_ammo_bag_messages == 1 ) player iprintln( "You have ^1MAX ^3Secondary Ammo!" );
  1235.  
  1236. } else {
  1237. player playLocalSound( "ammo_pickup" );
  1238. if( level.scr_inf_ammo_bag_messages == 1 ) player iprintln( "^1No Ammo^7...Empty Bag!" );
  1239. wait( 0.08 );
  1240.  
  1241. // Delete Trigger and Model
  1242. if( isDefined( ammoBagTrigger ) ) ammoBagTrigger delete();
  1243. if( isDefined( ammoBag ) ) ammoBag delete();
  1244.  
  1245. }
  1246.  
  1247. } else {
  1248.  
  1249. if( level.scr_inf_sur_weapon_secondary != "" ) {
  1250. player giveRandomAmmoSecondary( level.scr_inf_sur_weapon_secondary );
  1251.  
  1252. } else {
  1253. player playLocalSound( "ammo_pickup" );
  1254. if( level.scr_inf_ammo_bag_messages == 1 ) player iprintln( "^1No Ammo^7...Empty Bag!" );
  1255. wait( 0.08 );
  1256.  
  1257. // Delete Trigger and Model
  1258. if( isDefined( ammoBagTrigger ) ) ammoBagTrigger delete();
  1259. if( isDefined( ammoBag ) ) ammoBag delete();
  1260. }
  1261.  
  1262. }
  1263.  
  1264. }
  1265.  
  1266. if( level.scr_inf_scavenger_icon == 1 ) {
  1267. player.inf_scavengerIcon.alpha = 1;
  1268. player.inf_scavengerIcon fadeOverTime( 1.3 );
  1269. player.inf_scavengerIcon.alpha = 0;
  1270. }
  1271.  
  1272.  
  1273. player playLocalSound( "ammo_pickup" );
  1274. wait( 0.08 );
  1275.  
  1276. // Delete Trigger and Model
  1277. if( isDefined( ammoBagTrigger ) ) ammoBagTrigger delete();
  1278. if( isDefined( ammoBag ) ) ammoBag delete();
  1279.  
  1280. }
  1281.  
  1282. wait( 0.08 );
  1283.  
  1284. }
  1285.  
  1286. }
  1287.  
  1288. removeAmmoBagTriggerOnTimeout( ammoBag, ammoBagTrigger )
  1289. {
  1290.  
  1291. wait( level.scr_inf_ammo_bag_removal_time );
  1292.  
  1293. // Delete Trigger and Model
  1294. if( isDefined( ammoBagTrigger ) ) ammoBagTrigger delete();
  1295. if( isDefined( ammoBag ) ) ammoBag delete();
  1296.  
  1297. }
  1298.  
  1299. getInfectedPlayers()
  1300. {
  1301. Infected = 0;
  1302.  
  1303. players = level.players;
  1304. for(i = 0; i < players.size; i++)
  1305. if( isDefined( players[i] ) && players[i].pers["team"] == "allies" )
  1306. {
  1307. Infected++;
  1308. }
  1309.  
  1310. return Infected;
  1311. }
  1312.  
  1313. isHardpointWeapon( sWeapon )
  1314. {
  1315. if ( sWeapon == "artillery_mp" || sWeapon == "cobra_20mm_mp" || sWeapon == "cobra_FFAR_mp" || sWeapon == "hind_FFAR_mp" ) // Add your hardpoints weapons, that kill, here!
  1316. return true;
  1317.  
  1318. return false;
  1319. }
  1320.  
  1321. getSurvivorPlayers()
  1322. {
  1323. Survivors = 0;
  1324.  
  1325. players = level.players;
  1326. for(i = 0; i < players.size; i++)
  1327. if( isDefined( players[i] ) && players[i].pers["team"] == "axis" )
  1328. {
  1329. Survivors++;
  1330. }
  1331.  
  1332. return Survivors;
  1333. }
  1334.  
  1335. detachHead()
  1336. {
  1337. // Get all the attached models from the player
  1338. attachedModels = self getAttachSize();
  1339.  
  1340. // Check which one is the head and detach it
  1341. for ( am=0; am < attachedModels; am++ ) {
  1342. thisModel = self getAttachModelName( am );
  1343.  
  1344. // Check if this one is the head and remove it
  1345. if ( isSubstr( thisModel, "head_mp_" ) ) {
  1346. self detach( thisModel, "" );
  1347. break;
  1348. }
  1349. }
  1350.  
  1351. return;
  1352. }
  1353.  
  1354. givePlayerScore( event, score )
  1355. {
  1356. self maps\mp\gametypes\_rank::giveRankXP( event, score );
  1357.  
  1358. self.pers["score"] += score;
  1359. self maps\mp\gametypes\_persistence::statAdd( "score", ( self.pers["score"] - score ) );
  1360. self.score = self.pers["score"];
  1361. self notify ( "update_playerscore_hud" );
  1362. }
  1363.  
  1364. giveRandomAmmoPrimary( weapon )
  1365. {
  1366. currWeap = weapon;
  1367. currAmmoClip = self getWeaponAmmoClip( currWeap );
  1368. currAmmoStock = self getWeaponAmmoStock( currWeap );
  1369. randAmmo = randomInt( level.scr_inf_rand_ammo_bag );
  1370. maxAmmo = weaponMaxAmmo( currWeap );
  1371.  
  1372. self setWeaponAmmoClip( currWeap, currAmmoClip );
  1373. self setWeaponAmmoStock( currWeap, currAmmoStock + randAmmo ); // Only adds ammo to stockpile, not clip
  1374.  
  1375. curr2AmmoStock = self getWeaponAmmoStock( currWeap );
  1376.  
  1377. if( level.scr_inf_ammo_bag_messages == 1 )
  1378. {
  1379. if( curr2AmmoStock == maxAmmo ) {
  1380. self iprintln( "You have ^1MAX ^2Primary Ammo!" );
  1381. return;
  1382. }
  1383.  
  1384. if( randAmmo == 0 )
  1385. self iprintln( "^1No Ammo^7...Empty Bag!" );
  1386. else
  1387. self iprintln( "You picked up ^1" + randAmmo + " ^2Primary Ammo!" );
  1388. }
  1389.  
  1390. }
  1391.  
  1392. giveRandomAmmoSecondary( weapon )
  1393. {
  1394. currWeap = weapon;
  1395. currAmmoClip = self getWeaponAmmoClip( currWeap );
  1396. clipSize = weaponClipSize( currWeap );
  1397. currAmmoStock = self getWeaponAmmoStock( currWeap );
  1398. randAmmo = randomInt( 3 ); // Rpg's need 3 for max ammo
  1399. maxAmmo = weaponMaxAmmo( currWeap );
  1400.  
  1401. explosiveCount = countActiveExplosives( currWeap, self.pers["team"] );
  1402. claymoreLimit = level.scr_inf_limit_planted_claymores;
  1403. c4Limit = level.scr_inf_limit_planted_c4s;
  1404.  
  1405. // Claymores
  1406. if( currWeap == "claymore_mp" ) {
  1407. if( explosiveCount >= claymoreLimit ) randAmmo = 0; // Don't give anymore if already at limit
  1408.  
  1409. if( currAmmoClip == 0 && randAmmo > 0 ) self giveWeapon( "claymore_mp" );
  1410.  
  1411. self setWeaponAmmoStock( currWeap, randAmmo + currAmmoClip );
  1412. }
  1413.  
  1414. // C4
  1415. if( currWeap == "c4_mp" ) {
  1416. if( explosiveCount >= c4Limit ) randAmmo = 0; // Don't give anymore if already at limit
  1417.  
  1418. self setWeaponAmmoStock( currWeap, randAmmo + currAmmoClip );
  1419. }
  1420.  
  1421. // RPG
  1422. if( currWeap == "rpg_mp" ) {
  1423.  
  1424. self setWeaponAmmoClip( currWeap, currAmmoClip + randAmmo );
  1425. self setWeaponAmmoStock( currWeap, currAmmoStock + ( randAmmo - ( clipSize - currAmmoClip ) ) ); // Old formula works! :)
  1426.  
  1427. }
  1428.  
  1429. curr2AmmoStock = self getWeaponAmmoStock( currWeap );
  1430.  
  1431. if( level.scr_inf_ammo_bag_messages == 1 )
  1432. {
  1433. if( curr2AmmoStock == maxAmmo ) {
  1434. self iprintln( "You have ^1MAX ^3Secondary Ammo!" );
  1435. return;
  1436. }
  1437.  
  1438. if( randAmmo == 0 )
  1439. self iprintln( "^1No Ammo^7...Empty Bag!" );
  1440. else
  1441. self iprintln( "You picked up ^1" + randAmmo + " ^3Secondary Ammo!" );
  1442.  
  1443. }
  1444.  
  1445. }
  1446.  
  1447. infectionNightMode()
  1448. {
  1449.  
  1450. // Wait for match to start
  1451. while ( level.inPrematchPeriod )
  1452. wait( 0.05 );
  1453.  
  1454. setExpFog( level.scr_inf_night_mode_startDist, level.scr_inf_night_mode_halfwayDist, 0, 0, 0, 0 );
  1455. visionSetNaked( "infection_night_mode", 0 );
  1456.  
  1457. }
  1458.  
  1459. countActiveExplosives( currWeap, explosiveTeam )
  1460. {
  1461. // Count placed explosives
  1462. explosiveEntities = getEntArray( currWeap + "_" + explosiveTeam, "targetname");
  1463.  
  1464. return explosiveEntities.size;
  1465. }
  1466.  
  1467. serverCheck()
  1468. {
  1469. level endon("game_ended");
  1470.  
  1471. while ( level.inPrematchPeriod )
  1472. wait ( 0.05 );
  1473.  
  1474. rotatemap = level.scr_rotate_map_time;
  1475.  
  1476. if ( !isDefined( game["readytoplay"] ) )
  1477. game["readytoplay"] = 0;
  1478.  
  1479. if( !isDefined( level.notenough ) ) {
  1480. level.notenough = newHudElem();
  1481. level.notenough.x = 320;
  1482. level.notenough.y = 175;
  1483. level.notenough.alignx = "center";
  1484. level.notenough.aligny = "middle";
  1485. level.notenough.fontScale = 3.4;
  1486. level.notenough.alpha = 0;
  1487. }
  1488.  
  1489. if( !isDefined( level.rotatetime ) ) {
  1490. level.rotatetime = newHudElem();
  1491. level.rotatetime.x = 320;
  1492. level.rotatetime.y = 210;
  1493. level.rotatetime.alignx = "center";
  1494. level.rotatetime.aligny = "middle";
  1495. level.rotatetime.fontScale = 2.4;
  1496. level.rotatetime.alpha = 0;
  1497. }
  1498.  
  1499. for (;;)
  1500. {
  1501. wait( 1.0 );
  1502.  
  1503. // Check if we have enough players
  1504. if ( !enoughPlayers() ) {
  1505. game["readytoplay"]++;
  1506.  
  1507. if( level.scr_inf_nep_message != "" ) {
  1508. level.notenough setText( level.scr_inf_nep_message );
  1509. level.notenough.alpha = 1;
  1510. level.infReady = false;
  1511.  
  1512. }else {
  1513.  
  1514. level.notenough.label = &"OW_INF_NOT_ENOUGH_PLAYERS";
  1515. level.notenough.alpha = 1;
  1516. level.infReady = false;
  1517. }
  1518.  
  1519. players = getentarray( "player", "classname" );
  1520.  
  1521. if ( players.size == 0 ) {
  1522. rotatemap = level.scr_rotate_map_time;
  1523. level.rotatetime.alpha = 0;
  1524. }
  1525.  
  1526. if ( players.size < level.scr_inf_min_players && rotatemap == 1 ) {
  1527. exitLevel( false );
  1528. break;
  1529. }
  1530.  
  1531. if( level.scr_rotate_map_time > 0 ) {
  1532.  
  1533. rotatemap--;
  1534.  
  1535. if( rotatemap > 10 ) {
  1536.  
  1537. level.rotatetime.alpha = 0;
  1538. level.rotatetime setText( "Map rotates in ^3" + rotatemap + " ^7seconds." );
  1539. level.rotatetime.alpha = 1;
  1540. }
  1541.  
  1542. if( rotatemap <= 10 ) {
  1543. level.rotatetime.alpha = 0;
  1544. level.rotatetime setText( "Map rotates in ^1" + rotatemap + " ^7seconds." );
  1545. level.rotatetime.alpha = 1;
  1546.  
  1547. for ( s = 0; s < level.players.size; s++ ) {
  1548. player = level.players[s];
  1549. if ( isDefined( player ) ) {
  1550. player playLocalSound( "ui_mp_suitcasebomb_timer" );
  1551. }
  1552.  
  1553. }
  1554. }
  1555.  
  1556. }
  1557.  
  1558. }else {
  1559.  
  1560. game["readytoplay"] = 0;
  1561.  
  1562. level.notenough.alpha = 0;
  1563. level.rotatetime.alpha = 0;
  1564. level thread timer();
  1565. level.infReady = true;
  1566. break;
  1567.  
  1568. }
  1569. }
  1570.  
  1571. }
  1572.  
  1573. enoughPlayers()
  1574. {
  1575.  
  1576. players[ "allies" ] = 0;
  1577. players[ "axis" ] = 0;
  1578. players[ "spectator" ] = 0;
  1579. enoughPlayers = false;
  1580.  
  1581. for ( index = 0; index < level.players.size; index++ )
  1582. {
  1583. player = level.players[index];
  1584.  
  1585. // Get the players teams
  1586. playerTeam = player.pers[ "team" ];
  1587. players[ playerTeam ]++;
  1588.  
  1589.  
  1590. // Must have the minimum players required to pick Infected
  1591. if ( ( players[ "allies" ] + players[ "axis" ] ) >= level.scr_inf_min_players ) {
  1592. enoughPlayers = true;
  1593. break;
  1594. }
  1595.  
  1596. }
  1597.  
  1598. return ( enoughPlayers );
  1599. }
Add Comment
Please, Sign In to add comment