1 #using scripts\codescripts\struct;
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\challenges_shared;
5 #using scripts\shared\drown;
6 #using scripts\shared\system_shared;
7 #using scripts\shared\util_shared;
8 #using scripts\shared\weapons\_weapon_utils;
10 #using scripts\mp\gametypes\_loadout;
12 #insert scripts\shared\shared.gsh;
14 #using scripts\mp\_util;
15 #using scripts\mp\killstreaks\_counteruav;
16 #using scripts\mp\killstreaks\_emp;
17 #using scripts\mp\killstreaks\_killstreaks;
18 #using scripts\mp\killstreaks\_satellite;
19 #using scripts\mp\killstreaks\_uav;
23 #insert scripts\mp\_bonuscard.gsh;
25 #define KILL_NEAR_PLANT_ENGINEER_HARDWIRED_CLOSE_ENOUGH_DISTANCE 400
27 #namespace challenges;
42 if ( !isdefined( level.ChallengesCallbacks ) )
44 level.ChallengesCallbacks = [];
49 if ( isdefined ( level.scoreEventGameEndCallback ) )
74 self.pers[
"bulletStreak"] = 0;
75 self.pers[
"lastBulletKillTime"] = 0;
76 self.pers[
"stickExplosiveKill"] = 0;
77 self.pers[
"carepackagesCalled"] = 0;
78 self.pers[
"challenge_destroyed_air"] = 0;
79 self.pers[
"challenge_destroyed_ground"] = 0;
80 self.pers[
"challenge_anteup_earn"] = 0;
81 self.pers[
"specialistStatAbilityUsage"] = 0;
82 self.pers[
"canSetSpecialistStat"] =
self isSpecialistUnlocked();
83 self.pers[
"activeKillstreaks"] = [];
88 if ( !isdefined(
self.pers[
"challenge_heroweaponkills"]) )
92 heroWeaponName =
self GetLoadoutItemRef( 0,
"heroWeapon" );
93 heroWeapon = GetWeapon( heroWeaponName );
94 if ( heroWeapon == level.weaponNone )
96 heroAbilityName =
self GetHeroAbilityName();
97 heroWeapon = GetWeapon( heroAbilityName );
99 if ( heroWeapon != level.weaponNone )
101 self addweaponstat( heroWeapon,
"used", 1 );
104 self.pers[
"challenge_heroweaponkills"] = 0;
110 self endon(
"disconnect" );
112 self.pers[
"killNemesis"] = 0;
113 self.pers[
"killsFastMagExt"] = 0;
114 self.pers[
"longshotsPerLife"] = 0;
115 self.pers[
"specialistStatAbilityUsage"] = 0;
116 self.challenge_defenderkillcount = 0;
117 self.challenge_offenderkillcount = 0;
118 self.challenge_offenderProjectileMultiKillcount = 0;
119 self.challenge_offenderComlinkKillcount = 0;
120 self.challenge_offenderSentryTurretKillCount = 0;
121 self.challenge_objectiveDefensiveKillcount = 0;
122 self.challenge_objectiveOffensiveKillcount = 0;
123 self.challenge_scavengedCount = 0;
124 self.challenge_resuppliedNameKills = 0;
125 self.challenge_objectiveDefensive = undefined;
126 self.challenge_objectiveOffensive = undefined;
127 self.challenge_lastsurvivewithflakfrom = undefined;
128 self.explosiveInfo = [];
132 self waittill(
"spawned_player");
134 self.weaponKillsThisSpawn = [];
135 self.attachmentKillsThisSpawn = [];
136 self.challenge_hatchetTossCount = 0;
137 self.challenge_hatchetkills = 0;
138 self.retreivedBlades = 0;
139 self.challenge_combatRobotAttackClientID = [];
141 self thread watchDoubleJump();
155 self endon(
"death" );
156 self endon(
"disconnect" );
158 self.challenge_scavengedCount = 0;
162 self waittill(
"scavenged_primary_grenade" );
163 self.challenge_scavengedCount++;
169 self endon(
"death" );
170 self endon(
"disconnect" );
172 self.challenge_doublejump_begin = 0;
173 self.challenge_doublejump_end = 0;
179 case "doublejump_begin":
180 self.challenge_doublejump_begin = gettime();
182 case "doublejump_end":
183 self.challenge_doublejump_end = gettime();
191 self endon(
"death" );
192 self endon(
"disconnect" );
194 self.challenge_jump_begin = 0;
195 self.challenge_jump_end = 0;
202 self.challenge_jump_begin = gettime();
205 self.challenge_jump_end = gettime();
213 self endon(
"death" );
214 self endon(
"disconnect" );
216 self.challenge_swimming_begin = 0;
217 self.challenge_swimming_end = 0;
223 case "swimming_begin":
224 self.challenge_swimming_begin = gettime();
227 self.challenge_swimming_end = gettime();
235 self endon(
"death" );
236 self endon(
"disconnect" );
238 self.challenge_wallrun_begin = 0;
239 self.challenge_wallrun_end = 0;
245 case "wallrun_begin":
246 self.challenge_wallrun_begin = gettime();
249 self.challenge_wallrun_end = gettime();
257 self endon(
"death" );
258 self endon(
"disconnect" );
260 self.challenge_slide_begin = 0;
261 self.challenge_slide_end = 0;
268 self.challenge_slide_begin = gettime();
271 self.challenge_slide_end = gettime();
280 self endon(
"death" );
281 self endon(
"disconnect" );
283 self.challenge_sprint_begin = 0;
284 self.challenge_sprint_end = 0;
291 self.challenge_sprint_begin = gettime();
294 self.challenge_sprint_end = gettime();
304 victim = data.victim;
305 attacker = data.attacker;
308 attacker.lastKilledPlayer = victim;
309 attackerDoubleJumping = data.attackerDoubleJumping;
310 attackerflashbackTime = data.attackerflashbackTime;
311 attackerHeroAbility = data.attackerHeroAbility;
312 attackerHeroAbilityActive = data.attackerHeroAbilityActive;
313 attackerSliding = data.attackerSliding;
314 attackerSpeedburst = data.attackerSpeedburst;
315 attackerTraversing = data.attackerTraversing;
316 attackerVisionPulseActivateTime = data.attackerVisionPulseActivateTime;
317 attackerVisionPulseArray = data.attackerVisionPulseArray;
318 attackerVisionPulseOrigin = data.attackerVisionPulseOrigin;
319 attackerVisionPulseOriginArray = data.attackerVisionPulseOriginArray;
320 attackerWallRunning = data.attackerWallRunning;
321 attackerWasConcussed = data.attackerWasConcussed;
322 attackerWasFlashed = data.attackerWasFlashed;
323 attackerWasHeatWaveStunned = data.attackerWasHeatWaveStunned;
324 attackerWasOnGround = data.attackerOnGround;
325 attackerWasUnderwater = data.attackerWasUnderwater;
326 attackerLastFastReloadTime = data.attackerLastFastReloadTime;
327 lastWeaponBeforeToss = data.lastWeaponBeforeToss;
328 meansOfDeath = data.sMeansOfDeath;
329 ownerWeaponAtLaunch = data.ownerWeaponAtLaunch;
330 victimBedOut = data.bledOut;
331 victimOrigin = data.victimOrigin;
332 victimCombatEfficiencyLastOnTime = data.victimCombatEfficiencyLastOnTime;
333 victimCombatEfficieny = data.victimCombatEfficieny;
334 victimElectrifiedBy = data.victimElectrifiedBy;
335 victimflashbackTime = data.victimflashbackTime;
336 victimHeroAbility = data.victimHeroAbility;
337 victimHeroAbilityActive = data.victimHeroAbilityActive;
338 victimSpeedburst = data.victimSpeedburst;
339 victimSpeedburstLastOnTime = data.victimSpeedburstLastOnTime;
340 victimVisionPulseActivateTime = data.victimVisionPulseActivateTime;
341 victimVisionPulseActivateTime = data.victimVisionPulseActivateTime;
342 victimVisionPulseArray = data.victimVisionPulseArray;
343 victimVisionPulseOrigin = data.victimVisionPulseOrigin;
344 victimVisionPulseOriginArray = data.victimVisionPulseOriginArray;
345 victimAttackersThisSpawn = data.victimAttackersThisSpawn;
346 victimWasDoubleJumping = data.victimWasDoubleJumping;
347 victimWasInSlamState = data.victimWasInSlamState;
348 victimWasLungingWithArmBlades = data.victimWasLungingWithArmBlades;
349 victimWasOnGround = data.victimOnGround;
350 victimWasUnderwater = data.wasUnderwater;
351 victimWasWallRunning = data.victimWasWallRunning;
352 victimLastStunnedBy = data.victimLastStunnedBy;
353 victimActiveProximityGrenades = data.victim.activeProximityGrenades;
354 victimActiveBouncingBetties = data.victim.activeBouncingBetties;
355 attackerLastFlashedBy = data.attackerLastFlashedBy;
356 attackerLastStunnedBy = data.attackerLastStunnedBy;
357 attackerLastStunnedTime = data.attackerLastStunnedTime;
358 attackerWasSliding = data.attackerWasSliding;
359 attackerWasSprinting = data.attackerWasSprinting;
360 wasDefusing = data.wasDefusing;
361 wasPlanting = data.wasPlanting;
362 inflictorOwnerWasSprinting = data.inflictorOwnerWasSprinting;
363 player = data.attacker;
364 playerOrigin = data.attackerOrigin;
365 weapon = data.weapon;
367 victim_doublejump_begin = data.victim_doublejump_begin;
368 victim_doublejump_end = data.victim_doublejump_end;
369 victim_jump_begin = data.victim_jump_begin;
370 victim_jump_end = data.victim_jump_end;
371 victim_swimming_begin = data.victim_swimming_begin;
372 victim_swimming_end = data.victim_swimming_end;
373 victim_slide_begin = data.victim_slide_begin;
374 victim_slide_end = data.victim_slide_end;
375 victim_wallrun_begin = data.victim_wallrun_begin;
376 victim_wallrun_end = data.victim_wallrun_end;
377 victim_was_drowning = data.victim_was_drowning;
379 attacker_doublejump_begin = data.attacker_doublejump_begin;
380 attacker_doublejump_end = data.attacker_doublejump_end;
381 attacker_jump_begin = data.attacker_jump_begin;
382 attacker_jump_end = data.attacker_jump_end;
383 attacker_swimming_begin = data.attacker_swimming_begin;
384 attacker_swimming_end = data.attacker_swimming_end;
385 attacker_slide_begin = data.attacker_slide_begin;
386 attacker_slide_end = data.attacker_slide_end;
387 attacker_wallrun_begin = data.attacker_wallrun_begin;
388 attacker_wallrun_end = data.attacker_wallrun_end;
389 attacker_was_drowning = data.attacker_was_drowning;
390 attacker_sprint_end = data.attacker_sprint_end;
391 attacker_sprint_begin = data.attacker_sprint_begin;
393 attacker_wallRanTwoOppositeWallsNoGround = data.attacker_wallRanTwoOppositeWallsNoGround;
395 inflictorIsCooked = data.inflictorIsCooked;
396 inflictorChallenge_hatchetTossCount = data.inflictorChallenge_hatchetTossCount;
397 inflictorOwnerWasSprinting = data.inflictorOwnerWasSprinting;
398 inflictorPlayerHasEngineerPerk = data.inflictorPlayerHasEngineerPerk;
400 inflictor = data.eInflictor;
403 if ( !isdefined( data.weapon ) )
408 if ( !isdefined( player ) || !isplayer( player ) || ( weapon == level.weaponNone ) )
417 baseWeaponItemIndex = GetBaseWeaponItemIndex( baseWeapon );
418 weaponPurchased = player isItemPurchased( baseWeaponItemIndex );
419 victimSupportIndex = victim.team;
420 playerSupportIndex = player.team;
421 if ( !level.teambased )
423 playerSupportIndex = player.entnum;
424 victimSupportIndex = victim.entnum;
427 if ( meansOfDeath ==
"MOD_HEAD_SHOT" || meansOfDeath ==
"MOD_PISTOL_BULLET" || meansOfDeath ==
"MOD_RIFLE_BULLET" )
436 if ( level.teambased )
438 if ( player.team == victim.team )
445 if ( player == victim )
453 if ( !isdefined( killstreak ) )
456 if ( weapon.isheroWeapon ==
true )
459 player.heroWeaponKillsThisActivation++;
460 player.pers[
"challenge_heroweaponkills"]++;
461 if ( player.pers[
"challenge_heroweaponkills"] >= 6 )
464 player.pers[
"challenge_heroweaponkills"] = 0;
471 if ( weaponPurchased )
473 if ( weaponclass ==
"weapon_sniper" )
475 if ( isdefined ( victim.firstTimeDamaged ) && victim.firstTimeDamaged == time )
477 player AddPlayerStat(
"kill_enemy_one_bullet_sniper", 1 );
478 player AddWeaponStat( weapon,
"kill_enemy_one_bullet_sniper", 1 );
481 else if ( weaponclass ==
"weapon_cqb" )
483 if ( isdefined ( victim.firstTimeDamaged ) && victim.firstTimeDamaged == time )
485 player AddPlayerStat(
"kill_enemy_one_bullet_shotgun", 1 );
486 player AddWeaponStat( weapon,
"kill_enemy_one_bullet_shotgun", 1 );
491 if ( ( time - data.attacker_swimming_end <= 2000 ) && ( time - data.attacker_doublejump_begin <= 2000 ) )
493 player AddPlayerStat(
"kill_after_doublejump_out_of_water", 1 );
496 if ( attackerWasSliding )
498 if ( attacker_doublejump_end == attacker_slide_begin )
500 player AddPlayerStat(
"kill_while_sliding_from_doublejump", 1 );
504 if ( ( player IsBonusCardActive(
BONUSCARD_PRIMARY_GUNFIGHTER_3, player.class_num ) ) && player IsItemPurchased( GetItemIndexFromRef(
"bonuscard_primary_gunfighter_3" ) ) )
506 if ( isdefined( weapon.attachments ) && weapon.attachments.size == 6 )
508 player AddPlayerStat(
"kill_with_gunfighter", 1 );
513 checkkillstreak5( baseWeapon, player );
515 if ( weapon.isDualWield && weaponPurchased )
517 checkDualWield( baseWeapon, player, attacker, time, attackerwassprinting, attacker_sprint_end );
520 if ( isdefined( weapon.attachments ) && weapon.attachments.size > 0 )
522 attachmentName = player GetWeaponOptic( weapon );
524 if ( isdefined( attachmentName ) && attachmentName !=
"" && player WeaponHasAttachmentAndUnlocked( weapon, attachmentName ) )
526 if ( weapon.attachments.size > 5 && player AllWeaponAttachmentsUnlocked( weapon ) && !isdefined( attacker.tookWeaponFrom[ weapon ] ) )
528 player AddPlayerStat(
"kill_optic_5_attachments", 1 );
530 if ( isdefined( player.attachmentKillsThisSpawn[ attachmentName ] ) )
532 player.attachmentKillsThisSpawn[ attachmentName ]++;
533 if ( player.attachmentKillsThisSpawn[ attachmentName ] == 5 )
535 player AddWeaponStat( weapon,
"killstreak_5_attachment", 1 );
540 player.attachmentKillsThisSpawn[ attachmentName ] = 1;
545 if ( player weaponHasAttachmentAndUnlocked( weapon,
"suppressed",
"extbarrel" ) )
547 player AddPlayerStat(
"kills_pistol_lasersight_suppressor_longbarrel", 1 );
552 if ( player weaponHasAttachmentAndUnlocked( weapon,
"suppressed" ) )
558 player AddPlayerStat(
"kills_suppressor_ghost_hardwired_blastsuppressor", 1 );
562 if ( player PlayerAds() == 1 )
564 if ( isdefined( player.smokeGrenadeTime ) && isdefined( player.smokeGrenadePosition ) )
566 if ( player.smokeGrenadeTime + 14000 > time )
568 if ( player
util::is_looking_at( player.smokeGrenadePosition ) || ( distancesquared( player.origin, player.smokeGrenadePosition ) < 200 * 200 ))
570 if ( player weaponHasAttachmentAndUnlocked( weapon,
"ir" ) )
572 player AddPlayerStat(
"kill_with_thermal_and_smoke_ads", 1 );
573 player AddWeaponStat( weapon,
"kill_thermal_through_smoke", 1 );
580 if ( weapon.attachments.size > 1 )
582 if ( player PlayerAds() == 1 )
584 if ( player weaponHasAttachmentAndUnlocked( weapon,
"grip",
"quickdraw" ) )
586 player AddPlayerStat(
"kills_ads_quickdraw_and_grip", 1 );
588 if ( player weaponHasAttachmentAndUnlocked( weapon,
"swayreduc",
"stalker" ) )
590 player AddPlayerStat(
"kills_ads_stock_and_cpu", 1 );
595 if ( player weaponHasAttachmentAndUnlocked( weapon,
"rf",
"steadyaim" ) )
599 player AddPlayerStat(
"kills_hipfire_rapidfire_lasersights_fasthands", 1 );
603 if ( player weaponHasAttachmentAndUnlocked( weapon,
"fastreload",
"extclip" ) )
605 player.pers[
"killsFastMagExt"]++;
606 if ( player.pers[
"killsFastMagExt"] > 4 )
608 player AddPlayerStat(
"kills_one_life_fastmags_and_extclip", 1 );
609 player.pers[
"killsFastMagExt"] = 0;
614 if ( weapon.attachments.size > 2 )
616 if ( meansOfDeath ==
"MOD_HEAD_SHOT" )
618 if ( player weaponHasAttachmentAndUnlocked( weapon,
"fmj",
"damage",
"extbarrel" ) )
620 player AddPlayerStat(
"headshot_fmj_highcaliber_longbarrel", 1 );
625 if ( weapon.attachments.size > 4 )
627 if ( player weaponHasAttachmentAndUnlocked( weapon,
"extclip",
"grip",
"fastreload",
"quickdraw",
"stalker" ) )
629 player AddPlayerStat(
"kills_extclip_grip_fastmag_quickdraw_stock", 1 );
634 if ( victim_was_drowning && attacker_was_drowning )
636 player AddPlayerStat(
"dr_lung", 1 );
639 if ( isdefined( attackerLastFastReloadTime ) && ( time - attackerLastFastReloadTime <= 5000 ) && player WeaponHasAttachmentAndUnlocked( weapon,
"fastreload" ) )
641 player AddPlayerStat(
"kills_after_reload_fastreload", 1 );
644 if ( victim.iDFlagsTime == time )
648 player AddPlayerStat(
"kill_enemy_through_wall", 1 );
649 if ( player weaponHasAttachmentAndUnlocked( weapon,
"fmj" ) )
651 player AddPlayerStat(
"kill_enemy_through_wall_with_fmj", 1 );
656 if ( attacker_wallRanTwoOppositeWallsNoGround ===
true )
658 player AddPlayerStat(
"kill_while_wallrunning_2_walls", 1 );
665 player AddPlayerStat(
"melee", 1 );
668 player AddPlayerStat(
"kill_enemy_with_fists", 1 );
672 checkkillstreak5( baseWeapon, player );
676 if ( weaponPurchased )
678 if ( weapon == player.grenadeTypePrimary )
680 if ( player.challenge_scavengedCount > 0 )
682 player.challenge_resuppliedNameKills++;
683 if ( player.challenge_resuppliedNameKills >= 3 )
685 player AddPlayerStat(
"kills_3_resupplied_nade_one_life", 1 );
686 player.challenge_resuppliedNameKills = 0;
688 player.challenge_scavengedCount--;
691 if ( isdefined( inflictorIsCooked ) )
693 if ( inflictorIsCooked ==
true && weapon.rootweapon.name !=
"hatchet" )
695 player AddPlayerStat(
"kill_with_cooked_grenade", 1 );
699 if ( victimLastStunnedBy === player )
701 if ( weaponclass ==
"weapon_grenade" )
703 player AddPlayerStat(
"kill_stun_lethal", 1 );
707 if ( baseWeapon == level.weaponSpecialCrossbow )
709 if ( weapon.isDualWield )
711 checkDualWield( baseWeapon, player, attacker, time, attackerwassprinting, attacker_sprint_end );
716 if ( baseWeapon == level.weaponShotgunEnergy )
718 if ( isdefined ( victim.firstTimeDamaged ) && victim.firstTimeDamaged == time )
720 player AddPlayerStat(
"kill_enemy_one_bullet_shotgun", 1 );
721 player AddWeaponStat( weapon,
"kill_enemy_one_bullet_shotgun", 1 );
726 if ( baseWeapon.forceDamageHitLocation || baseWeapon == level.weaponSpecialCrossbow || baseWeapon == level.weaponShotgunEnergy || baseWeapon == level.weaponSpecialDiscGun || baseWeapon == level.weaponBallisticKnife || baseWeapon == level.weaponLauncherEx41 )
729 checkkillstreak5( baseWeapon, player );
733 if ( isdefined( attacker.tookWeaponFrom[ weapon ] ) && isdefined( attacker.tookWeaponFrom[ weapon ].previousOwner ) )
735 if ( !isdefined( attacker.tookWeaponFrom[ weapon ].previousOwner.team ) || attacker.tookWeaponFrom[ weapon ].previousOwner.team != player.team )
737 player AddPlayerStat(
"kill_with_pickup", 1 );
741 awarded_kill_enemy_that_blinded_you =
false;
745 if ( attackerWasFlashed )
747 if ( attackerLastFlashedBy === victim && !playerHasTacticalMask )
749 player AddPlayerStat(
"kill_enemy_that_blinded_you", 1 );
750 awarded_kill_enemy_that_blinded_you =
true;
754 if ( !awarded_kill_enemy_that_blinded_you && isdefined( attackerLastStunnedTime ) && attackerLastStunnedTime + 5000 > time )
756 if ( attackerLastStunnedBy === victim && !playerHasTacticalMask )
758 player AddPlayerStat(
"kill_enemy_that_blinded_you", 1 );
759 awarded_kill_enemy_that_blinded_you =
true;
763 killedStunnedVictim =
false;
764 if ( isdefined( victim.lastConcussedBy ) && victim.lastConcussedBy == attacker )
766 if ( victim.concussionEndTime > time )
770 player AddPlayerStat(
"kill_concussed_enemy", 1 );
772 killedStunnedVictim =
true;
773 player AddWeaponStat( GetWeapon(
"concussion_grenade" ),
"CombatRecordStat", 1 );
777 if ( isdefined( victim.lastShockedBy ) && victim.lastShockedBy == attacker )
779 if ( victim.shockEndTime > time )
783 player AddPlayerStat(
"kill_shocked_enemy", 1 );
785 player AddWeaponStat( GetWeapon(
"proximity_grenade" ),
"CombatRecordStat", 1 );
786 killedStunnedVictim =
true;
787 if ( weapon.rootweapon.name ==
"bouncingbetty" )
789 player AddPlayerStat(
"kill_trip_mine_shocked", 1 );
797 if ( isdefined( victim.lastFlashedBy ) && victim.lastFlashedBy == player )
799 killedStunnedVictim =
true;
802 player AddPlayerStat(
"kill_flashed_enemy", 1 );
804 player AddWeaponStat( GetWeapon(
"flash_grenade" ),
"CombatRecordStat", 1 );
808 if ( level.teamBased )
810 if ( ( !isDefined( player.pers[
"kill_every_enemy_with_specialist"] ) ) && ( level.playerCount[victim.pers[
"team"]] > 3 && player.pers[
"killed_players_with_specialist"].size >= level.playerCount[victim.pers[
"team"]] ) )
812 player AddPlayerStat(
"kill_every_enemy", 1 );
813 player.pers[
"kill_every_enemy_with_specialist"] =
true;
817 if ( isdefined( victimAttackersThisSpawn ) && IsArray( victimAttackersThisSpawn ) )
819 if ( victimAttackersThisSpawn.size > 5 )
822 foreach( attacking_player
in victimAttackersThisSpawn )
824 if ( !isdefined( attacking_player ) )
827 if ( attacking_player == attacker )
830 if ( attacking_player.team != attacker.team )
836 if ( attackerCount > 4 )
839 player AddPlayerStat(
"kill_enemy_5_teammates_assists", 1 );
845 if ( isdefined( killstreak ) )
847 if ( killstreak ==
"rcbomb" || killstreak ==
"inventory_rcbomb" )
849 if ( !victimWasOnGround || victimWasWallRunning )
851 player AddPlayerStat(
"kill_wallrunner_or_air_with_rcbomb", 1 );
855 if ( killstreak ==
"autoturret" || killstreak ==
"inventory_autoturret" )
859 if ( !isdefined( inflictor.challenge_killcount ) )
861 inflictor.challenge_killcount = 0;
864 inflictor.challenge_killcount++;
865 if ( inflictor.challenge_killcount == 5 )
867 player AddPlayerStat(
"kills_auto_turret_5", 1 );
873 if ( isdefined( victim.challenge_combatRobotAttackClientID[player.clientid] ) )
875 if ( !isdefined( inflictor ) || !isdefined( inflictor.killstreakType ) || !IsString( inflictor.killstreakType ) || ( inflictor.killstreakType !=
"combat_robot" ) )
877 player AddPlayerStat(
"kill_enemy_who_damaged_robot", 1 );
883 if ( weaponclass ==
"weapon_grenade" )
887 if ( weapon.rootweapon.name ==
"hatchet" && inflictorChallenge_hatchetTossCount <= 2 )
889 player.challenge_hatchetkills++;
890 if ( player.challenge_hatchetkills == 2 )
892 player AddPlayerStat(
"kills_first_throw_both_hatchets", 1 );
900 if ( !isdefined( killstreak ) )
902 if ( attackerWasUnderwater )
904 player AddPlayerStat(
"kill_while_underwater", 1 );
909 if ( ( attacker_doublejump_begin > attacker_doublejump_end || attacker_doublejump_end + 3000 > time )
910 || ( attacker_slide_begin > attacker_slide_end || attacker_slide_end + 3000 > time ) )
912 player AddPlayerStat(
"kills_after_jumping_or_sliding", 1 );
917 player AddPlayerStat(
"kill_overclock_afterburner_specialist_weapon_after_thrust", 1 );
923 trackedPlayer =
false;
926 if ( !victim hasPerk (
"specialty_trackerjammer" ) )
928 player AddPlayerStat(
"kill_detect_tracker", 1 );
929 trackedPlayer =
true;
935 if ( !victim hasPerk (
"specialty_sixthsensejammer" ) )
937 player AddPlayerStat(
"kill_enemy_sixth_sense", 1 );
941 if ( !victim hasPerk (
"specialty_quieter" ) )
943 player AddPlayerStat(
"kill_sixthsense_awareness", 1 );
950 player AddPlayerStat(
"kill_tracker_sixthsense", 1 );
954 if ( weapon.isheroWeapon ==
true || attackerHeroAbilityActive )
958 player AddPlayerStat(
"kill_with_specialist_overclock", 1 );
966 player AddPlayerStat(
"kill_uav_enemy_with_ghost", 1 );
973 awarded_kill_blindeye_ghost_aircraft =
false;
974 foreach( activeStreak
in activeKillstreaks )
976 if ( awarded_kill_blindeye_ghost_aircraft )
979 switch( activeStreak.killstreakType )
982 case "helicopter_comlink":
983 case "drone_striked":
985 player AddPlayerStat(
"kill_blindeye_ghost_aircraft", 1 );
986 awarded_kill_blindeye_ghost_aircraft =
true;
994 if ( isdefined ( player.challenge_lastsurvivewithflakfrom ) && player.challenge_lastsurvivewithflakfrom == victim )
996 player AddPlayerStat(
"kill_enemy_survive_flak", 1 );
1002 recentlySurvivedFlak =
false;
1003 if ( isdefined ( player.challenge_lastsurvivewithflaktime ) )
1005 if ( ( player.challenge_lastsurvivewithflaktime + 3000 ) > time )
1007 recentlySurvivedFlak =
true;
1010 recentlyStunned =
false;
1011 if ( isdefined( player.lastStunnedTime ) )
1013 if ( player.lastStunnedTime + 2000 > time )
1015 recentlyStunned =
true;
1018 if ( recentlySurvivedFlak
1020 || recentlyStunned )
1022 player AddPlayerStat(
"kill_flak_tac_while_stunned", 1 );
1031 player AddPlayerStat(
"kills_counteruav_emp_hardline", 1 );
1037 if ( player.scavenged )
1039 player AddPlayerStat(
"kill_after_resupply", 1 );
1040 if ( trackedPlayer )
1042 player AddPlayerStat(
"kill_scavenger_tracker_resupply", 1 );
1051 if ( attackerWasSprinting || attacker_sprint_end + 3000 > time )
1053 player AddPlayerStat(
"kills_after_sprint_fasthands", 1 );
1056 player AddPlayerStat(
"kill_fasthands_gungho_sprint", 1 );
1066 player AddPlayerStat(
"kill_hardwired_coldblooded", 1 );
1071 killedPlayerWithGungHo =
false;
1076 killedPlayerWithGungHo =
true;
1077 if ( attackerWasSprinting && player PlayerAds() != 1 )
1079 player AddPlayerStat(
"kill_hip_gung_ho", 1 );
1082 if ( weaponclass ==
"weapon_grenade" )
1084 if ( isdefined( inflictorOwnerWasSprinting ) && inflictorOwnerWasSprinting ==
true )
1086 killedPlayerWithGungHo =
true;
1087 player AddPlayerStat(
"kill_hip_gung_ho", 1 );
1094 if ( attackerDoubleJumping || ( attacker_doublejump_end + 3000 > time ) )
1096 player AddPlayerStat(
"kill_blast_doublejump", 1 );
1101 player AddPlayerStat(
"kill_doublejump_uav_engineer_hardwired", 1 );
1108 player AddPlayerStat(
"kill_awareness", 1 );
1111 if ( killedStunnedVictim )
1115 player AddPlayerStat(
"kill_stunned_tacmask", 1 );
1116 if ( killedPlayerWithGungHo ==
true )
1118 player AddPlayerStat(
"kill_sprint_stunned_gungho_tac", 1 );
1125 player AddPlayerStat(
"kill_dead_silence", 1 );
1127 if ( distanceSquared( playerOrigin, victimOrigin ) < 120 * 120 )
1131 player AddPlayerStat(
"kill_close_deadsilence_awareness", 1 );
1136 player AddPlayerStat(
"kill_close_blast_deadsilence", 1 );
1141 greedCardsActive = 0;
1155 if ( greedCardsActive >= 2 )
1157 player AddPlayerStat(
"kill_2_greed_2_perks_each", 1 );
1160 if ( player BonusCardActiveCount( player.class_num ) >= 2 )
1162 player AddPlayerStat(
"kill_2_wildcards", 1 );
1166 gunfighterOverkillActive =
false;
1169 primaryAttachmentsTotal = 0;
1170 if ( isdefined( player.primaryLoadoutWeapon ) )
1171 primaryAttachmentsTotal = player.primaryLoadoutWeapon.attachments.size;
1173 secondaryAttachmentsTotal = 0;
1174 if ( isdefined( player.secondaryLoadoutWeapon ) )
1175 secondaryAttachmentsTotal = player.secondaryLoadoutWeapon.attachments.size;
1177 if ( primaryAttachmentsTotal + secondaryAttachmentsTotal >= 5 )
1179 gunfighterOverkillActive =
true;
1183 if ( ( isdefined (player.primaryLoadoutWeapon ) && weapon == player.primaryLoadoutWeapon )
1184 || ( isdefined (player.primaryLoadoutAltWeapon ) && weapon == player.primaryLoadoutAltWeapon ) )
1189 player AddPlayerStat(
"kill_with_loadout_weapon_with_3_attachments", 1 );
1191 if ( isdefined( player.secondaryWeaponKill ) && player.secondaryWeaponKill ==
true )
1193 player.primaryWeaponKill =
false;
1194 player.secondaryWeaponKill =
false;
1198 player AddPlayerStat(
"kill_with_both_primary_weapons", 1 );
1199 if ( gunfighterOverkillActive )
1201 player AddPlayerStat(
"kill_overkill_gunfighter_5_attachments", 1 );
1207 player.primaryWeaponKill =
true;
1210 else if ( ( isdefined( player.secondaryLoadoutWeapon ) && weapon == player.secondaryLoadoutWeapon )
1211 || ( isdefined( player.secondaryLoadoutAltWeapon ) && weapon == player.secondaryLoadoutAltWeapon ) )
1217 if ( isdefined( player.primaryWeaponKill ) && player.primaryWeaponKill ==
true )
1219 player.primaryWeaponKill =
false;
1220 player.secondaryWeaponKill =
false;
1224 player AddPlayerStat(
"kill_with_both_primary_weapons", 1 );
1225 if ( gunfighterOverkillActive )
1227 player AddPlayerStat(
"kill_overkill_gunfighter_5_attachments", 1 );
1233 player.secondaryWeaponKill =
true;
1239 should_award_kill_near_plant_engineer_hardwired =
false;
1241 if ( isdefined( victimActiveBouncingBetties ) )
1243 foreach( bouncingBettyInfo
in victimActiveBouncingBetties )
1245 if ( !isdefined( bouncingBettyInfo ) || !isdefined( bouncingBettyInfo.origin ) )
1250 should_award_kill_near_plant_engineer_hardwired =
true;
1256 if ( isdefined( victimActiveProximityGrenades ) && should_award_kill_near_plant_engineer_hardwired ==
false )
1258 foreach( proximityGrenadeInfo
in victimActiveProximityGrenades )
1260 if ( !isdefined( proximityGrenadeInfo ) || !isdefined( proximityGrenadeInfo.origin ) )
1265 should_award_kill_near_plant_engineer_hardwired =
true;
1271 if ( should_award_kill_near_plant_engineer_hardwired )
1273 player AddPlayerStat(
"kill_near_plant_engineer_hardwired", 1 );
1279 if ( weapon.name ==
"supplydrop" )
1281 if (isdefined( inflictorPlayerHasEngineerPerk ) )
1283 player AddPlayerStat(
"kill_booby_trap_engineer", 1 );
1288 if ( weapon.isHeroWeapon ==
true || attackerHeroAbilityActive || isdefined( killstreak ) )
1293 player AddPlayerStat(
"kill_anteup_overclock_scorestreak_specialist", 1 );
1308 return self GetDStat(
"playerstatslist", stat_name,
"challengevalue" );
1314 self SetDStat(
"playerstatslist", stat_name,
"statvalue", stat_value );
1315 self SetDStat(
"playerstatslist", stat_name,
"challengevalue", stat_value );
1320 return self GetDStat(
"groupstats", group_name,
"stats", stat_name,
"challengevalue" );
1329 if ( !isdefined( player ) )
1332 if ( player.fix_challenge_stats_performed ===
true )
1342 player.fix_challenge_stats_performed =
true;
1351 if ( wepaon_for_diamond == 1 )
1359 if ( secondary_mastery == 3 )
1381 if ( group_weapon_assault >= 49 && weapons_mastery_assault < 1 )
1385 player AddPlayerStat(
"ar_garand_for_diamond", 1 );
1399 if ( group_weapon_pistol >= 21 && secondary_mastery_pistol < 1 )
1403 player AddPlayerStat(
"pistol_shotgun_for_diamond", 1 );
1411 return ( challenge_count >= target_value );
1430 if ( mastery_perk_2 >= 12 )
1452 if ( mastery_perk_2 < perk_2_tally )
1455 player AddPlayerStat(
"mastery_perk_2", 1 );
1462 base_weapon_param = [[ level.get_base_weapon_param ]]( weapon );
1465 return GetWeapon( GetRefFromItemIndex( GetBaseWeaponItemIndex( GetWeapon( base_weapon_param_name ) ) ) );
1470 if ( StrEndsWith( str,
"crossbowlh" ) )
1472 return GetSubStr( str, 0, str.size - 2 );
1480 if ( StrEndsWith( str,
"_lh" ) || StrEndsWith( str,
"_dw" ) )
1482 return GetSubStr( str, 0, str.size - 3 );
1490 if ( isdefined( player.weaponKillsThisSpawn[ baseWeapon ] ) )
1492 player.weaponKillsThisSpawn[ baseWeapon ]++;
1493 if ( ( player.weaponKillsThisSpawn[ baseWeapon ] ) % 5 == 0 )
1495 player AddWeaponStat( baseWeapon,
"killstreak_5", 1 );
1500 player.weaponKillsThisSpawn[ baseWeapon ] = 1;
1504 function checkDualWield( baseWeapon, player, attacker, time, attackerWasSprinting, attacker_sprint_end )
1507 if ( attackerWasSprinting || ( attacker_sprint_end + 1000 > time ) )
1511 player AddPlayerStat(
"kills_sprinting_dual_wield_and_gung_ho", 1 );
1518 player = data.player;
1519 winner = data.winner;
1521 if ( !isdefined( player ) )
1527 if ( level.teambased )
1529 winnerScore = game[
"teamScores"][winner];
1533 mostKillsLeastDeaths =
true;
1535 for ( index = 0; index < level.placement[
"all"].size; index++ )
1537 if ( level.placement[
"all"][index].deaths < player.deaths )
1539 mostKillsLeastDeaths =
false;
1541 if ( level.placement[
"all"][index].kills > player.kills )
1543 mostKillsLeastDeaths =
false;
1547 if ( mostKillsLeastDeaths && player.kills > 0 && level.placement[
"all"].size > 3 )
1549 if ( level.teambased )
1551 playerIsWinner = ( player.team === winner );
1556 playerIsWinner = ( ( level.placement[
"all"][0] === winner ) || ( level.placement[
"all"][1] === winner ) || ( level.placement[
"all"][2] === winner ) );
1559 if ( playerIsWinner )
1561 player AddPlayerStat(
"most_kills_least_deaths", 1 );
1568 self endon(
"disconnect" );
1569 self AddPlayerStatWithGameType(
"defends", 1 );
1571 self.challenge_offenderkillcount++;
1573 if ( !isdefined(
self.challenge_objectiveOffensive ) ||
self.challenge_objectiveOffensive != objective )
1575 self.challenge_objectiveOffensiveKillcount = 0;
1578 self.challenge_objectiveOffensiveKillcount++;
1579 self.challenge_ObjectiveOffensive = objective;
1583 if ( isdefined( killstreak ) )
1585 switch ( killstreak )
1588 case "inventory_planemortar":
1589 case "remote_missile":
1590 case "inventory_remote_missile":
1591 case "drone_strike":
1592 case "inventory_drone_strike":
1593 self.challenge_offenderProjectileMultiKillcount++;
1595 case "helicopter_comlink":
1596 case "inventory_helicopter_comlink":
1597 self.challenge_offenderComlinkKillcount++;
1599 case "combat_robot":
1600 case "inventory_combat_robot":
1601 self AddPlayerStat(
"kill_attacker_with_robot_or_tank", 1 );
1603 case "inventory_autoturret":
1605 self.challenge_offenderSentryTurretKillCount++;
1606 self AddPlayerStat(
"kill_attacker_with_robot_or_tank", 1 );
1611 if (
self.challenge_offenderComlinkKillcount == 2 )
1613 self AddPlayerStat(
"kill_2_attackers_with_comlink", 1 );
1616 if (
self.challenge_objectiveOffensiveKillcount > 4 )
1618 self AddPlayerStatWithGameType(
"multikill_5_attackers", 1 );
1619 self.challenge_objectiveOffensiveKillcount = 0;
1622 if (
self.challenge_offenderSentryTurretKillCount > 2 )
1624 self AddPlayerStat(
"multikill_3_attackers_ai_tank", 1 );
1625 self.challenge_offenderSentryTurretKillCount = 0;
1632 if (
self.challenge_offenderkillcount > 1 )
1634 self AddPlayerStat(
"double_kill_attackers", 1 );
1637 self.challenge_offenderkillcount = 0;
1639 if (
self.challenge_offenderProjectileMultiKillcount >= 2 )
1641 self AddPlayerStat(
"multikill_2_objective_scorestreak_projectile", 1 );
1644 self.challenge_offenderProjectileMultiKillcount = 0;
1649 self endon(
"disconnect" );
1650 self AddPlayerStatWithGameType(
"offends", 1 );
1652 if ( !isdefined(
self.challenge_objectiveDefensive ) ||
self.challenge_objectiveDefensive != objective )
1654 self.challenge_objectiveDefensiveKillcount = 0;
1657 self.challenge_objectiveDefensiveKillcount++;
1658 self.challenge_ObjectiveDefensive = objective;
1661 self.challenge_defenderkillcount++;
1667 if (
self.challenge_defenderkillcount > 1 )
1669 self AddPlayerStat(
"double_kill_defenders", 1 );
1672 self.challenge_defenderkillcount = 0;
1677 self endon(
"death" );
1683 if ( level.gameType ==
"dm" )
1685 self AddPlayerStat(
"killstreak_30_no_scorestreaks", 1 );
1691 if ( isdefined(
self.heroAbility ) &&
self.pers[
"canSetSpecialistStat"] )
1693 switch(
self.heroAbility.name )
1696 case "gadget_armor":
1697 case "gadget_clone":
1698 case "gadget_speed_burst":
1699 case "gadget_vision_pulse":
1700 case "gadget_flashback":
1701 case "gadget_heat_wave":
1711 self endon (
"death");
1712 self endon (
"disconnect");
1716 self AddPlayerStat(
"death_dodger", 1 );
1723 if ( isdefined( empOwner ) && IsPlayer( empOwner ) )
1725 empOwner AddPlayerStat(
"end_enemy_specialist_ability_with_emp", 1 );
1729 if ( isdefined(
self.empStartTime ) &&
self.empStartTime > ( getTime() - 100 ) )
1731 if ( isdefined(
self.empedBy) && IsPlayer(
self.empedBy ) )
1733 self.empedBy AddPlayerStat(
"end_enemy_specialist_ability_with_emp", 1 );
1743 self.challenge_offenderComlinkKillcount = 0;
1749 if ( !isdefined( eAttacker.challenge_combatRobotAttackClientID[combatRobotOwner.clientid] ) )
1751 eAttacker.challenge_combatRobotAttackClientID[combatRobotOwner.clientid] = spawnstruct();
1758 if ( level.activePlayerEMPs[
self.entNum ] > 0 )
1760 self AddWeaponStat( GetWeapon(
"emp" ),
"kills_while_active", 1 );
1763 if ( ( level.activePlayerUAVs[
self.entNum ] > 0 ) && ( !isdefined( level.forceradar ) || level.forceRadar ==
false ) )
1765 self AddWeaponStat( GetWeapon(
"uav" ),
"kills_while_active", 1 );
1768 if ( level.activePlayerSatellites[
self.entNum ] > 0 )
1770 self AddWeaponStat( GetWeapon(
"satellite" ),
"kills_while_active", 1 );
1773 if ( level.activePlayerCounterUAVs[
self.entNum ] > 0 )
1775 self AddWeaponStat( GetWeapon(
"counteruav" ),
"kills_while_active", 1 );
1778 if ( isdefined( victim.lastMicrowavedBy ) && victim.lastMicrowavedBy ==
self )
1780 self AddWeaponStat( GetWeapon(
"microwave_turret" ),
"kills_while_active", 1 );
1786 self endon(
"disconnect");
1787 self endon(
"killMonitorReloads");
1791 self waittill(
"reload");
1792 currentWeapon =
self getCurrentWeapon();
1793 if ( currentWeapon == level.weaponNone )
1799 self.lastReloadTime = time;
1801 if ( WeaponHasAttachment( currentWeapon,
"fastreload" ) )
1803 self.lastFastReloadTime = time;
1810 self notify(
"grenadeTrackingStart" );
1812 self endon(
"grenadeTrackingStart" );
1813 self endon(
"disconnect" );
1817 self waittill (
"grenade_fire", grenade, weapon );
1819 if ( !isdefined( grenade ) )
1824 if ( weapon.rootweapon.name ==
"hatchet" )
1826 self.challenge_hatchetTossCount++;
1827 grenade.challenge_hatchetTossCount =
self.challenge_hatchetTossCount;
1829 if (
self issprinting() )
1831 grenade.ownerWasSprinting =
true;
1838 self endon(
"death" );
1839 self endon(
"disconnect" );
1840 self endon(
"joined_team" );
1841 self endon(
"joined_spectators" );
1845 self.heroWeaponKillsThisActivation = 0;
1847 self waittill(
"weapon_change_complete" );
1853 self AddWeaponStat( weapon,
"longshot_kill", 1 );
1854 if (
self weaponHasAttachmentAndUnlocked( weapon,
"extbarrel",
"suppressed" ) )
1856 if (
self GetWeaponOptic( weapon ) !=
"" )
1858 self addPlayerStat(
"long_shot_longbarrel_suppressor_optic", 1 );
1868 self AddPlayerStat(
"capture_objective_tactician", 1 );
1875 player endon(
"death" );
1876 player endon(
"disconnect" );
1877 player endon(
"joined_team" );
1878 player endon(
"joined_spectators" );
1880 self.wallRanTwoOppositeWallsNoGround =
false;
1884 if ( !player IsWallRunning() )
1886 self.wallRanTwoOppositeWallsNoGround =
false;
1887 player waittill(
"wallrun_begin" );
1891 if ( ret ==
"wallrun_end" )
1894 wall_normal = player GetWallRunWallNormal();
1896 player waittill(
"jump_end" );
1898 if ( !player IsWallRunning() )
1901 last_wall_normal = wall_normal;
1902 wall_normal = player GetWallRunWallNormal();
1904 opposite_walls = ( VectorDot( wall_normal, last_wall_normal ) < -0.5 );
1905 if ( !opposite_walls )
1908 player.wallRanTwoOppositeWallsNoGround =
true;
1910 while ( player IsWallRunning() )
1914 if ( ret ==
"wallrun_end" )
1920 while ( !player IsOnGround() )
1929 if (
self.pers[
"canSetSpecialistStat"] )
1931 self AddSpecialistStat( statName, 1 );
1938 if ( weapon.name ==
"claymore" )
1940 self.flakJacketClaymore[ attacker.clientid ] =
true;
1943 self AddPlayerStat(
"survive_with_flak", 1 );
1944 self.challenge_lastsurvivewithflakfrom = attacker;
1945 self.challenge_lastsurvivewithflaktime = getTime();