Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function bool IsFromMod(Object O)
  2. {
  3.     local string PackageName;
  4.    
  5.     if( O == None )
  6.         return false;
  7.    
  8.     PackageName = string(O.GetPackageName());
  9.     return (PackageName ~= "KFGameContent" && PackageName ~= "KFGame");
  10. }
  11.  
  12. function ScoreKill(Controller Killer, Controller Killed)
  13. {
  14.     local KFPawn_Monster KFM;
  15.     local int i, j;
  16.     local KFPlayerController KFPC;
  17.     local KFPlayerReplicationInfo DamagerKFPRI;
  18.     local float XP;
  19.     local KFPerk InstigatorPerk;
  20.    
  21.     KFM = KFPawn_Monster(Killed.Pawn);
  22.     if( KFM!=None && Killed.GetTeamNum()!=0 && Killer.bIsPlayer && Killer.GetTeamNum()==0 )
  23.     {
  24.         if( KFM.DamageHistory.Length > 0 && IsFromMod(KFM) )
  25.         {
  26.             for( i = 0; i<KFM.DamageHistory.Length; i++ )
  27.             {
  28.                 DamagerKFPRI = KFPlayerReplicationInfo(KFM.DamageHistory[i].DamagerPRI);
  29.                 if( DamagerKFPRI != None )
  30.                 {
  31.                     if( KFM.DamageHistory[i].DamagePerks.Length <= 0 )
  32.                     {
  33.                         continue;
  34.                     }
  35.  
  36.                     // Distribute experience points
  37.                     KFPC = KFPlayerController(DamagerKFPRI.Owner);
  38.                     if( KFPC != none )
  39.                     {
  40.                         InstigatorPerk = KFPC.GetPerk();
  41.                         if( InstigatorPerk.ShouldGetAllTheXP() )
  42.                         {
  43.                             KFPC.OnPlayerXPAdded(KFM.static.GetXPValue(MyKFGI.GameDifficulty), InstigatorPerk.Class);
  44.                             continue;
  45.                         }
  46.  
  47.                         XP = KFM.static.GetXPValue(MyKFGI.GameDifficulty) / KFM.DamageHistory[i].DamagePerks.Length;
  48.  
  49.                         for( j = 0; j < KFM.DamageHistory[i].DamagePerks.Length; j++ )
  50.                         {
  51.                             KFPC.OnPlayerXPAdded(FCeil(XP), KFM.DamageHistory[i].DamagePerks[j]);
  52.                         }
  53.                     }
  54.                 }
  55.             }
  56.         }
  57.     }
  58.    
  59.     Super.ScoreKill(Killer, Killed);
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement