Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.95 KB | None | 0 0
  1. #include common_scripts\utility;
  2. #include maps\mp\_utility;
  3. #include maps\mp\gametypes\_hud_util;
  4.  
  5.  
  6. init()
  7. {
  8.  
  9. // CONFIGURATION
  10. level.MikeTime = 20;
  11. setDvar( "scr_game_prematchperiod", "1" );
  12. setDvar( "ui_allow_teamchange", "1" );
  13.  
  14. precacheItem("bowie_knife_zm");
  15.  
  16.  
  17. setDvar( "sv_hostname", "^3MikeMyers ^1BETA1.2" );
  18. setDvar( "g_TeamName_Axis", "^1Mike Myers" );
  19. setDvar( "g_TeamName_Allies", "^4Victim's" );
  20. level.scoreInfo = [];
  21. level.xpScale = GetDvarInt( #"scr_xpscale" );
  22. level.codPointsXpScale = GetDvarFloat( #"scr_codpointsxpscale" );
  23. level.codPointsMatchScale = GetDvarFloat( #"scr_codpointsmatchscale" );
  24. level.codPointsChallengeScale = GetDvarFloat( #"scr_codpointsperchallenge" );
  25. level.rankXpCap = GetDvarInt( #"scr_rankXpCap" );
  26. level.codPointsCap = GetDvarInt( #"scr_codPointsCap" );
  27.  
  28. level.rankTable = [];
  29.  
  30.  
  31. precacheShader("white");
  32.  
  33. precacheString( &"RANK_PLAYER_WAS_PROMOTED_N" );
  34. precacheString( &"RANK_PLAYER_WAS_PROMOTED" );
  35. precacheString( &"RANK_PROMOTED" );
  36. precacheString( &"MP_PLUS" );
  37. precacheString( &"RANK_ROMANI" );
  38. precacheString( &"RANK_ROMANII" );
  39.  
  40. if ( level.teamBased )
  41. {
  42. registerScoreInfo( "kill", 100 );
  43. registerScoreInfo( "headshot", 100 );
  44. registerScoreInfo( "assist_75", 80 );
  45. registerScoreInfo( "assist_50", 60 );
  46. registerScoreInfo( "assist_25", 40 );
  47. registerScoreInfo( "assist", 20 );
  48. registerScoreInfo( "suicide", 0 );
  49. registerScoreInfo( "teamkill", 0 );
  50. registerScoreInfo( "dogkill", 30 );
  51. registerScoreInfo( "dogassist", 10 );
  52. registerScoreInfo( "helicopterkill", 200 );
  53. registerScoreInfo( "helicopterassist", 50 );
  54. registerScoreInfo( "helicopterassist_75", 150 );
  55. registerScoreInfo( "helicopterassist_50", 100 );
  56. registerScoreInfo( "helicopterassist_25", 50 );
  57. registerScoreInfo( "spyplanekill", 100 );
  58. registerScoreInfo( "spyplaneassist", 50 );
  59. registerScoreInfo( "rcbombdestroy", 50 );
  60. }
  61. else
  62. {
  63. registerScoreInfo( "kill", 50 );
  64. registerScoreInfo( "headshot", 50 );
  65. registerScoreInfo( "assist_75", 0 );
  66. registerScoreInfo( "assist_50", 0 );
  67. registerScoreInfo( "assist_25", 0 );
  68. registerScoreInfo( "assist", 0 );
  69. registerScoreInfo( "suicide", 0 );
  70. registerScoreInfo( "teamkill", 0 );
  71. registerScoreInfo( "dogkill", 20 );
  72. registerScoreInfo( "dogassist", 0 );
  73. registerScoreInfo( "helicopterkill", 100 );
  74. registerScoreInfo( "helicopterassist", 0 );
  75. registerScoreInfo( "helicopterassist_75", 0 );
  76. registerScoreInfo( "helicopterassist_50", 0 );
  77. registerScoreInfo( "helicopterassist_25", 0 );
  78. registerScoreInfo( "spyplanekill", 25 );
  79. registerScoreInfo( "spyplaneassist", 0 );
  80. registerScoreInfo( "rcbombdestroy", 30 );
  81. }
  82.  
  83. registerScoreInfo( "win", 1 );
  84. registerScoreInfo( "loss", 0.5 );
  85. registerScoreInfo( "tie", 0.75 );
  86. registerScoreInfo( "capture", 300 );
  87. registerScoreInfo( "defend", 300 );
  88.  
  89. registerScoreInfo( "challenge", 2500 );
  90.  
  91. level.maxRank = int(tableLookup( "mp/rankTable.csv", 0, "maxrank", 1 ));
  92. level.maxPrestige = int(tableLookup( "mp/rankIconTable.csv", 0, "maxprestige", 1 ));
  93.  
  94. pId = 0;
  95. rId = 0;
  96. for ( pId = 0; pId <= level.maxPrestige; pId++ )
  97. {
  98. // the rank icons are different
  99. for ( rId = 0; rId <= level.maxRank; rId++ )
  100. precacheShader( tableLookup( "mp/rankIconTable.csv", 0, rId, pId+1 ) );
  101. }
  102.  
  103. rankId = 0;
  104. rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  105. assert( isDefined( rankName ) && rankName != "" );
  106.  
  107. while ( isDefined( rankName ) && rankName != "" )
  108. {
  109. level.rankTable[rankId][1] = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  110. level.rankTable[rankId][2] = tableLookup( "mp/ranktable.csv", 0, rankId, 2 );
  111. level.rankTable[rankId][3] = tableLookup( "mp/ranktable.csv", 0, rankId, 3 );
  112. level.rankTable[rankId][7] = tableLookup( "mp/ranktable.csv", 0, rankId, 7 );
  113. level.rankTable[rankId][14] = tableLookup( "mp/ranktable.csv", 0, rankId, 14 );
  114.  
  115. precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );
  116.  
  117. rankId++;
  118. rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  119. }
  120.  
  121. level.numStatsMilestoneTiers = 4;
  122. level.maxStatChallenges = 1024;
  123.  
  124. buildStatsMilestoneInfo();
  125.  
  126. level thread onPlayerConnect();
  127. level thread STARTinit();
  128.  
  129. }
  130.  
  131.  
  132. getRankXPCapped( inRankXp )
  133. {
  134. if ( ( isDefined( level.rankXpCap ) ) && level.rankXpCap && ( level.rankXpCap <= inRankXp ) )
  135. {
  136. return level.rankXpCap;
  137. }
  138.  
  139. return inRankXp;
  140. }
  141.  
  142. getCodPointsCapped( inCodPoints )
  143. {
  144. if ( ( isDefined( level.codPointsCap ) ) && level.codPointsCap && ( level.codPointsCap <= inCodPoints ) )
  145. {
  146. return level.codPointsCap;
  147. }
  148.  
  149. return inCodPoints;
  150. }
  151.  
  152. isRegisteredEvent( type )
  153. {
  154. if ( isDefined( level.scoreInfo[type] ) )
  155. return true;
  156. else
  157. return false;
  158. }
  159.  
  160. registerScoreInfo( type, value )
  161. {
  162. level.scoreInfo[type]["value"] = value;
  163. }
  164.  
  165. getScoreInfoValue( type )
  166. {
  167. overrideDvar = "scr_" + level.gameType + "_score_" + type;
  168. if ( getDvar( overrideDvar ) != "" )
  169. return getDvarInt( overrideDvar );
  170. else
  171. return ( level.scoreInfo[type]["value"] );
  172. }
  173.  
  174. getScoreInfoLabel( type )
  175. {
  176. return ( level.scoreInfo[type]["label"] );
  177. }
  178.  
  179. getRankInfoMinXP( rankId )
  180. {
  181. return int(level.rankTable[rankId][2]);
  182. }
  183.  
  184. getRankInfoXPAmt( rankId )
  185. {
  186. return int(level.rankTable[rankId][3]);
  187. }
  188.  
  189. getRankInfoMaxXp( rankId )
  190. {
  191. return int(level.rankTable[rankId][7]);
  192. }
  193.  
  194. getRankInfoFull( rankId )
  195. {
  196. return tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 );
  197. }
  198.  
  199. getRankInfoIcon( rankId, prestigeId )
  200. {
  201. return tableLookup( "mp/rankIconTable.csv", 0, rankId, prestigeId+1 );
  202. }
  203.  
  204. getRankInfoLevel( rankId )
  205. {
  206. return int( tableLookup( "mp/ranktable.csv", 0, rankId, 13 ) );
  207. }
  208.  
  209. getRankInfoCodPointsEarned( rankId )
  210. {
  211. return int( tableLookup( "mp/ranktable.csv", 0, rankId, 17 ) );
  212. }
  213.  
  214. shouldKickByRank()
  215. {
  216. if ( self IsHost() )
  217. {
  218. // don't try to kick the host
  219. return false;
  220. }
  221.  
  222. if (level.rankCap > 0 && self.pers["rank"] > level.rankCap)
  223. {
  224. return true;
  225. }
  226.  
  227. if ( ( level.rankCap > 0 ) && ( level.minPrestige == 0 ) && ( self.pers["plevel"] > 0 ) )
  228. {
  229. return true;
  230. }
  231.  
  232. if ( level.minPrestige > self.pers["plevel"] )
  233. {
  234. return true;
  235. }
  236.  
  237. return false;
  238. }
  239.  
  240. getCodPointsStat()
  241. {
  242. codPoints = self maps\mp\gametypes\_persistence::statGet( "CODPOINTS" );
  243. codPointsCapped = getCodPointsCapped( codPoints );
  244.  
  245. if ( codPoints > codPointsCapped )
  246. {
  247. self setCodPointsStat( codPointsCapped );
  248. }
  249.  
  250. return codPointsCapped;
  251. }
  252.  
  253. setCodPointsStat( codPoints )
  254. {
  255. self maps\mp\gametypes\_persistence::setPlayerStat( "PlayerStatsList", "CODPOINTS", getCodPointsCapped( codPoints ) );
  256. }
  257.  
  258. getRankXpStat()
  259. {
  260. rankXp = self maps\mp\gametypes\_persistence::statGet( "RANKXP" );
  261. rankXpCapped = getRankXPCapped( rankXp );
  262.  
  263. if ( rankXp > rankXpCapped )
  264. {
  265. self maps\mp\gametypes\_persistence::statSet( "RANKXP", rankXpCapped, false );
  266. }
  267.  
  268. return rankXpCapped;
  269. }
  270.  
  271. onPlayerConnect()
  272. {
  273. self endon("disconnect");
  274. self thread TeamGlitch();
  275. for(;;)
  276. {
  277. level waittill( "connected", player );
  278.  
  279. player.pers["rankxp"] = player getRankXpStat();
  280. player.pers["codpoints"] = player getCodPointsStat();
  281. player.pers["currencyspent"] = player maps\mp\gametypes\_persistence::statGet( "currencyspent" );
  282. rankId = player getRankForXp( player getRankXP() );
  283. player.pers["rank"] = rankId;
  284. player.pers["plevel"] = player maps\mp\gametypes\_persistence::statGet( "PLEVEL" );
  285.  
  286. if ( player shouldKickByRank() )
  287. {
  288. kick( player getEntityNumber() );
  289. continue;
  290. }
  291.  
  292. // dont reset participation in War when going into final fight, this is used for calculating match bonus
  293. if ( !isDefined( player.pers["participation"] ) || !( (level.gameType == "twar") && (0 < game["roundsplayed"]) && (0 < player.pers["participation"]) ) )
  294. player.pers["participation"] = 0;
  295.  
  296. player.rankUpdateTotal = 0;
  297.  
  298. // attempt to move logic out of menus as much as possible
  299. player.cur_rankNum = rankId;
  300. assertex( isdefined(player.cur_rankNum), "rank: "+ rankId + " does not have an index, check mp/ranktable.csv" );
  301.  
  302. prestige = player getPrestigeLevel();
  303. player setRank( rankId, prestige );
  304. player.pers["prestige"] = prestige;
  305.  
  306.  
  307. if ( !isDefined( player.pers["summary"] ) )
  308. {
  309. player.pers["summary"] = [];
  310. player.pers["summary"]["xp"] = 0;
  311. player.pers["summary"]["score"] = 0;
  312. player.pers["summary"]["challenge"] = 0;
  313. player.pers["summary"]["match"] = 0;
  314. player.pers["summary"]["misc"] = 0;
  315. player.pers["summary"]["codpoints"] = 0;
  316. }
  317. // set default popup in lobby after a game finishes to game "summary"
  318. // if player got promoted during the game, we set it to "promotion"
  319. player setclientdvar( "ui_lobbypopup", "" );
  320.  
  321. if ( level.rankedMatch )
  322. {
  323. player maps\mp\gametypes\_persistence::statSet( "rank", rankId, false );
  324. player maps\mp\gametypes\_persistence::statSet( "minxp", getRankInfoMinXp( rankId ), false );
  325. player maps\mp\gametypes\_persistence::statSet( "maxxp", getRankInfoMaxXp( rankId ), false );
  326. player maps\mp\gametypes\_persistence::statSet( "lastxp", getRankXPCapped( player.pers["rankxp"] ), false );
  327. }
  328.  
  329. player.explosiveKills[0] = 0;
  330. player.xpGains = [];
  331.  
  332. player thread onPlayerSpawned();
  333. player thread onJoinedTeam();
  334. player thread onJoinedSpectators();
  335. }
  336. }
  337.  
  338.  
  339. onJoinedTeam()
  340. {
  341. self endon("disconnect");
  342.  
  343. for(;;)
  344. {
  345. self waittill("joined_team");
  346. self thread maps\mp\gametypes\_hud_message::hintMessage("Welcome "+self.name+" ^2:) ");
  347. self thread removeRankHUD();
  348. }
  349. }
  350.  
  351.  
  352.  
  353. onJoinedSpectators()
  354. {
  355. self endon("disconnect");
  356.  
  357. for(;;)
  358. {
  359. self waittill("joined_spectators");
  360. self thread removeRankHUD();
  361. }
  362. }
  363.  
  364.  
  365. onPlayerSpawned()
  366. {
  367. self endon("disconnect");
  368. level.playerkilled = 0;
  369. for(;;)
  370. {
  371. self waittill("spawned_player");
  372. setDvar("lowAmmoWarningNoAmmoColor2", 0, 0, 0, 0);
  373. setDvar("lowAmmoWarningNoAmmoColor1", 0, 0, 0, 0);
  374. level thread CheckEnd();
  375.  
  376. if(self.team == "axis")
  377. {
  378. Domyers();
  379. wait 0.5;
  380. }
  381. else if(self.team == "allies")
  382. {
  383.  
  384. Dovictims();
  385. self thread domikesmates();
  386. wait 0.5;
  387. }
  388.  
  389.  
  390.  
  391. if(!isdefined(self.hud_rankscroreupdate))
  392. {
  393. self.hud_rankscroreupdate = NewScoreHudElem(self);
  394. self.hud_rankscroreupdate.horzAlign = "center";
  395. self.hud_rankscroreupdate.vertAlign = "middle";
  396. self.hud_rankscroreupdate.alignX = "center";
  397. self.hud_rankscroreupdate.alignY = "middle";
  398. self.hud_rankscroreupdate.x = 0;
  399. if( self IsSplitscreen() )
  400. self.hud_rankscroreupdate.y = -15;
  401. else
  402. self.hud_rankscroreupdate.y = -60;
  403. self.hud_rankscroreupdate.font = "default";
  404. self.hud_rankscroreupdate.fontscale = 2.0;
  405. self.hud_rankscroreupdate.archived = false;
  406. self.hud_rankscroreupdate.color = (0.5,0.5,0.5);
  407. self.hud_rankscroreupdate.alpha = 0;
  408. self.hud_rankscroreupdate.sort = 50;
  409. self.hud_rankscroreupdate maps\mp\gametypes\_hud::fontPulseInit();
  410. self.hud_rankscroreupdate.overrridewhenindemo = true;
  411. }
  412. }
  413. }
  414.  
  415. incCodPoints( amount )
  416. {
  417. if( !isRankEnabled() )
  418. return;
  419.  
  420. if( level.wagerMatch )
  421. return;
  422.  
  423. if ( self HasPerk( "specialty_extramoney" ) )
  424. {
  425. multiplier = GetDvarFloat( #"perk_extraMoneyMultiplier" );
  426. amount *= multiplier;
  427. amount = int( amount );
  428. }
  429.  
  430. newCodPoints = getCodPointsCapped( self.pers["codpoints"] + amount );
  431. if ( newCodPoints > self.pers["codpoints"] )
  432. {
  433. self.pers["summary"]["codpoints"] += ( newCodPoints - self.pers["codpoints"] );
  434. }
  435. self.pers["codpoints"] = newCodPoints;
  436.  
  437. setCodPointsStat( int( newCodPoints ) );
  438. }
  439.  
  440. giveRankXP( type, value, devAdd )
  441. {
  442. self endon("disconnect");
  443.  
  444. if ( level.teamBased && (!level.playerCount["allies"] || !level.playerCount["axis"]) && !isDefined( devAdd ) )
  445. return;
  446. else if ( !level.teamBased && (level.playerCount["allies"] + level.playerCount["axis"] < 2) && !isDefined( devAdd ) )
  447. return;
  448.  
  449. if( !isRankEnabled() )
  450. return;
  451.  
  452. if( level.wagerMatch || !level.onlineGame || ( GetDvarInt( #"xblive_privatematch" ) && !GetDvarInt( #"xblive_basictraining" ) ) )
  453. return;
  454.  
  455. pixbeginevent("giveRankXP");
  456.  
  457. if ( !isDefined( value ) )
  458. value = getScoreInfoValue( type );
  459.  
  460. switch( type )
  461. {
  462. case "assist":
  463. case "assist_25":
  464. case "assist_50":
  465. case "assist_75":
  466. case "helicopterassist":
  467. case "helicopterassist_25":
  468. case "helicopterassist_50":
  469. case "helicopterassist_75":
  470. xpGain_type = "assist";
  471. break;
  472. default:
  473. xpGain_type = type;
  474. break;
  475. }
  476.  
  477. if ( !isDefined( self.xpGains[xpGain_type] ) )
  478. self.xpGains[xpGain_type] = 0;
  479.  
  480. // Blackbox
  481. if( level.rankedMatch )
  482. {
  483. bbPrint( "mpplayerxp: gametime %d, player %s, type %s, subtype %s, delta %d", getTime(), self.name, xpGain_type, type, value );
  484. }
  485.  
  486. // this switch statement should be inverted. I am pretty sure there are fewer
  487. // things that we dont want to scale then there are that we do.
  488. switch( type )
  489. {
  490. case "kill":
  491. case "headshot":
  492. case "assist":
  493. case "assist_25":
  494. case "assist_50":
  495. case "assist_75":
  496. case "helicopterassist":
  497. case "helicopterassist_25":
  498. case "helicopterassist_50":
  499. case "helicopterassist_75":
  500. case "helicopterkill":
  501. case "rcbombdestroy":
  502. case "spyplanekill":
  503. case "spyplaneassist":
  504. case "dogkill":
  505. case "dogassist":
  506. case "capture":
  507. case "defend":
  508. case "return":
  509. case "pickup":
  510. case "plant":
  511. case "defuse":
  512. case "destroyer":
  513. case "assault":
  514. case "assault_assist":
  515. case "revive":
  516. case "medal":
  517. value = int( value * level.xpScale );
  518. break;
  519. default:
  520. if ( level.xpScale == 0 )
  521. value = 0;
  522. break;
  523. }
  524.  
  525. self.xpGains[xpGain_type] += value;
  526.  
  527. xpIncrease = self incRankXP( value );
  528.  
  529. if ( level.rankedMatch && updateRank() )
  530. self thread updateRankAnnounceHUD();
  531.  
  532. // Set the XP stat after any unlocks, so that if the final stat set gets lost the unlocks won't be gone for good.
  533. if ( value != 0 )
  534. {
  535. self syncXPStat();
  536. }
  537.  
  538. if ( isDefined( self.enableText ) && self.enableText && !level.hardcoreMode )
  539. {
  540. if ( type == "teamkill" )
  541. self thread updateRankScoreHUD( 0 - getScoreInfoValue( "kill" ) );
  542. else
  543. self thread updateRankScoreHUD( value );
  544. }
  545.  
  546. switch( type )
  547. {
  548. case "kill":
  549. case "headshot":
  550. case "suicide":
  551. case "teamkill":
  552. case "assist":
  553. case "assist_25":
  554. case "assist_50":
  555. case "assist_75":
  556. case "helicopterassist":
  557. case "helicopterassist_25":
  558. case "helicopterassist_50":
  559. case "helicopterassist_75":
  560. case "capture":
  561. case "defend":
  562. case "return":
  563. case "pickup":
  564. case "assault":
  565. case "revive":
  566. case "medal":
  567. self.pers["summary"]["score"] += value;
  568. incCodPoints( round_this_number( value * level.codPointsXPScale ) );
  569. break;
  570.  
  571. case "win":
  572. case "loss":
  573. case "tie":
  574. self.pers["summary"]["match"] += value;
  575. incCodPoints( round_this_number( value * level.codPointsMatchScale ) );
  576. break;
  577.  
  578. case "challenge":
  579. self.pers["summary"]["challenge"] += value;
  580. incCodPoints( round_this_number( value * level.codPointsChallengeScale ) );
  581. break;
  582.  
  583. default:
  584. self.pers["summary"]["misc"] += value; //keeps track of ungrouped match xp reward
  585. self.pers["summary"]["match"] += value;
  586. incCodPoints( round_this_number( value * level.codPointsMatchScale ) );
  587. break;
  588. }
  589.  
  590. self.pers["summary"]["xp"] += xpIncrease;
  591.  
  592. pixendevent();
  593. }
  594.  
  595. round_this_number( value )
  596. {
  597. value = int( value + 0.5 );
  598. return value;
  599. }
  600.  
  601. updateRank()
  602. {
  603. newRankId = self getRank();
  604. if ( newRankId == self.pers["rank"] )
  605. return false;
  606.  
  607. oldRank = self.pers["rank"];
  608. rankId = self.pers["rank"];
  609. self.pers["rank"] = newRankId;
  610.  
  611. // This function is a bit 'funny' - it decides to handle all of the unlocks for the current rank
  612. // before handling all of the unlocks for any new ranks - it's probably as a safety to handle the
  613. // case where unlocks have not happened for the current rank (which should only be the case for rank 0)
  614. // This will hopefully go away once the new ranking system is in place fully
  615. while ( rankId <= newRankId )
  616. {
  617. self maps\mp\gametypes\_persistence::statSet( "rank", rankId, false );
  618. self maps\mp\gametypes\_persistence::statSet( "minxp", int(level.rankTable[rankId][2]), false );
  619. self maps\mp\gametypes\_persistence::statSet( "maxxp", int(level.rankTable[rankId][7]), false );
  620.  
  621. // tell lobby to popup promotion window instead
  622. self.setPromotion = true;
  623. if ( level.rankedMatch && level.gameEnded && !self IsSplitscreen() )
  624. self setClientDvar( "ui_lobbypopup", "promotion" );
  625.  
  626. // Don't add CoD Points for the old rank - only add when actually ranking up
  627. if ( rankId != oldRank )
  628. {
  629. codPointsEarnedForRank = getRankInfoCodPointsEarned( rankId );
  630.  
  631. incCodPoints( codPointsEarnedForRank );
  632.  
  633.  
  634. if ( !IsDefined( self.pers["rankcp"] ) )
  635. {
  636. self.pers["rankcp"] = 0;
  637. }
  638.  
  639. self.pers["rankcp"] += codPointsEarnedForRank;
  640. }
  641.  
  642. rankId++;
  643. }
  644. self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "time_played_total" ) );
  645.  
  646. self setRank( newRankId );
  647.  
  648. if ( GetDvarInt( #"xblive_basictraining" ) && newRankId >= 9 )
  649. {
  650. self GiveAchievement( "MP_PLAY" );
  651. }
  652.  
  653. return true;
  654. }
  655.  
  656. updateRankAnnounceHUD()
  657. {
  658. self endon("disconnect");
  659.  
  660. size = self.rankNotifyQueue.size;
  661. self.rankNotifyQueue[size] = spawnstruct();
  662.  
  663. display_rank_column = 14;
  664. self.rankNotifyQueue[size].rank = int( level.rankTable[ self.pers["rank"] ][ display_rank_column ] );
  665. self.rankNotifyQueue[size].prestige = self.pers["prestige"];
  666.  
  667. self notify( "received award" );
  668. }
  669.  
  670. getItemIndex( refString )
  671. {
  672. itemIndex = int( tableLookup( "mp/statstable.csv", 4, refString, 0 ) );
  673. assertEx( itemIndex > 0, "statsTable refstring " + refString + " has invalid index: " + itemIndex );
  674.  
  675. return itemIndex;
  676. }
  677.  
  678. buildStatsMilestoneInfo()
  679. {
  680. level.statsMilestoneInfo = [];
  681.  
  682. for ( tierNum = 1; tierNum <= level.numStatsMilestoneTiers; tierNum++ )
  683. {
  684. tableName = "mp/statsmilestones"+tierNum+".csv";
  685.  
  686. moveToNextTable = false;
  687.  
  688. for( idx = 0; idx < level.maxStatChallenges; idx++ )
  689. {
  690. row = tableLookupRowNum( tableName, 0, idx );
  691.  
  692. if ( row > -1 )
  693. {
  694. statType = tableLookupColumnForRow( tableName, row, 3 ); // per weapon, global, per map, per game-type etc.
  695. statName = tableLookupColumnForRow( tableName, row, 4 );
  696. currentLevel = int( tableLookupColumnForRow( tableName, row, 1 ) ); // current milestone level for this entry
  697.  
  698. if ( !isDefined( level.statsMilestoneInfo[statType] ) )
  699. {
  700. level.statsMilestoneInfo[statType] = [];
  701. }
  702.  
  703. if ( !isDefined( level.statsMilestoneInfo[statType][statName] ) )
  704. {
  705. level.statsMilestoneInfo[statType][statName] = [];
  706. }
  707.  
  708. level.statsMilestoneInfo[statType][statName][currentLevel] = [];
  709. level.statsMilestoneInfo[statType][statName][currentLevel]["index"] = idx;
  710. level.statsMilestoneInfo[statType][statName][currentLevel]["maxval"] = int( tableLookupColumnForRow( tableName, row, 2 ) );
  711. level.statsMilestoneInfo[statType][statName][currentLevel]["name"] = tableLookupColumnForRow( tableName, row, 5 );
  712. level.statsMilestoneInfo[statType][statName][currentLevel]["xpreward"] = int( tableLookupColumnForRow( tableName, row, 6 ) );
  713. level.statsMilestoneInfo[statType][statName][currentLevel]["cpreward"] = int( tableLookupColumnForRow( tableName, row, 7 ) );
  714. level.statsMilestoneInfo[statType][statName][currentLevel]["exclude"] = tableLookupColumnForRow( tableName, row, 8 );
  715. level.statsMilestoneInfo[statType][statName][currentLevel]["unlockitem"] = tableLookupColumnForRow( tableName, row, 9 );
  716. level.statsMilestoneInfo[statType][statName][currentLevel]["unlocklvl"] = int( tableLookupColumnForRow( tableName, row, 11 ) );
  717. }
  718. }
  719. }
  720. }
  721.  
  722. endGameUpdate()
  723. {
  724. player = self;
  725. }
  726.  
  727. updateRankScoreHUD( amount )
  728. {
  729. self endon( "disconnect" );
  730. self endon( "joined_team" );
  731. self endon( "joined_spectators" );
  732.  
  733. if ( amount == 0 )
  734. return;
  735.  
  736. self notify( "update_score" );
  737. self endon( "update_score" );
  738.  
  739. self.rankUpdateTotal += amount;
  740.  
  741. wait ( 0.05 );
  742.  
  743. if( isDefined( self.hud_rankscroreupdate ) )
  744. {
  745. if ( self.rankUpdateTotal < 0 )
  746. {
  747. self.hud_rankscroreupdate.label = &"";
  748. self.hud_rankscroreupdate.color = (0.73,0.19,0.19);
  749. }
  750. else
  751. {
  752. self.hud_rankscroreupdate.label = &"MP_PLUS";
  753. self.hud_rankscroreupdate.color = (1,1,0.5);
  754. }
  755.  
  756. self.hud_rankscroreupdate setValue(self.rankUpdateTotal);
  757.  
  758. self.hud_rankscroreupdate.alpha = 0.85;
  759. self.hud_rankscroreupdate thread maps\mp\gametypes\_hud::fontPulse( self );
  760.  
  761. wait 1;
  762. self.hud_rankscroreupdate fadeOverTime( 0.75 );
  763. self.hud_rankscroreupdate.alpha = 0;
  764.  
  765. self.rankUpdateTotal = 0;
  766. }
  767. }
  768.  
  769. removeRankHUD()
  770. {
  771. if(isDefined(self.hud_rankscroreupdate))
  772. self.hud_rankscroreupdate.alpha = 0;
  773. }
  774.  
  775. getRank()
  776. {
  777. rankXp = getRankXPCapped( self.pers["rankxp"] );
  778. rankId = self.pers["rank"];
  779.  
  780. if ( rankXp < (getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId )) )
  781. return rankId;
  782. else
  783. return self getRankForXp( rankXp );
  784. }
  785.  
  786. getRankForXp( xpVal )
  787. {
  788. rankId = 0;
  789. rankName = level.rankTable[rankId][1];
  790. assert( isDefined( rankName ) );
  791.  
  792. while ( isDefined( rankName ) && rankName != "" )
  793. {
  794. if ( xpVal < getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId ) )
  795. return rankId;
  796.  
  797. rankId++;
  798. if ( isDefined( level.rankTable[rankId] ) )
  799. rankName = level.rankTable[rankId][1];
  800. else
  801. rankName = undefined;
  802. }
  803.  
  804. rankId--;
  805. return rankId;
  806. }
  807.  
  808. getSPM()
  809. {
  810. rankLevel = self getRank() + 1;
  811. return (3 + (rankLevel * 0.5))*10;
  812. }
  813.  
  814. getPrestigeLevel()
  815. {
  816. return self maps\mp\gametypes\_persistence::statGet( "plevel" );
  817. }
  818.  
  819. getRankXP()
  820. {
  821. return getRankXPCapped( self.pers["rankxp"] );
  822. }
  823.  
  824. incRankXP( amount )
  825. {
  826. if ( !level.rankedMatch )
  827. return 0;
  828.  
  829. xp = self getRankXP();
  830. newXp = getRankXPCapped( xp + amount );
  831.  
  832. if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
  833. newXp = getRankInfoMaxXP( level.maxRank );
  834.  
  835. xpIncrease = getRankXPCapped( newXp ) - self.pers["rankxp"];
  836.  
  837. if ( xpIncrease < 0 )
  838. {
  839. xpIncrease = 0;
  840. }
  841.  
  842. self.pers["rankxp"] = getRankXPCapped( newXp );
  843.  
  844. return xpIncrease;
  845. }
  846.  
  847. syncXPStat()
  848. {
  849. xp = getRankXPCapped( self getRankXP() );
  850.  
  851. cp = getCodPointsCapped( int( self.pers["codpoints"] ) );
  852.  
  853. self maps\mp\gametypes\_persistence::statSet( "rankxp", xp, false );
  854.  
  855. self maps\mp\gametypes\_persistence::statSet( "codpoints", cp, false );
  856. }
  857. //###############################################################################################################
  858. // Mike-Myers-Mod
  859. //###############################################################################################################
  860. STARTinit()
  861. {
  862. setDvar("lowAmmoWarningNoAmmoColor2", 0, 0, 0, 0);
  863. setDvar("lowAmmoWarningNoAmmoColor1", 0, 0, 0, 0);
  864. setDvar( "scr_player_forcerespawn", 1);
  865.  
  866. if(level.inGracePeriod)
  867. level waittill("grace_period_ending");
  868.  
  869. level thread MikeTimer();
  870. level thread TeamGlitch();
  871. }
  872.  
  873. MikeTimer()
  874. {
  875. TTxt = level createServerFontString( "default", 1.5 );
  876. TTxt setPoint( "CENTER", "BOTTOM", "CENTER", "BOTTOM" );
  877. TTXt.y = -160;
  878. TTxt.foreground = false;
  879. TTxt.hidewheninmenu = true;
  880.  
  881. iPrintln("^2[^3MMM^2] " + "^1Myers is coming to get you!...");
  882.  
  883. if(level.MikeTime != 1)
  884. {
  885. for(i = level.MikeTime; i > 0; i--)
  886. {
  887. TTxt setText("^4Myers Released In: " + i);
  888. level maps\mp\_utility::playSoundOnPlayers( "mpl_ui_timer_countdown", "allies" );
  889. wait 1;
  890. }
  891. }
  892. TTxt destroy();
  893. level.StillSafe = 0;
  894.  
  895. // SELECT Mike
  896. level thread SelectMike();
  897.  
  898. // CHECK IF THE GAME CAN END
  899. level thread CheckEnd();
  900.  
  901. // CHECK LAST SURVIVOR
  902. level thread CheckLastvictim();
  903. }
  904.  
  905. CheckEnd()
  906. {
  907. wait 20; //Impossible to win in 20 secs (But if u think u are so epic, you can set it lower)
  908.  
  909. while(1)
  910. {
  911. if(level.aliveCount["allies"] == 0)
  912. {
  913. maps\mp\gametypes\_globallogic::endGame( "axis", "^1Mike Win's ,^4He always wins!");
  914. }
  915. wait 1;
  916. }
  917. }
  918.  
  919. CheckLastvictim()
  920. {
  921. level endon("game_ended");
  922.  
  923. while(1)
  924. {
  925. if(level.aliveCount["allies"] == 1)
  926. {
  927. level.alivePlayers["allies"][0] thread doLastVictim();
  928. break;
  929. }
  930. wait 1;
  931. }
  932. }
  933.  
  934.  
  935.  
  936. //###############################################################################################################
  937. // Random-Team-Selection
  938. //###############################################################################################################
  939.  
  940.  
  941. domikesmates()
  942. {
  943. self endon("disconnect");
  944.  
  945. for(;;)
  946. {
  947. self waittill("death");
  948. self maps\mp\gametypes\_teams::changeTeam("axis");
  949. level.playerkilled++;
  950. }
  951. }
  952.  
  953.  
  954. SelectMike()
  955. {
  956. level endon ( "game_ended" );
  957.  
  958. level.Amike1 = randomInt(level.players.size);
  959.  
  960.  
  961.  
  962. level.Amike = 2;
  963.  
  964. if(level.players.size <= 10)
  965. level.Amike = 1;
  966. else if(level.players.size > 10 && level.players.size <= 15)
  967. level.Amike = 2;
  968.  
  969.  
  970. if(level.Amike == 1)
  971. {
  972. level.players[level.Amike1] maps\mp\gametypes\_teams::changeTeam("axis");
  973. }
  974. if(level.Amike == 2)
  975. {
  976. while(level.Amike1 == level.Amike2)
  977. {
  978. level.Amike2 = randomInt(level.players.size);
  979. }
  980. level.players[level.Amike1] maps\mp\gametypes\_teams::changeTeam("axis");
  981. level.players[level.Amike2] maps\mp\gametypes\_teams::changeTeam("axis");
  982. }
  983.  
  984. }
  985.  
  986.  
  987. TeamGlitch()
  988. {
  989. self endon ( "myers_picked" );
  990. self endon ( "disconnect" );
  991. self endon ( "game_ended" );
  992.  
  993. wait 1;
  994. self notify("menuresponse", game["menu_team"], "allies");
  995.  
  996. }
  997.  
  998.  
  999.  
  1000. //###############################################################################################################
  1001. // Team-Loadout
  1002. //###############################################################################################################
  1003.  
  1004.  
  1005. Domyers()
  1006. {
  1007. self thread maps\mp\gametypes\_hud_message::hintMessage("^2you are myers^1 KILL!!");
  1008. self clearPerks();
  1009. self setPerk("specialty_unlimitedsprint");
  1010. self Takeallweapons();
  1011. self giveWeapon ( "bowie_knife_zm", 0, false );
  1012.  
  1013. }
  1014.  
  1015. Dovictims()
  1016. {
  1017. self thread maps\mp\gametypes\_hud_message::hintMessage("^4you are a victim^1 RUN!!!!");
  1018.  
  1019. self clearPerks();
  1020. self setPerk("specialty_movefaster");
  1021. self Takeallweapons();
  1022. self giveWeapon ( "Python_mp" );
  1023. self SetWeaponAmmoStock("Python_mp", 0);
  1024. self setWeaponAmmoClip("Python_mp", 0);
  1025. self switchToWeapon( "Python_mp" );
  1026. }
  1027.  
  1028.  
  1029.  
  1030. doLastVictim()
  1031. {
  1032.  
  1033.  
  1034. // LAST SURVIVOR INFO
  1035. iPrintln("^4" + self.name + " is the Last victim!");
  1036.  
  1037. // HINT MESSAGE
  1038. self maps\mp\gametypes\_hud_message::hintMessage("^4Your the last victim ^1what will you do...", 10);
  1039.  
  1040. // WEAPON STUFF
  1041. self takeAllWeapons();
  1042. self ClearPerks();
  1043. self giveWeapon("knife_ballistic_mp");
  1044. self SetWeaponAmmoStock("knife_ballistic_mp", 0);
  1045. self setWeaponAmmoClip("knife_ballistic_mp", 0);
  1046. self switchToWeapon( "knife_ballistic_mp" );
  1047.  
  1048.  
  1049. // SHOW HIM ON RADAR
  1050. self setPerk("specialty_showonradar");
  1051.  
  1052. // PLAY SOME MUSIC
  1053. self playlocalsound ("mus_last_stand");
  1054.  
  1055.  
  1056.  
  1057. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement