1 #using scripts\codescripts\struct;
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\challenges_shared;
5 #using scripts\shared\killstreaks_shared;
6 #using scripts\shared\rank_shared;
7 #using scripts\shared\scoreevents_shared;
8 #using scripts\shared\system_shared;
9 #using scripts\shared\util_shared;
10 #using scripts\shared\abilities\_ability_player;
11 #using scripts\shared\weapons\_weapon_utils;
13 #insert scripts\shared\abilities\gadgets\_gadget_vision_pulse.gsh;
14 #insert scripts\shared\shared.gsh;
16 #using scripts\mp\gametypes\_globallogic_score;
18 #using scripts\mp\_challenges;
19 #using scripts\mp\_util;
20 #using scripts\mp\killstreaks\_killstreaks;
21 #using scripts\mp\_teamops;
23 #insert scripts\shared\scoreevents_shared.gsh;
25 #namespace scoreevents;
36 level.scoreEventCallbacks = [];
53 if ( !isdefined( level.scoreEventCallbacks[
callback] ) )
55 level.scoreEventCallbacks[
callback] = [];
57 level.scoreEventCallbacks[
callback][level.scoreEventCallbacks[
callback].size] = func;
63 attacker = data.attacker;
66 attacker.lastKilledPlayer = victim;
67 wasDefusing = data.wasDefusing;
68 wasPlanting = data.wasPlanting;
69 victimWasOnGround = data.victimOnGround;
70 attackerWasOnGround = data.attackerOnGround;
71 meansOfDeath = data.sMeansOfDeath;
72 attackerTraversing = data.attackerTraversing;
73 attackerWallRunning = data.attackerWallRunning;
74 attackerDoubleJumping = data.attackerDoubleJumping;
75 attackerSliding = data.attackerSliding;
76 victimWasWallRunning = data.victimWasWallRunning;
77 victimWasDoubleJumping = data.victimWasDoubleJumping;
78 attackerSpeedburst = data.attackerSpeedburst;
79 victimSpeedburst = data.victimSpeedburst;
80 victimCombatEfficieny = data.victimCombatEfficieny;
81 attackerflashbackTime = data.attackerflashbackTime;
82 victimflashbackTime = data.victimflashbackTime;
83 victimSpeedburstLastOnTime = data.victimSpeedburstLastOnTime;
84 victimCombatEfficiencyLastOnTime = data.victimCombatEfficiencyLastOnTime;
85 victimVisionPulseActivateTime = data.victimVisionPulseActivateTime;
86 attackerVisionPulseActivateTime = data.attackerVisionPulseActivateTime;
87 victimVisionPulseActivateTime = data.victimVisionPulseActivateTime;
88 attackerVisionPulseArray = data.attackerVisionPulseArray;
89 victimVisionPulseArray = data.victimVisionPulseArray;
90 attackerVisionPulseOriginArray = data.attackerVisionPulseOriginArray;
91 victimVisionPulseOriginArray = data.victimVisionPulseOriginArray;
92 attackerVisionPulseOrigin = data.attackerVisionPulseOrigin;
93 victimVisionPulseOrigin = data.victimVisionPulseOrigin;
94 attackerWasFlashed = data.attackerWasFlashed;
95 attackerWasConcussed = data.attackerWasConcussed;
96 victimWasUnderwater = data.wasUnderwater;
97 victimHeroAbilityActive = data.victimHeroAbilityActive;
98 victimHeroAbility = data.victimHeroAbility;
99 attackerHeroAbilityActive = data.attackerHeroAbilityActive;
100 attackerHeroAbility = data.attackerHeroAbility;
101 attackerWasHeatWaveStunned = data.attackerWasHeatWaveStunned;
102 victimWasHeatWaveStunned = data.victimWasHeatWaveStunned;
103 victimElectrifiedBy = data.victimElectrifiedBy;
104 victimWasInSlamState = data.victimWasInSlamState;
105 victimBledOut = data.bledOut;
106 victimWasLungingWithArmBlades = data.victimWasLungingWithArmBlades;
107 victimPowerArmorLastTookDamageTime = data.victimPowerArmorLastTookDamageTime;
108 victimHeroWeaponKillsThisActivation = data.victimHeroWeaponKillsThisActivation;
109 victimGadgetPower = data.victimGadgetPower;
110 victimGadgetWasActiveLastDamage = ( data.victimGadgetWasActiveLastDamage === true );
111 victimIsThiefOrRoulette = data.victimIsThiefOrRoulette;
112 attackerIsRoulette = data.attackerIsRoulette;
113 victimHeroAbilityName = data.victimHeroAbilityName;
114 attackerInVehicleArchetype = data.attackerInVehicleArchetype;
115 if ( isdefined( victimHeroAbilityName ) )
116 victimHeroAbilityEquipped = GetWeapon( victimHeroAbilityName );
118 if ( victimBledOut ==
true )
121 exlosiveDamage =
false;
122 attackerShotVictim = ( meansOfDeath ==
"MOD_PISTOL_BULLET" || meansOfDeath ==
"MOD_RIFLE_BULLET" || meansOfDeath ==
"MOD_HEAD_SHOT" );
124 weapon = level.weaponNone;
125 inflictor = data.eInflictor;
127 if ( isdefined( data.weapon ) )
129 weapon = data.weapon;
131 isGrenade = weapon.isGrenadeWeapon;
135 victim.anglesOnDeath = victim getPlayerAngles();
137 if ( meansOfDeath ==
"MOD_GRENADE" || meansOfDeath ==
"MOD_GRENADE_SPLASH" || meansOfDeath ==
"MOD_EXPLOSIVE" || meansOfDeath ==
"MOD_EXPLOSIVE_SPLASH" || meansOfDeath ==
"MOD_PROJECTILE" || meansOfDeath ==
"MOD_PROJECTILE_SPLASH" )
139 if ( weapon == level.weaponNone && isdefined( data.victim.explosiveInfo[
"weapon"] ) )
140 weapon = data.victim.explosiveInfo[
"weapon"];
142 exlosiveDamage =
true;
146 if ( !isdefined( killstreak ) )
148 if ( level.teamBased )
150 if ( isdefined( victim.lastKillTime ) && ( victim.lastKillTime > time - 3000 ) )
152 if ( isdefined( victim.lastkilledplayer ) && victim.lastkilledplayer
util::IsEnemyPlayer( attacker ) ==
false && attacker != victim.lastkilledplayer )
155 victim RecordKillModifier(
"avenger");
159 if ( isdefined( victim.damagedPlayers ) )
161 keys = getarraykeys(victim.damagedPlayers);
163 for ( i = 0; i < keys.size; i++ )
166 if ( key == attacker.clientid )
169 if ( !isdefined( victim.damagedPlayers[key].entity ) )
175 if ( ( time - victim.damagedPlayers[key].time ) < 1000 )
178 if ( isdefined( victim.damagedPlayers[key].entity ) )
180 victim.damagedPlayers[key].entity.lastRescuedBy = attacker;
181 victim.damagedPlayers[key].entity.lastRescuedTime = time;
183 victim RecordKillModifier(
"defender");
189 if ( isGrenade ==
false || ( weapon.name ==
"hero_gravityspikes" ) )
191 if ( victimWasDoubleJumping ==
true )
193 if ( attackerDoubleJumping ==
true )
199 attacker addPlayerStat(
"kill_enemy_that_in_air", 1 );
202 if ( attackerDoubleJumping ==
true )
205 attacker addPlayerStat(
"kill_while_in_air", 1 );
208 if ( victimWasWallRunning ==
true )
211 attacker addPlayerStat(
"kill_enemy_thats_wallrunning", 1 );
214 if ( attackerWallRunning ==
true )
217 attacker addPlayerStat(
"kill_while_wallrunning", 1 );
220 if ( attackerSliding ==
true )
223 attacker addPlayerStat(
"kill_while_sliding", 1 );
226 if ( attackerTraversing ==
true )
229 attacker addPlayerStat(
"kill_while_mantling", 1 );
232 if ( attackerWasFlashed )
237 if ( attackerWasConcussed )
242 if ( attackerWasHeatWaveStunned )
248 if ( victimWasHeatWaveStunned )
250 if ( isdefined( victim._heat_wave_stunned_by ) &&
251 isdefined( victim._heat_wave_stunned_by[attacker.clientid] ) &&
252 victim._heat_wave_stunned_by[attacker.clientid] >= time )
260 if ( attackerIsRoulette && !victimIsThiefOrRoulette && victimHeroAbilityName ===
"gadget_heat_wave" )
267 if ( attackerSpeedburst ==
true )
274 if ( attackerIsRoulette && !victimIsThiefOrRoulette && victimHeroAbilityName ===
"gadget_speed_burst" )
280 if ( victimSpeedburstLastOnTime > time - 50 )
286 if ( victimCombatEfficiencyLastOnTime > time - 50 )
292 if ( attackerflashbackTime != 0 && attackerflashbackTime > time - 4000 )
299 if ( attackerIsRoulette && !victimIsThiefOrRoulette && victimHeroAbilityName ===
"gadget_flashback" )
305 if ( victimflashbackTime != 0 && victimflashbackTime > time - 4000 )
311 if ( victimWasInSlamState )
322 if ( victimWasUnderwater && exlosiveDamage )
327 if ( isdefined ( victimElectrifiedBy ) && victimElectrifiedBy != attacker )
332 if ( victimVisionPulseActivateTime != 0 && victimVisionPulseActivateTime > time - 4000 )
334 gadgetWeapon = getWeapon(
"gadget_vision_pulse");
335 for ( i = 0; i < victimVisionPulseArray.size; i++ )
337 player = victimVisionPulseArray[i];
338 if ( player == attacker )
340 gadget = GetWeapon(
"gadget_vision_pulse" );
342 if ( victimVisionPulseActivateTime + 300 > time - gadgetWeapon.gadget_pulse_duration )
344 distanceToPulse = distance( victimVisionPulseOriginArray[i], victimVisionPulseOrigin );
346 ratio = distanceToPulse / gadgetWeapon.gadget_pulse_max_range;
347 timing = ratio * gadgetWeapon.gadget_pulse_duration;
348 if ( victimVisionPulseActivateTime + 300 > time - timing )
360 if ( isdefined( victimHeroAbility ) )
362 attacker notify(
"hero_shutdown", victimHeroAbility );
363 attacker notify(
"hero_shutdown_gadget", victimHeroAbility, victim );
369 gadgetWeapon = getWeapon(
"gadget_vision_pulse");
370 for ( i = 0; i < attackerVisionPulseArray.size; i++ )
372 player = attackerVisionPulseArray[i];
373 if ( player == victim )
375 gadget = GetWeapon(
"gadget_vision_pulse" );
377 if ( attackerVisionPulseActivateTime > time - gadgetWeapon.gadget_pulse_duration )
379 distanceToPulse = distance( attackerVisionPulseOriginArray[i], attackerVisionPulseOrigin );
381 ratio = distanceToPulse / gadgetWeapon.gadget_pulse_max_range;
382 timing = ratio * gadgetWeapon.gadget_pulse_duration;
383 if ( attackerVisionPulseActivateTime > time - timing )
394 if ( attackerIsRoulette && !victimIsThiefOrRoulette && victimHeroAbilityName ===
"gadget_vision_pulse" )
403 if ( victimHeroAbilityActive && isdefined ( victimHeroAbility ) )
405 attacker notify(
"hero_shutdown", victimHeroAbility );
406 attacker notify(
"hero_shutdown_gadget", victimHeroAbility, victim );
408 switch( victimHeroAbility.name )
414 case "gadget_resurrect":
419 processScoreEvent(
"kill_enemy_that_is_using_optic_camo", attacker, victim, weapon );
430 if ( isdefined( victimPowerArmorLastTookDamageTime ) && ( time - victimPowerArmorLastTookDamageTime <= 3000 ) )
432 attacker notify(
"hero_shutdown", victimHeroAbility );
433 attacker notify(
"hero_shutdown_gadget", victimHeroAbility, victim );
440 if ( isdefined( data.victimWeapon ) && isdefined( data.victimWeapon.isHeroWeapon ) && data.victimWeapon.isHeroWeapon ==
true )
442 attacker notify(
"hero_shutdown", data.victimWeapon );
443 attacker notify(
"hero_shutdown_gadget", data.victimWeapon, victim );
445 else if ( isdefined( victim.heroWeapon ) && victimGadgetWasActiveLastDamage && victimGadgetPower < 100 )
448 attacker notify(
"hero_shutdown", victim.heroWeapon );
449 attacker notify(
"hero_shutdown_gadget", victim.heroWeapon, victim );
452 if ( attackerHeroAbilityActive && isdefined ( attackerHeroAbility ) )
454 abilityToCheck = undefined;
456 switch( attackerHeroAbility.name )
464 abilityToCheck = attackerHeroAbility.name;
467 case "gadget_resurrect":
473 abilityToCheck = attackerHeroAbility.name;
482 abilityToCheck = attackerHeroAbility.name;
491 abilityToCheck = attackerHeroAbility.name;
496 if ( attackerIsRoulette && !victimIsThiefOrRoulette && isdefined( abilityToCheck ) && victimHeroAbilityName === abilityToCheck )
502 if ( victimWasLungingWithArmBlades )
507 if ( isdefined( data.victimWeapon ) )
509 killedHeroWeaponEnemy( attacker, victim, weapon, data.victimWeapon, victimGadgetPower, victimGadgetWasActiveLastDamage );
511 if ( data.victimWeapon.name ==
"minigun" )
515 else if ( data.victimWeapon.name ==
"m32" )
517 processScoreEvent(
"killed_multiple_grenade_launcher_enemy", attacker, victim, weapon );
521 is_hero_armblade_and_active = ( isdefined( victim.heroweapon ) && victim.heroweapon.name ==
"hero_armblade" && victimGadgetWasActiveLastDamage );
523 if ( ( data.victimWeapon.inventorytype ==
"hero" || is_hero_armblade_and_active ) && victimGadgetPower < 100 )
525 if ( victimHeroWeaponKillsThisActivation == 0 )
527 attacker AddPlayerStat(
"kill_before_specialist_weapon_use", 1 );
530 if ( weapon.inventorytype ==
"hero" )
532 attacker AddPlayerStat(
"kill_specialist_with_specialist", 1 );
536 attacker_is_thief = ( isdefined( attacker.heroweapon ) && attacker.heroweapon.name ==
"gadget_thief" );
537 if ( !attacker_is_thief )
544 if ( weapon.rootweapon.name ==
"frag_grenade" )
549 attacker thread updateMultiKills( weapon, weaponClass, killstreak, victim );
551 if ( level.numKills == 1 )
553 victim RecordKillModifier(
"firstblood");
558 if ( isdefined( attacker.lastKilledBy ) )
560 if ( attacker.lastKilledBy == victim )
562 level.globalPaybacks++;
564 attacker AddWeaponStat( weapon,
"revenge_kill", 1 );
565 victim RecordKillModifier(
"revenge");
566 attacker.lastKilledBy = undefined;
571 level.globalBuzzKills++;
573 victim RecordKillModifier(
"buzzkill");
575 if ( isdefined( victim.lastManSD ) && victim.lastManSD ==
true )
578 if ( isdefined( attacker.lastManSD ) && attacker.lastManSD ==
true )
587 if ( isdefined( victim.vAttackerOrigin ) )
588 attackerOrigin = victim.vAttackerOrigin;
590 attackerOrigin = attacker.origin;
591 distToVictim = distanceSquared( victim.origin, attackerOrigin );
593 if ( distToVictim > weap_min_dmg_range )
596 if ( weapon.rootweapon.name ==
"hatchet" )
601 attacker.pers[
"longshots"]++;
602 attacker.longshots = attacker.pers[
"longshots"];
603 victim RecordKillModifier(
"longshot");
607 killdistance = distance( victim.origin, attackerOrigin );
608 attacker.pers[
"kill_distances"] += killdistance;
609 attacker.pers[
"num_kill_distance_entries"]++;
612 if ( isAlive( attacker ) )
614 if ( attacker.health < ( attacker.maxHealth * 0.35 ) )
616 attacker.lastKillWhenInjured = time;
619 attacker AddWeaponStat( weapon,
"kill_enemy_when_injured", 1 );
622 attacker AddPlayerStat(
"perk_bulletflinch_kills", 1 );
628 if ( isdefined( attacker.deathtime ) && ( ( attacker.deathtime + 800 ) < time ) && !attacker IsInVehicle() )
630 level.globalAfterlifes++;
632 victim RecordKillModifier(
"posthumous");
636 if( attacker.cur_death_streak >= SCORE_EVENT_DEATH_STREAK_COUNT_REQUIRED )
638 level.globalComebacks++;
640 victim RecordKillModifier(
"comeback");
643 if ( isdefined( victim.lastMicrowavedBy ) )
645 foreach( beingMicrowavedBy
in victim.beingMicrowavedBy )
647 if ( isdefined( beingMicrowavedBy ) && ( attacker
util::IsEnemyPlayer( beingMicrowavedBy ) ==
false ) )
649 if ( beingMicrowavedBy != attacker )
651 scoreGiven =
processScoreEvent(
"microwave_turret_assist", beingMicrowavedBy, victim, weapon );
652 if ( isdefined ( scoreGiven ) )
659 attackerMicrowavedVictim =
true;
664 if ( attackerMicrowavedVictim ===
true && weapon.name !=
"microwave_turret" )
673 attacker.pers[
"stabs"]++;
674 attacker.stabs = attacker.pers[
"stabs"];
676 if ( meansOfDeath ==
"MOD_MELEE_WEAPON_BUTT" && weapon.name !=
"ball" )
686 vAngles = victim.anglesOnDeath[1];
687 pAngles = attacker.anglesOnKill[1];
688 angleDiff = AngleClamp180( vAngles - pAngles );
690 if ( angleDiff > -30 && angleDiff < 70 )
692 level.globalBackstabs++;
695 weaponPickedUp =
false;
696 if( isdefined( attacker.pickedUpWeapons ) && isdefined( attacker.pickedUpWeapons[weapon] ) )
698 weaponPickedUp =
true;
701 attacker AddWeaponStat( weapon,
"backstabber_kill", 1, attacker.class_num, weaponPickedUp, undefined, attacker.primaryLoadoutGunSmithVariantIndex, attacker.secondaryLoadoutGunSmithVariantIndex );
702 attacker.pers[
"backstabs"]++;
703 attacker.backstabs = attacker.pers[
"backstabs"];
709 if ( isdefined ( victim.firstTimeDamaged ) && victim.firstTimeDamaged == time && !
IS_TRUE( weapon.isHeroWeapon ) )
711 if ( attackerShotVictim )
713 attacker thread updateOneShotMultiKills( victim, weapon, victim.firstTimeDamaged );
714 attacker AddWeaponStat( weapon,
"kill_enemy_one_bullet", 1 );
719 if ( isdefined( attacker.tookWeaponFrom[ weapon ] ) && isdefined( attacker.tookWeaponFrom[ weapon ].previousOwner ) )
721 pickedUpWeapon = attacker.tookWeaponFrom[ weapon ];
722 if ( pickedUpWeapon.previousOwner == victim )
725 attacker AddWeaponStat( weapon,
"kill_enemy_with_their_weapon", 1 );
726 if ( isdefined( pickedUpWeapon.sWeapon ) && isdefined( pickedUpWeapon.sMeansOfDeath ) &&
weapon_utils::isMeleeMOD( pickedUpWeapon.sMeansOfDeath ) )
728 foreach( meleeWeapon
in level.meleeWeapons )
730 if ( weapon != meleeWeapon && pickedUpWeapon.sWeapon.rootweapon == meleeWeapon )
732 attacker AddWeaponStat( meleeWeapon,
"kill_enemy_with_their_weapon", 1 );
744 else if ( wasPlanting )
755 if( isdefined( level.vtol ) && isdefined( level.vtol.owner ) && ( weapon.name ==
"helicopter_gunner_turret_secondary" || weapon.name ==
"helicopter_gunner_turret_tertiary" ) )
757 attacker addplayerstat(
"kill_as_support_gunner", 1 );
762 if ( isdefined( attackerInVehicleArchetype ) )
764 if ( attackerInVehicleArchetype ==
"siegebot" )
766 if ( meansOfDeath ==
"MOD_CRUSH" )
771 DEFAULT( attacker.siegebot_kills, 0 );
773 attacker.siegebot_kills++;
775 if ( attacker.siegebot_kills % 5 == 0 )
782 switch ( weapon.rootweapon.name )
786 attacker.pers[
"tomahawks"]++;
787 attacker.tomahawks = attacker.pers[
"tomahawks"];
791 if ( isdefined( data.victim.explosiveInfo[
"projectile_bounced"] ) && data.victim.explosiveInfo[
"projectile_bounced"] ==
true )
793 level.globalBankshots++;
800 case "inventory_supplydrop":
801 case "supplydrop_marker":
802 case "inventory_supplydrop_marker":
804 if ( meansOfDeath ==
"MOD_HIT_BY_OBJECT" || meansOfDeath ==
"MOD_CRUSH" )
810 processScoreEvent(
"kill_enemy_with_hacked_care_package", attacker, victim, weapon );
817 if( isdefined( killstreak ) )
819 attacker thread updateMultiKills( weapon, weaponClass, killstreak, victim );
821 victim RecordKillModifier(
"killstreak");
824 attacker.cur_death_streak = 0;
825 attacker disabledeathstreak();
830 if ( !isdefined( ability_name ) )
833 return GetWeapon( ability_name );
838 if ( !isdefined( weapon ) )
843 if ( isdefined( weapon.isHeroWeapon ) && !weapon.isHeroWeapon )
848 switch( weapon.name )
851 case "hero_minigun_body3":
852 event =
"minigun_kill";
854 case "hero_flamethrower":
855 event =
"flamethrower_kill";
857 case "hero_lightninggun":
858 case "hero_lightninggun_arc":
859 event =
"lightninggun_kill";
861 case "hero_chemicalgelgun":
862 case "hero_firefly_swarm":
863 event =
"gelgun_kill";
865 case "hero_pineapplegun":
866 case "hero_pineapple_grenade":
867 event =
"pineapple_kill";
869 case "hero_armblade":
870 event =
"armblades_kill";
872 case "hero_bowlauncher":
873 case "hero_bowlauncher2":
874 case "hero_bowlauncher3":
875 case "hero_bowlauncher4":
876 event =
"bowlauncher_kill";
878 case "hero_gravityspikes":
879 event =
"gravityspikes_kill";
881 case "hero_annihilator":
882 event =
"annihilator_kill";
891 function killedHeroWeaponEnemy( attacker, victim, weapon, victim_weapon, victim_gadget_power, victimGadgetWasActiveLastDamage )
893 if ( !isdefined( victim_weapon ) )
898 if ( victim_gadget_power >= 100 )
901 switch( victim_weapon.name )
904 case "hero_minigun_body3":
905 event =
"killed_minigun_enemy";
907 case "hero_flamethrower":
908 event =
"killed_flamethrower_enemy";
910 case "hero_lightninggun":
911 case "hero_lightninggun_arc":
912 event =
"killed_lightninggun_enemy";
914 case "hero_chemicalgelgun":
915 event =
"killed_gelgun_enemy";
917 case "hero_pineapplegun":
918 event =
"killed_pineapple_enemy";
920 case "hero_bowlauncher":
921 case "hero_bowlauncher2":
922 case "hero_bowlauncher3":
923 case "hero_bowlauncher4":
924 event =
"killed_bowlauncher_enemy";
926 case "hero_gravityspikes":
927 event =
"killed_gravityspikes_enemy";
929 case "hero_annihilator":
930 event =
"killed_annihilator_enemy";
934 if ( isdefined( victim.heroWeapon ) && victim.heroWeapon.name ==
"hero_armblade" && victimGadgetWasActiveLastDamage )
936 event =
"killed_armblades_enemy";
950 switchWeapon = weapon.name;
952 if( isdefined( killstreak ) )
954 switchWeapon = killstreak;
956 switch( switchWeapon )
958 case "remote_missile":
959 case "inventory_remote_missile":
960 event =
"remote_missile_kill";
963 case "inventory_autoturret":
964 event =
"sentry_gun_kill";
967 case "inventory_planemortar":
968 event =
"plane_mortar_kill";
971 case "inventory_ai_tank_drop":
972 event =
"aitank_kill";
973 if ( isdefined( inflictor ) && isdefined( inflictor.controlled ) )
975 if ( inflictor.controlled ==
true )
977 attacker addPlayerStat(
"kill_with_controlled_ai_tank", 1 );
981 case "microwave_turret":
982 case "inventory_microwave_turret":
983 case "microwaveturret":
984 case "inventory_microwaveturret":
985 event =
"microwave_turret_kill";
988 case "inventory_raps":
992 case "inventory_sentinel":
994 event =
"sentinel_kill";
995 if ( isdefined( inflictor ) && isdefined( inflictor.controlled ) )
997 if ( inflictor.controlled ==
true )
999 attacker addPlayerStat(
"kill_with_controlled_sentinel", 1 );
1004 case "combat_robot":
1005 case "inventory_combat_robot":
1006 event =
"combat_robot_kill";
1009 case "inventory_rcbomb":
1010 event =
"hover_rcxd_kill";
1012 case "helicopter_gunner":
1013 case "helicopter_gunner_assistant":
1014 case "inventory_helicopter_gunner":
1015 case "inventory_helicopter_gunner_assistant":
1016 event =
"vtol_mothership_kill";
1018 case "helicopter_comlink":
1019 case "inventory_helicopter_comlink":
1020 event =
"helicopter_comlink_kill";
1022 case "drone_strike":
1023 case "inventory_drone_strike":
1024 event =
"drone_strike_kill";
1027 case "inventory_dart":
1029 event =
"dart_kill";
1035 if ( isdefined( inflictor ) )
1037 if ( isdefined( inflictor.killstreak_id ) && isdefined( level.matchRecorderKillstreakKills[inflictor.killstreak_id] ) )
1039 level.matchRecorderKillstreakKills[inflictor.killstreak_id]++;
1041 else if ( isdefined( inflictor.killcament ) && isdefined( inflictor.killcament.killstreak_id ) && isdefined( level.matchRecorderKillstreakKills[inflictor.killcament.killstreak_id] ) )
1043 level.matchRecorderKillstreakKills[inflictor.killcament.killstreak_id]++;
1052 assert( killCount > 1 );
1056 if ( killCount > 8 )
1065 if ( killCount > 2 )
1067 if ( isdefined(
self.challenge_objectiveDefensiveKillcount ) &&
self.challenge_objectiveDefensiveKillcount > 0 )
1069 self.challenge_objectiveDefensiveTripleKillMedalOrBetterEarned =
true;
1073 self RecordMultiKill( killCount );
1078 if ( killcount > 1 )
1080 self addPlayerStat(
"multikill_2_with_heroability",
int( killCount / 2 ) );
1081 self AddWeaponStat( weapon,
"heroability_doublekill",
int( killCount / 2 ) );
1082 self addPlayerStat(
"multikill_3_with_heroability",
int( killCount / 3 ) );
1083 self AddWeaponStat( weapon,
"heroability_triplekill",
int( killCount / 3 ) );
1089 valid_weapon =
false;
1091 if ( isdefined( killstreak ) )
1092 valid_weapon =
false;
1094 valid_weapon =
false;
1095 else if ( meansOfDeath ==
"MOD_PISTOL_BULLET" || meansOfDeath ==
"MOD_RIFLE_BULLET" )
1096 valid_weapon =
true;
1097 else if ( meansOfDeath ==
"MOD_HEAD_SHOT" )
1098 valid_weapon =
true;
1099 else if ( weapon.rootweapon.name ==
"hatchet" && meansOfDeath ==
"MOD_IMPACT" )
1100 valid_weapon =
true;
1104 if ( baseWeapon == level.weaponSpecialCrossbow && meansOfDeath ==
"MOD_IMPACT" )
1105 valid_weapon =
true;
1106 else if ( baseWeapon == level.weaponBallisticKnife && meansOfDeath ==
"MOD_IMPACT" )
1107 valid_weapon =
true;
1108 else if ( ( baseWeapon.forceDamageHitLocation || baseWeapon == level.weaponShotgunEnergy || baseWeapon == level.weaponSpecialDiscGun ) && meansofDeath ==
"MOD_PROJECTILE" )
1109 valid_weapon =
true;
1112 return valid_weapon;
1118 self endon (
"disconnect" );
1119 level endon (
"game_ended" );
1121 self notify (
"updateSingleFragMultiKill" );
1122 self endon (
"updateSingleFragMultiKill" );
1124 if ( !isdefined (
self.recent_SingleFragMultiKill) ||
self.recent_SingleFragMultiKillID != victim.explosiveinfo[
"damageid"] )
1125 self.recent_SingleFragMultiKill = 0;
1127 self.recent_SingleFragMultiKillID = victim.explosiveinfo[
"damageid"];
1128 self.recent_SingleFragMultiKill++;
1132 if (
self.recent_SingleFragMultiKill >= 2 )
1137 self.recent_SingleFragMultiKill = 0;
1142 self endon (
"disconnect" );
1143 level endon (
"game_ended" );
1145 self notify (
"updateRecentKills" );
1146 self endon (
"updateRecentKills" );
1148 baseWeaponParam = [[ level.get_base_weapon_param ]]( weapon );
1149 baseWeapon = GetWeapon( GetRefFromItemIndex( GetBaseWeaponItemIndex( baseWeaponParam ) ) );
1151 if ( !isdefined(
self.recentKillVariables ) )
1156 if ( !isdefined(
self.recentKillCountWeapon ) ||
self.recentKillCountWeapon != baseWeapon )
1158 self.recentKillCountSameWeapon = 0;
1159 self.recentKillCountWeapon = baseWeapon;
1162 if (!isdefined(killstreak))
1164 self.recentKillCountSameWeapon++;
1165 self.recentKillCount++;
1168 if ( isdefined( weaponClass ) )
1170 if ( weaponClass ==
"weapon_lmg" || weaponClass ==
"weapon_smg" )
1172 if (
self PlayerAds() < 1.0 )
1174 self.recent_LMG_SMG_KillCount++;
1177 if ( weaponClass ==
"weapon_grenade" )
1179 self.recentLethalCount++;
1183 if ( weapon.name ==
"satchel_charge" )
1185 self.recentC4KillCount++;
1188 if ( isdefined( level.killstreakWeapons ) && isdefined( level.killstreakWeapons[weapon] ) )
1190 switch( level.killstreakWeapons[weapon] )
1192 case "remote_missile":
1193 case "inventory_remote_missile":
1195 self.recentRemoteMissileCount++;
1199 case "inventory_rcbomb":
1201 self.recentRCBombCount++;
1208 if ( isdefined( weapon.isHeroWeapon ) && weapon.isHeroWeapon ==
true )
1210 self.recentHeroKill = getTime();
1211 self.recentHeroWeaponKillCount++;
1212 if ( isdefined( victim ) )
1214 self.recentHeroWeaponVictims[ victim GetEntityNumber() ] = victim;
1216 switch( weapon.name )
1218 case "hero_annihilator":
1219 self.recentAnihilatorCount++;
1221 case "hero_minigun":
1222 case "hero_minigun_body3":
1223 self.recentMiniGunCount++;
1225 case "hero_bowlauncher":
1226 case "hero_bowlauncher2":
1227 case "hero_bowlauncher3":
1228 case "hero_bowlauncher4":
1229 self.recentBowLauncherCount++;
1231 case "hero_flamethrower":
1232 self.recentFlameThrowerCount++;
1234 case "hero_gravityspikes":
1235 self.recentGravitySpikesCount++;
1237 case "hero_lightninggun":
1238 case "hero_lightninggun_arc":
1239 self.recentLightningGunCount++;
1241 case "hero_pineapplegun":
1242 case "hero_pineapple_grenade":
1243 self.recentPineappleGunCount++;
1245 case "hero_chemicalgun":
1246 case "hero_firefly_swarm":
1247 self.recentGelGunCount++;
1249 case "hero_armblade":
1250 self.recentArmBladeCount++;
1255 if ( isdefined(
self.heroAbility ) && isdefined( victim ) )
1259 if ( isdefined(
self.recentHeroAbilityKillWeapon ) &&
self.recentHeroAbilityKillWeapon !=
self.heroAbility )
1261 self.recentHeroAbilityKillCount = 0;
1263 self.recentHeroAbilityKillWeapon =
self.heroAbility;
1264 self.recentHeroAbilityKillCount++;
1268 if ( isdefined ( killstreak ) )
1270 switch( killstreak )
1272 case "remote_missile":
1273 self.recentRemoteMissileKillCount++;
1276 self.recentRCBombKillCount++;
1278 case "inventory_m32":
1280 self.recentMGLKillCount++;
1285 if (
self.recentKillCountSameWeapon == 2 )
1287 self AddWeaponStat( weapon,
"multikill_2", 1 );
1289 else if (
self.recentKillCountSameWeapon == 3 )
1291 self AddWeaponStat( weapon,
"multikill_3", 1 );
1296 if (
self.recent_LMG_SMG_KillCount >= 3 )
1299 if (
self.recentRCBombKillCount >= 2 )
1302 if (
self.recentMGLKillCount >= 3 )
1305 if (
self.recentRemoteMissileKillCount >= 3 )
1309 if (
self.recentHeroWeaponKillCount > 1 )
1314 if (
self.recentHeroWeaponKillCount > 5 )
1316 ArrayRemoveValue(
self.recentHeroWeaponVictims, undefined );
1317 if (
self.recentHeroWeaponVictims.size > 5 )
1319 self addPlayerStat(
"kill_entire_team_with_specialist_weapon", 1 );
1323 if (
self.recentAnihilatorCount >= 3 )
1328 else if (
self.recentAnihilatorCount == 2 )
1333 if (
self.recentMiniGunCount >= 3 )
1338 else if (
self.recentMiniGunCount == 2 )
1343 if (
self.recentBowLauncherCount >= 3 )
1348 else if (
self.recentBowLauncherCount == 2 )
1353 if (
self.recentFlameThrowerCount >= 3 )
1358 else if (
self.recentFlameThrowerCount == 2 )
1363 if (
self.recentGravitySpikesCount >= 3 )
1368 else if (
self.recentGravitySpikesCount == 2 )
1373 if (
self.recentLightningGunCount >= 3 )
1378 else if (
self.recentLightningGunCount == 2 )
1383 if (
self.recentPineappleGunCount >= 3 )
1388 else if (
self.recentPineappleGunCount == 2 )
1393 if (
self.recentGelGunCount >= 3 )
1398 else if (
self.recentGelGunCount == 2 )
1403 if (
self.recentArmBladeCount >= 3 )
1408 else if (
self.recentArmBladeCount == 2 )
1414 if (
self.recentC4KillCount >= 2 )
1418 if (
self.recentRemoteMissileCount >= 3 )
1420 self addPlayerStat(
"multikill_3_remote_missile", 1 );
1422 if (
self.recentRCBombCount >= 2 )
1424 self addPlayerStat(
"multikill_2_rcbomb", 1 );
1426 if (
self.recentLethalCount >= 2 )
1428 if ( !isdefined(
self.pers[
"challenge_kills_double_kill_lethal"] ) )
1430 self.pers[
"challenge_kills_double_kill_lethal"] = 0;
1433 self.pers[
"challenge_kills_double_kill_lethal"]++;
1434 if (
self.pers[
"challenge_kills_double_kill_lethal"] >= 3 )
1436 self addPlayerStat(
"kills_double_kill_3_lethal", 1 );
1440 if (
self.recentKillCount > 1 )
1441 self multiKill(
self.recentKillCount, weapon );
1443 if (
self.recentHeroAbilityKillCount > 1 )
1454 self.recent_LMG_SMG_KillCount = 0;
1455 self.recentAnihilatorCount = 0;
1456 self.recentArmBladeCount = 0;
1457 self.recentBowLauncherCount = 0;
1458 self.recentC4KillCount = 0;
1459 self.recentFlameThrowerCount = 0;
1460 self.recentGelGunCount = 0;
1461 self.recentGravitySpikesCount = 0;
1462 self.recentHeroAbilityKillCount = 0;
1463 self.recentHeroWeaponKillCount = 0;
1464 self.recentHeroWeaponVictims = [];
1465 self.recentKillCount = 0;
1466 self.recentKillCountSameWeapon = 0;
1467 self.recentKillCountWeapon = undefined;
1468 self.recentLethalCount = 0;
1469 self.recentLightningGunCount = 0;
1470 self.recentMGLKillCount = 0;
1471 self.recentMiniGunCount = 0;
1472 self.recentPineappleGunCount = 0;
1473 self.recentRCBombCount = 0;
1474 self.recentRCBombKillCount = 0;
1475 self.recentRemoteMissileCount = 0;
1476 self.recentRemoteMissileKillCount = 0;
1478 self.recentKillVariables =
true;
1483 self endon(
"death" );
1489 self endon(
"death" );
1490 self endon(
"disconnect" );
1491 self notify(
"updateoneshotmultikills" + firstTimeDamaged );
1492 self endon(
"updateoneshotmultikills" + firstTimeDamaged );
1493 if ( !isdefined(
self.oneshotmultikills ) || firstTimeDamaged >
VAL(
self.oneshotmultikillsdamagetime, 0 ) )
1495 self.oneshotmultikills = 0;
1498 self.oneshotmultikills++;
1499 self.oneshotmultikillsdamagetime = firstTimeDamaged;
1502 if (
self.oneshotmultikills > 1 )
1510 self.oneshotmultikills = 0;
1520 if( !isdefined( weaponClass ) )
1526 if ( weapon.rootweapon.name ==
"pistol_shotgun" )
1528 weaponClass =
"weapon_cqb";
1532 switch ( weaponClass )
1535 distance = 1500 * 1500;
1538 case "weapon_assault":
1539 distance = 1750 * 1750;
1543 distance = 1750 * 1750;
1546 case "weapon_sniper":
1547 distance = 2000 * 2000;
1550 case "weapon_pistol":
1551 distance = 1000 * 1000;
1555 distance = 550 * 550;
1559 case "weapon_special":
1562 if ( baseWeapon == level.weaponBallisticKnife || baseWeapon == level.weaponSpecialCrossbow || baseWeapon == level.weaponSpecialDiscGun )
1564 distance = 1500 * 1500;
1568 case "weapon_grenade":
1569 if ( weapon.rootweapon.name ==
"hatchet" )
1571 distance = 1500 * 1500;
1585 player = data.player;
1586 winner = data.winner;
1588 if ( isdefined( winner ) )
1590 if ( level.teambased )
1592 if ( winner !=
"tie" && player.team == winner )
1600 placement = level.placement[
"all"];
1601 topThreePlayers = min( 3, placement.size );
1603 for ( index = 0; index < topThreePlayers; index++ )
1605 if ( level.placement[
"all"][index] == player )
1619 if( level.rankedMatch )
1621 if ( !isdefined(
self.pers[
"specialistMedalAchievement"] ) )
1623 self.pers[
"specialistMedalAchievement"] = 0;
1625 self.pers[
"specialistMedalAchievement"]++;
1626 if (
self.pers[
"specialistMedalAchievement"] == 5 )
1628 self GiveAchievement(
"MP_SPECIALIST_MEDALS" );
1637 self endon (
"disconnect" );
1638 level endon (
"game_ended" );
1640 self notify (
"updatethread specialistStatAbilityUsage" );
1641 self endon (
"updatethread specialistStatAbilityUsage" );
1643 isRoulette = (
self.isRoulette === true );
1644 if ( isdefined(
self.heroAbility ) && !isRoulette )
1646 self addWeaponStat(
self.heroAbility,
"combatRecordStat", 1 );
1650 if ( !isdefined(
self.pers[
"specialistUsagePerGame"] ) )
1652 self.pers[
"specialistUsagePerGame"] = 0;
1654 self.pers[
"specialistUsagePerGame"]++;
1655 if (
self.pers[
"specialistUsagePerGame"] >= usageSingleGame )
1658 self.pers[
"specialistUsagePerGame"] = 0;
1661 if ( multiTrackPerLife )
1663 self.pers[
"specialistStatAbilityUsage"]++;
1664 if (
self.pers[
"specialistStatAbilityUsage"] >= 2 )
1673 self.specialistStatAbilityUsage = 0;
1676 self.specialistStatAbilityUsage++;
1682 self.specialistStatAbilityUsage = 0;
1688 if ( level.rankedMatch )
1690 self GiveAchievement(
"MP_MULTI_KILL_MEDALS" );