• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code [Tutorial] Custom Perks

Can't we use KFProjectileDamageType instead of KFWeaponDamageType for the extend? Also, can't we just use ServerStStats (providing that we added the custom new variable to that .uc file)?

No reason you can't use KFProjectileDamageType, it extends KFWeaponDamageType anyway, the only difference being some gore options.

You could edit ServerStStats, but the point of this was to show you don't need to mess with Marco's base packages to add new things to it. Or even increased functionality, as he even showed how it could be done with his ServerPerksX which adds a 'member' skin only function.
 
Upvote 0
*EDIT* I'm doubting what I've written now. Bare with me as I double check my own ramblings.
Ok, lets take a look at sharpshooter for the sake of simplicity.

Firstly the part you have highlighted is the arguments for the function GetDoubleScaling which resides in the SRVeterancyTypes Class

Code:
static final function int GetDoubleScaling( byte CurLevel, int InValue )
{
	CurLevel-=6;
	return CurLevel*CurLevel*InValue;
}

What this does is perform some simple maths (heh, then again that's pretty much all code is)

So using a level 10 sharpie in this example would be.

Code:
	FinalInt = 8500+GetDoubleScaling(CurLevel,2500);

CurLevel-=6 <- (PerkLevel) 10 - 6 = 4
return CurLevel*CurLevel*InValue; <- 4x4x2500 (2500 was taken from the VETClass argument when the GetDoubleScaling function was called)

Now we have our GetDoubleScaling value we do the rest of the maths

FinalInt=8500+40000
FinalInt=48500

So level 10 Sharpie the perk requirement is 48500

Secondly it's worth noting the progression isn't linear by default as displayed here.
Spoiler!



But if you wanted to make it linear you can just remove the GetDoubleScaling function call and use an appropriate static integer like so:
Code:
FinalInt = 8500+3000*CurLevel;

Thanks Marco for correcting my derp. ^^
I chose 3000 in this case as it's the difference between levels 5 and 6. So now every level past 6 will have a linear progression needing only 3000 headshots perlevel.

I hope that made sense, I've not yet had a cup of tea so it might be shaky.
 
Last edited:
Upvote 0
But if you wanted to make it linear you can just remove the GetDoubleScaling function call and use an appropriate static integer like so:
Code:
FinalInt = 8500+3000;
I chose 3000 in this case as it's the difference between levels 5 and 6. So now every level past 6 will have a linear progression needing only 3000 headshots perlevel.

Just that you missed the level multiplier:
Code:
FinalInt = 8500+3000*CurLevel;
That'll make it 3000 per level.
 
Upvote 0
*EDIT* I'm doubting what I've written now. Bare with me as I double check my own ramblings.
Ok, lets take a look at sharpshooter for the sake of simplicity.

Firstly the part you have highlighted is the arguments for the function GetDoubleScaling which resides in the SRVeterancyTypes Class

Code:
static final function int GetDoubleScaling( byte CurLevel, int InValue )
{
    CurLevel-=6;
    return CurLevel*CurLevel*InValue;
}
What this does is perform some simple maths (heh, then again that's pretty much all code is)

So using a level 10 sharpie in this example would be.

Code:
    FinalInt = 8500+GetDoubleScaling(CurLevel,2500);
CurLevel-=6 <- (PerkLevel) 10 - 6 = 4
return CurLevel*CurLevel*InValue; <- 4x4x2500 (2500 was taken from the VETClass argument when the GetDoubleScaling function was called)

Now we have our GetDoubleScaling value we do the rest of the maths

FinalInt=8500+40000
FinalInt=48500

So level 10 Sharpie the perk requirement is 48500

Secondly it's worth noting the progression isn't linear by default as displayed here.
Spoiler!


-DERP ALERT! DERP ALERT!-
Ignore the below until I've had some coffee and wake the frak up.


But if you wanted to make it linear you can just remove the GetDoubleScaling function call and use an appropriate static integer like so:
Code:
FinalInt = 8500+3000;
I chose 3000 in this case as it's the difference between levels 5 and 6. So now every level past 6 will have a linear progression needing only 3000 headshots perlevel.

I hope that made sense, I've not yet had a cup of tea so it might be shaky.

The DoubleScaling is based on the value chosen. Say if a value of 5000 is chose, and 8500 is the lvl 6 value, then the lvl 7 value would be 8500+((7)^2)*(5000)
 
Upvote 0
The DoubleScaling is based on the value chosen. Say if a value of 5000 is chose, and 8500 is the lvl 6 value, then the lvl 7 value would be 8500+((7)^2)*(5000)

Not quite, although admittedly you wrote the maths it's more correct form.

The operator -= is used like "a -= b" and expanded would be "a = a - b"

So at level 7 the maths using your values would be 8500+((1)^2)*(5000)

The reason I called myself into doubt is during double checking it didn't behave as I had interpreted it.
 
Last edited:
Upvote 0
Not quite, although admittedly you wrote the maths it's more correct form.

The operator -= is used like "a -= b" and expanded would be "a = a - b"

So at level 7 the maths using your values would be 8500+((1)^2)*(5000)

The reason I called myself into doubt is during double checking it didn't behave as I had interpreted it.

Whoops, I forgot that. But yes, I write maths in correct form since I am used to doing that for school work.
 
Upvote 0
I'm in need of your help...pls

I'm in need of your help...pls

Spoiler!

Hello, Mr.Gartley...
Sorry to bother...
I'm in need of your help...pls
I have one question ...

I was coding at ServerPerks5.5....
By the way, I applied to the server.
It seems such a message..
Spoiler!

That's why?
And...
I had to use a custom perks.
By the way... This is an spam warining.
Spoiler!

What's wrong?
What i did wrong ... Please point out...
 
Last edited:
Upvote 0
Hey, ASSAYARO

It's ServerPerks not ServerPerksV5

Make sure you have the line: "EditPackages=ServerPerks"
In your KillingFloor.ini before the line:"EditPackages=MyPerkPackage"

Like this
Code:
EditPackages=ServerPerks
EditPackages=MyPerkPackage

As for the spam warning I think that's something to do with ServerPerks and not the perks themselves.
 
Last edited:
Upvote 0
Spoiler!

I have deleted the serverpweks5.1.
and I was like what you say...
And insert "editpackage=serverperks" , was compiling...
I dont know the cause:confused:
This situation feels very stuffy...
 
Upvote 0
Hi there,
I'm working on a custom perk and all is working fine. I got a random melee weapon ability specific to your perk level (i.e. tireiron for perk under level 3 and i.e. a rusty shovel above). But what I need is to remove the given Weapons "Knife" and "9mm" Pistol, because this perk should use it's own. How could I do this? I searched all classes for the veterancy types (anchestors included), if there is some line that says giving this items to the player, but I don't find one.
Would be nice if someone could help me. Thank you.
 
Upvote 0