fiends ,can anybody up a mutator which perks could up to 254

  • 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/

fengxue0108

Member
Jul 18, 2011
191
0
16
fiends ,can anybody up a mutator which all perks could up to 254, i need a serverperks mutator
so thank you my KF friends
 

fengxue0108

Member
Jul 18, 2011
191
0
16
you do not know what my mean

you do not know what my mean

You can set the highest and lowest perk level to 254 in serverperks.ini

i used this two mutator ScrnBalance and Serverperks And i set maxperks 254 minperks 7 but when my friend got 71Lv he could not up his Lv at all
so
i need a mutator like serverperks have to get 251 Lv
my meaning was not clear but very thank you for your reply
 

poosh

Grizzled Veteran
Jan 6, 2011
3,403
327
83
This is because Lv71 perk requirements hit the max int32 value (2^31) which is used for progress storage. Fixing this would require significant refactoring of ServerPerks and I doubt that somebody will want to do that.
 

Toblerone

FNG / Fresh Meat
Mar 21, 2015
25
2
0
poosh;n2311650 said:
This is because Lv71 perk requirements hit the max int32 value (2^31) which is used for progress storage. Fixing this would require significant refactoring of ServerPerks and I doubt that somebody will want to do that.

Actually no, the fix is pretty simple.

Make sure the functions I give you in this code are the same as your functions in SRVeterancyTypes.uc
Code:
class SRVeterancyTypes extends KFVeterancyTypes
    abstract;

var() localized string CustomLevelInfo;
var() localized array<string> SRLevelEffects; // Added in ver 5.00, dynamic array for level effects.
var() byte NumRequirements;
var() localized string DisableTag,DisableDescription; // Can be set as a reason to hide inventory from specific players.

//Toblerone 21/05/2016
var() localized string DisableTag6lvl;
var() localized string DisableDescription6lvl;    

// Can be used to add in custom stats.
static function AddCustomStats( ClientPerkRepLink Other );

// Return the level of perk that is available, 0 = perk is n/a.
static function byte PerkIsAvailable( ClientPerkRepLink StatOther )
{
    local byte i,a,b;

    b = StatOther.MaximumLevel+1;
    a = Min(StatOther.MinimumLevel,b);

    while( true )
    {
        if( a==b || (a+1)==b )
        {
            if( a<StatOther.MaximumLevel && LevelIsFinished(StatOther,a) )
                ++a;
            break;
        }
        i = a+((b-a)>>1);
        if( !LevelIsFinished(StatOther,i) ) // Lower!
            b = i;
        else a = i; // Higher!
    }
    return Clamp(a,StatOther.MinimumLevel,StatOther.MaximumLevel);

    // Check which level it fits in to.
    /*for( i=0; i<StatOther.MaximumLevel; i++ )
    {
        if( !LevelIsFinished(StatOther,i) )
            return Clamp(i,StatOther.MinimumLevel,StatOther.MaximumLevel);
    }
    return StatOther.MaximumLevel;*/
}

// Return 0-1 % of how much of the progress is done to gain this perk (for menu GUI).
static function float GetTotalProgress( ClientPerkRepLink StatOther, byte CurLevel )
{
    local byte i,rc,Minimum;
    local int R,V,NegReq;
    local float RV;

    if( CurLevel==StatOther.MaximumLevel )
        return 1.f;
    if( StatOther.bMinimalRequirements )
    {
        Minimum = 0;
        CurLevel = Max(CurLevel-StatOther.MinimumLevel,0);
    }
    else Minimum = StatOther.MinimumLevel;

    rc = GetRequirementCount(StatOther,CurLevel);
    for( i=0; i<rc; i++ )
    {
        V = GetPerkProgressInt(StatOther,R,CurLevel,i);
        if( CurLevel>Minimum )
        {
            GetPerkProgressInt(StatOther,NegReq,(CurLevel-1),i);
            R-=NegReq;
            V-=NegReq;
        }
        if( R<=0 ) // Avoid division by zero error.
            RV+=1.f;
        else RV+=FClamp(float(V)/(float(R)),0.f,1.f);
    }
    return RV/float(rc);
}

static function bool LevelIsFinished( ClientPerkRepLink StatOther, byte CurLevel )
{
    local byte i,rc;
    local int R,V;

    if( CurLevel==StatOther.MaximumLevel )
        return false;
    if( StatOther.bMinimalRequirements )
        CurLevel = Max(CurLevel-StatOther.MinimumLevel,0);
    rc = GetRequirementCount(StatOther,CurLevel);
    for( i=0; i<rc; i++ )
    {
        V = GetPerkProgressInt(StatOther,R,CurLevel,i);
        if( R>V )
            return false;
    }
    return true;
}

static function float GetPerkProgress( ClientPerkRepLink StatOther, byte CurLevel, byte ReqNum, out int Numerator, out int Denominator )
{
    local byte Minimum;
    local int Reduced,Cur,Fin;

    if( CurLevel==StatOther.MaximumLevel )
    {
        Denominator = 1;
        Numerator = 1;
        return 1.f;
    }
    if( StatOther.bMinimalRequirements )
    {
        Minimum = 0;
        CurLevel = Max(CurLevel-StatOther.MinimumLevel,0);
    }
    else Minimum = StatOther.MinimumLevel;
    Numerator = GetPerkProgressInt(StatOther,Denominator,CurLevel,ReqNum);
    if( CurLevel>Minimum )
    {
        GetPerkProgressInt(StatOther,Reduced,CurLevel-1,ReqNum);
        Cur = Max(Numerator-Reduced,0);
        Fin = Max(Denominator-Reduced,0);
    }
    else
    {
        Cur = Numerator;
        Fin = Denominator;
    }
    if( Fin<=0 ) // Avoid division by zero.
        return 1.f;
    return FMin(float(Cur)/float(Fin),1.f);
}

// Return int progress for this perk level up.
static function int GetPerkProgressInt( ClientPerkRepLink StatOther, out int FinalInt, byte CurLevel, byte ReqNum )
{
    FinalInt = 1;
    return 1;
}

...

defaultproperties
{
...
}
 
Last edited:

Toblerone

FNG / Fresh Meat
Mar 21, 2015
25
2
0
poosh;n2311650 said:
This is because Lv71 perk requirements hit the max int32 value (2^31) which is used for progress storage. Fixing this would require significant refactoring of ServerPerks and I doubt that somebody will want to do that.

Actually no. The fix is simple.

Go to SRVeterancyTypes.uc, and make sure the functions I give you match yours from your file. Then save and compile, and ta daa, no more perk limits.
Code:
// Written by .:..: (2009)
// Base class of all server veterancy types
class SRVeterancyTypes extends KFVeterancyTypes
    abstract;

var() localized string CustomLevelInfo;
var() localized array<string> SRLevelEffects; // Added in ver 5.00, dynamic array for level effects.
var() byte NumRequirements;
var() localized string DisableTag,DisableDescription; // Can be set as a reason to hide inventory from specific players.

//Toblerone 21/05/2016
var() localized string DisableTag6lvl;
var() localized string DisableDescription6lvl;    

// Can be used to add in custom stats.
static function AddCustomStats( ClientPerkRepLink Other );

// Return the level of perk that is available, 0 = perk is n/a.
static function byte PerkIsAvailable( ClientPerkRepLink StatOther )
{
    local byte i,a,b;

    b = StatOther.MaximumLevel+1;
    a = Min(StatOther.MinimumLevel,b);

    while( true )
    {
        if( a==b || (a+1)==b )
        {
            if( a<StatOther.MaximumLevel && LevelIsFinished(StatOther,a) )
                ++a;
            break;
        }
        i = a+((b-a)>>1);
        if( !LevelIsFinished(StatOther,i) ) // Lower!
            b = i;
        else a = i; // Higher!
    }
    return Clamp(a,StatOther.MinimumLevel,StatOther.MaximumLevel);
}

// Return 0-1 % of how much of the progress is done to gain this perk (for menu GUI).
static function float GetTotalProgress( ClientPerkRepLink StatOther, byte CurLevel )
{
    local byte i,rc,Minimum;
    local int R,V,NegReq;
    local float RV;

    if( CurLevel==StatOther.MaximumLevel )
        return 1.f;
    if( StatOther.bMinimalRequirements )
    {
        Minimum = 0;
        CurLevel = Max(CurLevel-StatOther.MinimumLevel,0);
    }
    else Minimum = StatOther.MinimumLevel;

    rc = GetRequirementCount(StatOther,CurLevel);
    for( i=0; i<rc; i++ )
    {
        V = GetPerkProgressInt(StatOther,R,CurLevel,i);
        if( CurLevel>Minimum )
        {
            GetPerkProgressInt(StatOther,NegReq,(CurLevel-1),i);
            R-=NegReq;
            V-=NegReq;
        }
        if( R<=0 ) // Avoid division by zero error.
            RV+=1.f;
        else RV+=FClamp(float(V)/(float(R)),0.f,1.f);
    }
    return RV/float(rc);
}

static function bool LevelIsFinished( ClientPerkRepLink StatOther, byte CurLevel )
{
    local byte i,rc;
    local int R,V;

    if( CurLevel==StatOther.MaximumLevel )
        return false;
    if( StatOther.bMinimalRequirements )
        CurLevel = Max(CurLevel-StatOther.MinimumLevel,0);
    rc = GetRequirementCount(StatOther,CurLevel);
    for( i=0; i<rc; i++ )
    {
        V = GetPerkProgressInt(StatOther,R,CurLevel,i);
        if( R>V )
            return false;
    }
    return true;
}

static function float GetPerkProgress( ClientPerkRepLink StatOther, byte CurLevel, byte ReqNum, out int Numerator, out int Denominator )
{
    local byte Minimum;
    local int Reduced,Cur,Fin;

    if( CurLevel==StatOther.MaximumLevel )
    {
        Denominator = 1;
        Numerator = 1;
        return 1.f;
    }
    if( StatOther.bMinimalRequirements )
    {
        Minimum = 0;
        CurLevel = Max(CurLevel-StatOther.MinimumLevel,0);
    }
    else Minimum = StatOther.MinimumLevel;
    Numerator = GetPerkProgressInt(StatOther,Denominator,CurLevel,ReqNum);
    if( CurLevel>Minimum )
    {
        GetPerkProgressInt(StatOther,Reduced,CurLevel-1,ReqNum);
        Cur = Max(Numerator-Reduced,0);
        Fin = Max(Denominator-Reduced,0);
    }
    else
    {
        Cur = Numerator;
        Fin = Denominator;
    }
    if( Fin<=0 ) // Avoid division by zero.
        return 1.f;
    return FMin(float(Cur)/float(Fin),1.f);
}

// Return int progress for this perk level up.
static function int GetPerkProgressInt( ClientPerkRepLink StatOther, out int FinalInt, byte CurLevel, byte ReqNum )
{
    FinalInt = 1;
    return 1;
}

...

defaultproperties
{
...
}
 
Last edited: