Traits changes

Rack'em Up doesn't reducing when miss anymore
Trait "MedicPistol" replacing (don't removing) 9mm from default inventory so players with this trait will spawn with medic pistol in hands
Optimized code of Rack'em Up trait
This commit is contained in:
inklesspen1scripter 2020-07-07 20:49:25 +03:00
parent 8d6223ada3
commit 847c8b3cff
5 changed files with 28 additions and 37 deletions

View File

@ -1,3 +1,9 @@
class ExtDT_Ballistic_9mm extends KFDT_Ballistic_9mm class ExtDT_Ballistic_9mm extends KFDT_Ballistic_9mm
abstract abstract
hidedropdown; hidedropdown;
DefaultProperties
{
ModifierPerkList(0) = class'KFPerk_Sharpshooter'
ModifierPerkList(1) = class'KFPerk_Gunslinger'
}

View File

@ -1,3 +1,9 @@
class ExtDT_Ballistic_Pistol_Medic extends KFDT_Ballistic_Pistol_Medic class ExtDT_Ballistic_Pistol_Medic extends KFDT_Ballistic_Pistol_Medic
abstract abstract
hidedropdown; hidedropdown;
DefaultProperties
{
ModifierPerkList(0) = class'KFPerk_Sharpshooter'
ModifierPerkList(1) = class'KFPerk_Gunslinger'
}

View File

@ -1,6 +1,6 @@
Class Ext_PerkRhythmPerkBase extends Ext_PerkBase; Class Ext_PerkRhythmPerkBase extends Ext_PerkBase;
var byte HeadShotComboCount,MaxRhythmCombo,MissComboCount; var byte HeadShotComboCount,MaxRhythmCombo;
var float RhythmComboDmg; var float RhythmComboDmg;
var private const float HeadShotCountdownIntervall; var private const float HeadShotCountdownIntervall;
@ -20,41 +20,32 @@ final function ResetRhythm()
MaxRhythmCombo = 0; MaxRhythmCombo = 0;
HeadShotComboCount = 0; HeadShotComboCount = 0;
RhythmComboDmg = 0; RhythmComboDmg = 0;
MissComboCount = 0;
HeadShotMessage(0,true,1); HeadShotMessage(0,true,1);
} }
function SubstractHeadShotCombo() function SubstractHeadShotCombo()
{ {
if( HeadShotComboCount > 0 ) if( HeadShotComboCount > 0 )
{ UpdateDmgScale(false);
--HeadShotComboCount; else
HeadShotMessage( HeadShotComboCount, true, MaxRhythmCombo );
}
else if( HeadShotComboCount <= 0 )
{
ClearTimer( nameOf( SubstractHeadShotCombo ) ); ClearTimer( nameOf( SubstractHeadShotCombo ) );
}
} }
final function UpdateDmgScale( bool bUp ) final function UpdateDmgScale( bool bUp )
{ {
if( bUp ) if( bUp )
{ {
MissComboCount = 0; HeadShotComboCount = Min(HeadShotComboCount+1,MaxRhythmCombo);
if (HeadShotComboCount < MaxRhythmCombo)
HeadShotComboCount = Min(HeadShotComboCount+1,255);
HeadShotMessage(HeadShotComboCount,false,MaxRhythmCombo); HeadShotMessage(HeadShotComboCount,false,MaxRhythmCombo);
SetTimer( HeadShotCountdownIntervall, true, nameOf( SubstractHeadShotCombo ) ); SetTimer( HeadShotCountdownIntervall, true, nameOf( SubstractHeadShotCombo ) );
} }
else if( HeadShotComboCount>0 && ++MissComboCount==3 ) else if( HeadShotComboCount>0)
{ {
--HeadShotComboCount; --HeadShotComboCount;
HeadShotMessage(HeadShotComboCount,true,MaxRhythmCombo); HeadShotMessage(HeadShotComboCount,true,MaxRhythmCombo);
MissComboCount = 0;
} }
else return; else return;
RhythmComboDmg = FMin(HeadShotComboCount,MaxRhythmCombo)*0.075; RhythmComboDmg = HeadShotComboCount*0.075;
} }
function UpdatePerkHeadShots( ImpactInfo Impact, class<DamageType> DamageType, int NumHit ) function UpdatePerkHeadShots( ImpactInfo Impact, class<DamageType> DamageType, int NumHit )
@ -62,33 +53,18 @@ function UpdatePerkHeadShots( ImpactInfo Impact, class<DamageType> DamageType, i
local int HitZoneIdx; local int HitZoneIdx;
local KFPawn_Monster KFPM; local KFPawn_Monster KFPM;
// `log("RACKEMUP" @ GetScriptTrace());
if( MaxRhythmCombo<=0 ) if( MaxRhythmCombo<=0 )
return; return;
KFPM = KFPawn_Monster(Impact.HitActor); KFPM = KFPawn_Monster(Impact.HitActor);
if( KFPM==none || KFPM.GetTeamNum()==0 ) if( KFPM==none || KFPM.GetTeamNum()==0 )
{
if( NumHit < 1 && HeadShotComboCount>0 )
UpdateDmgScale(false);
return; return;
}
HitZoneIdx = KFPM.HitZones.Find('ZoneName', Impact.HitInfo.BoneName); HitZoneIdx = KFPM.HitZones.Find('ZoneName', Impact.HitInfo.BoneName);
if( HitZoneIdx == HZI_Head && KFPM.IsAliveAndWell() ) if( HitZoneIdx == HZI_Head && KFPM.IsAliveAndWell() )
{ {
if( class<KFDamageType>(DamageType)!=None if( class<KFDamageType>(DamageType)!=None && (class<KFDamageType>(DamageType).Default.ModifierPerkList.Find(BasePerk)>=0))
&& (class<KFDamageType>(DamageType).Default.ModifierPerkList.Find(BasePerk)>=0
|| DamageType == class'ExtDT_Ballistic_9mm'
|| DamageType == class'ExtDT_Ballistic_Pistol_Medic'
|| DamageType == class'KFDT_Ballistic_9mm'
|| DamageType == class'KFDT_Ballistic_Pistol_Medic'))
UpdateDmgScale(true); UpdateDmgScale(true);
else if( HeadShotComboCount>0 )
UpdateDmgScale(false);
} }
else if( NumHit < 1 && HeadShotComboCount>0 )
UpdateDmgScale(false);
} }
reliable client function HeadShotMessage( byte HeadShotNum, bool bMissed, byte MaxHits ) reliable client function HeadShotMessage( byte HeadShotNum, bool bMissed, byte MaxHits )
{ {

View File

@ -2,8 +2,10 @@ Class Ext_TraitMedicPistol extends Ext_TraitBase;
static function AddDefaultInventory( KFPawn Player, Ext_PerkBase Perk, byte Level, optional Ext_TraitDataStore Data ) static function AddDefaultInventory( KFPawn Player, Ext_PerkBase Perk, byte Level, optional Ext_TraitDataStore Data )
{ {
Player.DefaultInventory.RemoveItem(class'ExtWeap_Pistol_9mm'); local int i;
Player.DefaultInventory.AddItem(class'ExtWeap_Pistol_MedicS'); i = Player.DefaultInventory.Find(class'ExtWeap_Pistol_9mm');
if(i != -1)
Player.DefaultInventory[i] = class'ExtWeap_Pistol_MedicS';
} }
static function ApplyEffectOn( KFPawn_Human Player, Ext_PerkBase Perk, byte Level, optional Ext_TraitDataStore Data ) static function ApplyEffectOn( KFPawn_Human Player, Ext_PerkBase Perk, byte Level, optional Ext_TraitDataStore Data )

View File

@ -83,7 +83,6 @@ function PostBeginPlay()
local Object O; local Object O;
local string S; local string S;
local bool bLock; local bool bLock;
local CustomZedXPStruct zedxp;
Super.PostBeginPlay(); Super.PostBeginPlay();
if( WorldInfo.Game.BaseMutator==None ) if( WorldInfo.Game.BaseMutator==None )
@ -260,13 +259,15 @@ function PostBeginPlay()
if( bDumpXMLStats ) if( bDumpXMLStats )
FileOutput = Spawn(class'ExtXMLOutput'); FileOutput = Spawn(class'ExtXMLOutput');
UpdateCustomZedXPArray() UpdateCustomZedXPArray();
// Causes bugs // Causes bugs
// SetTimer(0.1,'CheckPickupFactories') // SetTimer(0.1,'CheckPickupFactories')
} }
function UpdateCustomZedXPArray() function UpdateCustomZedXPArray()
{ {
local int i;
local CustomZedXPStruct zedxp;
CustomZedXPArray.Length = 0; CustomZedXPArray.Length = 0;
// Custom XP for custom zeds // Custom XP for custom zeds
for(i=0;i<CustomZedXP.Length;i++) for(i=0;i<CustomZedXP.Length;i++)