Tripwire Interactive Forums

Go Back   Tripwire Interactive Forums > Killing Floor Forums > Killing Floor Modifications > Coding

Reply
 
Thread Tools Display Modes
  #1  
Old 09-27-2011, 11:25 PM
ro_sauce ro_sauce is offline
Senior Member
 
Join Date: Sep 2007
Posts: 3,110
Default [Help] Adding new damage stats

ok so using serverperksv4.38, how do i add in new damagestats?

i've been going through kfsteamstatsandachievements, pulling out each function to put into ServerStStats, hoping that a new damagetype will call the new damage stat functions, but so far i'm not having luck.

so now i'm about to try to make damtypeNEW extends from something other than kfprojectileweapondamagetype (which extends kfweapondamagetype which has the kfsteamstatsandachievements calls)

inside the new kfweapondamagetype, how do i make it call the new functions in serverststats?

maybe marco will take pity on my plight and make a easy way to add in new damagestats to serverperks!
__________________


For RO2 Crash Support Help, PM me your problem and teamview connection, and I will see if I can fix it for you.

Last edited by ro_sauce; 09-27-2011 at 11:32 PM.
Reply With Quote
  #2  
Old 09-28-2011, 12:21 AM
FluX FluX is offline
Senior Member
 
Join Date: Oct 2010
Posts: 3,730
Default

ACtually mate it's quite easy as I taught HateMe also how to do it. Contact me on Steam and i'll show you
__________________

Reply With Quote
  #3  
Old 09-28-2011, 12:52 AM
ro_sauce ro_sauce is offline
Senior Member
 
Join Date: Sep 2007
Posts: 3,110
Default

lol, you're not on!
__________________


For RO2 Crash Support Help, PM me your problem and teamview connection, and I will see if I can fix it for you.
Reply With Quote
  #4  
Old 09-28-2011, 01:47 AM
mooarchanox mooarchanox is offline
Senior Member
 
Join Date: Aug 2010
Posts: 188
Default

Quote:
Originally Posted by Excalibolg View Post
Adding a new stat:

StatsObject.uc

Keeps track of all stats and saves/retrieves them. There's a big list of int variables at the top, containing all the stats you're already familiar with. Add a new stat like "KnifeDamageStat".

Scroll down and you'll see GetSaveData wich lines up all stats for saving. Add your new stat like this:

Code:
    Result = Result$","$KnifeDamageStat;
Go to SetSaveData and add the following code in the right order (The order is defined by where you added the DamageStat above in GetSaveData)

Code:
    KnifeDamageStat = GetNextValue(S);
ServerStStats.uc

This code keeps track of all the "add something to the stats" functions. As well of wich stats should get replicated in the ClientPerkRepLink. Add a new function like this one:

Code:
function AddKnifeDamage(int Amount)
{
    bHasChanged = true;
    Rep.RKnifeDamageStat+=Amount;
    if( MyStatsObject!=None )
        MyStatsObject.KnifeDamageStat+=Amount;
    DelayedStatCheck();
}
and update final function RepCopyStats, adding this line:

Code:
    Rep.RKnifeDamageStat = MyStatsObject.KnifeDamageStat;
ClientPerkRepLink.uc

This code defines all the stats the client receives from the server. Add your new stat in the long list of R***Stats like this: RKnifeDamageStat. Scroll down to the replication and add it there aswell.

SrStatList.uc

Responsible for all the drawing in the "stats" tab in the menu.

Go to InitList and add your new stat. MY server uses a custom stats object so I have a different order:

Code:
    StatProgress[9] = L.RKnifeDamageStat;
Go down to the defaultproperties and add a name, as well as increasing ItemCount by one.




To track your knife damage stat, you need to replace the Knife in the game with a new one that refers to new firing modes. These firing modes need a new hitDamageClass that looks like this:

Code:
class NewDamTypeKnife extends DamTypeKnife
    abstract;

static function AwardDamage(KFSteamStatsAndAchievements KFStatsAndAchievements, int Amount)
{
    ServerStStats(KFStatsAndAchievements).AddKnifeDamage(Amount);
}

defaultproperties
{
}
Adding a new perk:

Just write a new SRVeterancyTypes like this one:

Code:
class SRVetTank extends SRVeterancyTypes
    abstract;

static function int GetPerkProgressInt( ClientPerkRepLink StatOther, out int FinalInt, byte CurLevel, byte ReqNum )
{
    switch( CurLevel )
    {
        case 0:
            FinalInt = 10000;
            break;
        case 1:
            FinalInt = 25000;
            break;
        case 2:
            FinalInt = 100000;
            break;
        case 3:
            FinalInt = 500000;
            break;
        case 4:
            FinalInt = 1500000;
            break;
        case 5:
            FinalInt = 3500000;
            break;
        case 6:
            FinalInt = 5500000;
            break;
        default:
            if (CurLevel < 9)
                FinalInt = 5500000 + GetDoubleScaling(CurLevel, 250000);
            else if (CurLevel >= 9 && CurLevel < 19)
                FinalInt = 11000000 + GetDoubleScaling(CurLevel, 500000);
            else if (CurLevel >= 19)
                FinalInt = 15000000 + GetDoubleScaling(CurLevel, 750000);
    }
    return Min(StatOther.RKnifeDamageStat, FinalInt);
}

static function int ReduceDamage(KFPlayerReplicationInfo KFPRI, KFPawn  Injured, KFMonster DamageTaker, int InDamage, class<DamageType>  DmgType)
{
    return float(InDamage) * 0.85;
}

static function string GetCustomLevelInfo( byte Level )
{
    local string S;

    S = Default.CustomLevelInfo;
    return S;
}

defaultproperties
{
     CustomLevelInfo="15% less damage from enemy attacks"
     Requirements(0)="Deal damage with the knife"
     PerkIndex=4
     OnHUDIcon=Texture'KillingFloorHUD.Perks.Perk_Berserker'
     OnHUDGoldIcon=Texture'KillingFloor2HUD.Perk_Icons.Perk_Berserker_Gold'
     VeterancyName="Tank"
}
And add it to your config file.
just to make your life easier, but still this can be found easily if you try searching ...

Last edited by mooarchanox; 09-28-2011 at 01:50 AM.
Reply With Quote
  #5  
Old 09-28-2011, 02:29 AM
ro_sauce ro_sauce is offline
Senior Member
 
Join Date: Sep 2007
Posts: 3,110
Default

yeah that was a noob mistake on my part, thank you though for this.
now i got a bunch of coding ahead of me.
__________________


For RO2 Crash Support Help, PM me your problem and teamview connection, and I will see if I can fix it for you.
Reply With Quote
  #6  
Old 09-28-2011, 06:08 AM
FluX FluX is offline
Senior Member
 
Join Date: Oct 2010
Posts: 3,730
Default

If I remember, this isn't the full thing. I could be mistaken but me and him did a few other bits and pieces for mine atleast.
__________________

Reply With Quote
  #7  
Old 09-28-2011, 09:29 PM
mooarchanox mooarchanox is offline
Senior Member
 
Join Date: Aug 2010
Posts: 188
Default

it's not the whole thing, just how to add the new stat for server perk which is enough.
Reply With Quote
  #8  
Old 09-29-2011, 04:37 AM
FluX FluX is offline
Senior Member
 
Join Date: Oct 2010
Posts: 3,730
Default

Yeah sorry it's cause when I first started to do the perks I had to do other bits like make custom versions of the weapons to get the custom stat to work. Im just thinking too far ahead
__________________

Reply With Quote
  #9  
Old 09-29-2011, 11:56 PM
ro_sauce ro_sauce is offline
Senior Member
 
Join Date: Sep 2007
Posts: 3,110
Default

thank you very much for your help guys, now i just have lots of busy work ahead of me to put new damagestats for all my weapons and perks.

but when i'm done, i will have 22 more fully functional perks that will level up when the custom weapons are used!

i'll prolly figure it out on my own, but where is the healingdamagetype? i'm trying to make my armour repair gun count towards "armourrepairstat" and i would like to see how the syringe/mp7 healing function towards healingstats.
__________________


For RO2 Crash Support Help, PM me your problem and teamview connection, and I will see if I can fix it for you.

Last edited by ro_sauce; 09-29-2011 at 11:59 PM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:24 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2005 - 2013, Tripwire Interactive, LLC