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
abstract
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
abstract
hidedropdown;
DefaultProperties
{
ModifierPerkList(0) = class'KFPerk_Sharpshooter'
ModifierPerkList(1) = class'KFPerk_Gunslinger'
}

View File

@ -1,6 +1,6 @@
Class Ext_PerkRhythmPerkBase extends Ext_PerkBase;
var byte HeadShotComboCount,MaxRhythmCombo,MissComboCount;
var byte HeadShotComboCount,MaxRhythmCombo;
var float RhythmComboDmg;
var private const float HeadShotCountdownIntervall;
@ -20,41 +20,32 @@ final function ResetRhythm()
MaxRhythmCombo = 0;
HeadShotComboCount = 0;
RhythmComboDmg = 0;
MissComboCount = 0;
HeadShotMessage(0,true,1);
}
function SubstractHeadShotCombo()
{
if( HeadShotComboCount > 0 )
{
--HeadShotComboCount;
HeadShotMessage( HeadShotComboCount, true, MaxRhythmCombo );
}
else if( HeadShotComboCount <= 0 )
{
UpdateDmgScale(false);
else
ClearTimer( nameOf( SubstractHeadShotCombo ) );
}
}
final function UpdateDmgScale( bool bUp )
{
if( bUp )
{
MissComboCount = 0;
if (HeadShotComboCount < MaxRhythmCombo)
HeadShotComboCount = Min(HeadShotComboCount+1,255);
HeadShotComboCount = Min(HeadShotComboCount+1,MaxRhythmCombo);
HeadShotMessage(HeadShotComboCount,false,MaxRhythmCombo);
SetTimer( HeadShotCountdownIntervall, true, nameOf( SubstractHeadShotCombo ) );
}
else if( HeadShotComboCount>0 && ++MissComboCount==3 )
else if( HeadShotComboCount>0)
{
--HeadShotComboCount;
HeadShotMessage(HeadShotComboCount,true,MaxRhythmCombo);
MissComboCount = 0;
}
else return;
RhythmComboDmg = FMin(HeadShotComboCount,MaxRhythmCombo)*0.075;
RhythmComboDmg = HeadShotComboCount*0.075;
}
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 KFPawn_Monster KFPM;
// `log("RACKEMUP" @ GetScriptTrace());
if( MaxRhythmCombo<=0 )
return;
KFPM = KFPawn_Monster(Impact.HitActor);
if( KFPM==none || KFPM.GetTeamNum()==0 )
{
if( NumHit < 1 && HeadShotComboCount>0 )
UpdateDmgScale(false);
return;
}
HitZoneIdx = KFPM.HitZones.Find('ZoneName', Impact.HitInfo.BoneName);
if( HitZoneIdx == HZI_Head && KFPM.IsAliveAndWell() )
{
if( class<KFDamageType>(DamageType)!=None
&& (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'))
if( class<KFDamageType>(DamageType)!=None && (class<KFDamageType>(DamageType).Default.ModifierPerkList.Find(BasePerk)>=0))
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 )
{

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 )
{
Player.DefaultInventory.RemoveItem(class'ExtWeap_Pistol_9mm');
Player.DefaultInventory.AddItem(class'ExtWeap_Pistol_MedicS');
local int i;
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 )

View File

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