• 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

Firstly TY Gartley for this most informative thread and of course for the Colt. Could you revisit the veterancy part of the thread?
I'll use the Beserker since it only has one criteria to lvl. This is taken directly from the current Marco sp6 sc.

static function int GetPerkProgressInt( ClientPerkRepLink StatOther, out int FinalInt, byte CurLevel, byte ReqNum )
{
switch( CurLevel )
{
case 0:
FinalInt = 5000;
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:
FinalInt = 5500000+GetDoubleScaling(CurLevel,500000);
}
return Min(StatOther.RMeleeDamageStat,FinalInt);
}

using lvl 20 as an example is this correct?

5.5mill +(20*20(500,000)=205,500,000
That is one impressive number. Am I doing something wrong? I did get the sharpshooter example that you used and for him that seems the best way to do that. But here that number seems very high.

This is the entry I am using for my own perks. I am not getting the expected perk level in game.

switch( CurLevel )
{
case 0:
FinalInt = 5000;
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 <= 50)
FinalInt = 5500000+GetDoubleScaling(CurLevel,28000);
else if (CurLevel == 51)
FinalInt = 100000000;
else if (CurLevel == 52)
FinalInt = 125000000;
else if (CurLevel == 53)
FinalInt = 150000000;
else if (CurLevel == 54)
FinalInt = 175000000;
else if (CurLevel == 55)
FinalInt = 200000000;
}
return Min(StatOther.RMeleeDamageStat,FinalInt);

My player id has 68.5 million points for the beserker and the game is giving me lvl 55 when my expectation is lvl 49. As you can see I am trying to manually define the lvls for 51-55 on this a lvl 55 server.

soooooooooo... please show me the error of my ways.
 
Upvote 0
Yes, TY Flux is this how you configure your own server perk lvls? A lvl by lvl score? This is the part I would like some help with;
FinalInt = 5500000+GetDoubleScaling(CurLevel,28000);

show me a correct equation with say lvl 30. I thought I understood but as I said the game is returning a higher lvl considering the actual points I have as a player.

I should add that (since I am a noob) I am open to any suggestions on this. My goal is to advance a perk simularly to the Marco method to lvl 50 with max points/scores in the mid 70 millions then a prestige class 50-55 at the higher intervals as indicated.
 
Last edited:
Upvote 0
Gartly I do want to create a shiny new perk and I have been following your instructions to the letter. Starting in post #3 with the "class DamTypeG36CNew extends KFWeaponDamageType". Does that require the creation of a new .uc file? I believe it does but the post doesn't say. Can you recommend a file name? Next the "class G36CProgress extends SRCustomProgressInt;" is this also a new file? Again can you recommend a file name? Are these new files compilied along with the perk.uc and does that bring the total files to 3 to create your new perk or are there others? I see that for your example pek you use this line: "FinalInt = default.progressArray[6]+GetDoubleScaling(CurLevel,500000);" are the brackets correct there where as the array has paraentheses (6)? TY in advance.
 
Upvote 0
Gartly I do want to create a shiny new perk and I have been following your instructions to the letter. Starting in post #3 with the "class DamTypeG36CNew extends KFWeaponDamageType". Does that require the creation of a new .uc file? I believe it does but the post doesn't say. Can you recommend a file name? Next the "class G36CProgress extends SRCustomProgressInt;" is this also a new file? Again can you recommend a file name? Are these new files compilied along with the perk.uc and does that bring the total files to 3 to create your new perk or are there others? I see that for your example pek you use this line: "FinalInt = default.progressArray[6]+GetDoubleScaling(CurLevel,500000);" are the brackets correct there where as the array has paraentheses (6)? TY in advance.

Yes, Yes, yes & yes, as for file names, call them the same as the class name, ie class DamTypeG36New call it DamTypeG36New.uc It must be the same filename as the class name, you can really have whatever you wish, as long as they are the same, all other files that reference these classes must know the names of them also.




The array is found in part 4 of this post

Hope that all helped.
 
Upvote 0
EpharGy, TY for your answers. I have been fumbling through a perk compile. The perk damage element has to conform to an exisiting data base. I hope that the required info is here in this post as I have not yet been successful. I have had sucess in editing and compiling the sc perks but as of this moment putting the new perk and the old damage stat is still out of reach. Again TY for your reply and Flux also. I'll return if I have a cogent answerable question.
 
Last edited:
Upvote 0
EpharGy, TY for your answers. I have been fumbling through a perk compile. The perk damage element has to conform to an exisiting data base. I hope that the required info is here in this post as I have not yet been successful. I have had sucess in editing and compiling the sc perks but as of this moment putting the new perk and the old damage stat is still out of reach. Again TY for your reply and Flux also. I'll return if I have a cogent answerable question.



No problems, we all started somewhere, not long ago is was FluX asking the simple questions, then more recently myself, soon enough you'll probably be helping a newcomer.
 
Upvote 0
I am currently trying to give the classes armor at lvl 5 and higher i dont know what i am doing wrong could i get some help with it please here is the string of code i have added to the startinginventory of a perk

Code:
if ( KFPRI.ClientVeteranSkillLevel >= 5 )
		P.ShieldStrength = 100;

it works with a few perks like beserker medic and firebug but i cant get it to work for others what have i done wrong?
 
Upvote 0
yes that is all there this is my support specialist's code for the starting items:

Code:
// Give Extra Items as Default
static function AddDefaultInventory(KFPlayerReplicationInfo KFPRI, Pawn P)
{
	// If Level 1, give them Assault Shotgun
	if ( KFPRI.ClientVeteranSkillLevel == 1 )
		KFHumanPawn(P).CreateInventoryVeterancy("KFMod.Shotgun", GetCostScaling(KFPRI, class'ShotgunPickup'));
	// If Level 6, give them Hunting Shotgun
	if ( KFPRI.ClientVeteranSkillLevel >= 6 )
		KFHumanPawn(P).CreateInventoryVeterancy("KFMod.BoomStick", GetCostScaling(KFPRI, class'BoomStickPickup'));
        // If Level 6, give them Body Armor(Removed from Suicidal and HoE in Balance Round 7)
	if ( KFPRI.ClientVeteranSkillLevel >= 5 )
		P.ShieldStrength = 100;
}

and they do not spawn with armor i am not sure why is there something i am doing wrong?
 
Upvote 0
yes that is all there this is my support specialist's code for the starting items:

Code:
// Give Extra Items as Default
static function AddDefaultInventory(KFPlayerReplicationInfo KFPRI, Pawn P)
{
	// If Level 1, give them Assault Shotgun
	if ( KFPRI.ClientVeteranSkillLevel == 1 )
		KFHumanPawn(P).CreateInventoryVeterancy("KFMod.Shotgun", GetCostScaling(KFPRI, class'ShotgunPickup'));
	// If Level 6, give them Hunting Shotgun
	if ( KFPRI.ClientVeteranSkillLevel >= 6 )
		KFHumanPawn(P).CreateInventoryVeterancy("KFMod.BoomStick", GetCostScaling(KFPRI, class'BoomStickPickup'));
        // If Level 6, give them Body Armor(Removed from Suicidal and HoE in Balance Round 7)
	if ( KFPRI.ClientVeteranSkillLevel >= 5 )
		P.ShieldStrength = 100;
}

and they do not spawn with armor i am not sure why is there something i am doing wrong?


This is what i use, dont take any note of the bad descriptions, i'm lazy at times :p The only difference i see is where you have your if criteria, although i thought for if statements it will check against each statement, so i would of thought yours should work.

Code:
static function AddDefaultInventory(KFPlayerReplicationInfo KFPRI, Pawn P)
{
	// If Level 5, give them Assault Shotgun
	if ( KFPRI.ClientVeteranSkillLevel >= 6 && KFPRI.ClientVeteranSkillLevel < 8 )
		KFHumanPawn(P).CreateInventoryVeterancy("KFMod.Shotgun", GetCostScaling(KFPRI, class'ShotgunPickup'));
	// If Level 6, give them Hunting Shotgun
	if ( KFPRI.ClientVeteranSkillLevel >= 8 )
		KFHumanPawn(P).CreateInventoryVeterancy("KFMod.BoomStick", GetCostScaling(KFPRI, class'BoomStickPickup'));
	if ( KFPRI.ClientVeteranSkillLevel >= 10 )
		P.ShieldStrength = 100;
}
 
Last edited:
Upvote 0