KF Veterency Stat Reading

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

FluX

Grizzled Veteran
Oct 26, 2010
5,394
234
63
www.fluxiserver.co.uk
Hey. So I would like to access a stat from ServerStStats (serverperks mutator) from inside the veterency. Now I can't seem to figure out where exactly the KFPI would go so I can access the player's stat.

My current code inside the AllowWeaponInTrader function:
Code:
	if ( class<Fs_WeaponBase>(Weapon).default.CamoID => 0 )
	{
		// Shimmering Water
		if ( class<Fs_WeaponBase>(Weapon).default.CamoID == 1 && ServerStStats(KFStatsAndAchievements).MyStatsObject.DLCShimmering == True )
			return true;
		else return false;
		
	}

Now I know this will fail as I haven't made the stat yet but also, I need to know how to change the last part of the second if to get the player's stats. Never been good with getting that sort of information.
 

FZFalzar

FNG / Fresh Meat
May 11, 2011
128
3
0
UCC.exe
All veterancy classes extend off KFVeterancyTypes, which is a subclass of Actor (Info). You should be able to just get Owner.PlayerReplicationInfo, if I'm reading your question correct.
 

FluX

Grizzled Veteran
Oct 26, 2010
5,394
234
63
www.fluxiserver.co.uk
All veterancy classes extend off KFVeterancyTypes, which is a subclass of Actor (Info). You should be able to just get Owner.PlayerReplicationInfo, if I'm reading your question correct.

Thanks for your reply. Nice to know I can use that but if I had this part of the code, where would I put that? That was my overall question.
Code:
ServerStStats(KFStatsAndAchievements).MyStatsObject.DLCShimmering

I'm always confused on where to add it when referring the player's achievement class. So would it be like Owner.KFPRI.KFStatsAndAchievements or something else?
 

Dr_Killjoy

FNG / Fresh Meat
Sep 30, 2012
260
0
0
If I understood u correctly, you can refer to this value the way like this:

static function bool AllowWeaponInTrader( class<KFWeaponPickup> Pickup, KFPlayerReplicationInfo KFPRI, byte Level )
{
local KFPCServ KFPC;
local ServerStStats SRStats;
local int NeededStat;

KFPC = KFPCServ(KFPRI.Owner);
KFSSA = SRStats(KFPC.SteamStatsAndAchievements);
NeededStat = SRStats.MyStatsObject.DLCShimmering;
return true;
}
 

FluX

Grizzled Veteran
Oct 26, 2010
5,394
234
63
www.fluxiserver.co.uk
If I understood u correctly, you can refer to this value the way like this:

static function bool AllowWeaponInTrader( class<KFWeaponPickup> Pickup, KFPlayerReplicationInfo KFPRI, byte Level )
{
local KFPCServ KFPC;
local ServerStStats SRStats;
local int NeededStat;

KFPC = KFPCServ(KFPRI.Owner);
KFSSA = SRStats(KFPC.SteamStatsAndAchievements);
NeededStat = SRStats.MyStatsObject.DLCShimmering;
return true;
}

Sorry but what does this do?
 

FZFalzar

FNG / Fresh Meat
May 11, 2011
128
3
0
UCC.exe
What Dr_Killjoy meant with his code was that you can access ServerPerks stat object through KFPCServ (ServerPerks Player Controller). KFPRI.Owner (from method arguments) holds a reference to an Actor, which would be KFPCServ, thus the cast. Once you have that reference, you can then access your stat object by casting KFPCServ.SteamStatsAndAchievements to ServerStStats, then accessing it via MyServerStStats.MyStatObject.MyRequiredStatValue

Example:
Code:
local KFPCServ MyKFPC;
local ServerStStats MyStats;

if ( class<Fs_WeaponBase>(Weapon).default.CamoID => 0 )
{
	MyKFPC = KFPCServ(KFPRI.Owner);
	MyStats = ServerStStats(MyKFPC.SteamStatsAndAchievements);

	// Shimmering Water
	if ( class<Fs_WeaponBase>(Weapon).default.CamoID == 1 && MyStats.MyRequiredStat.DLCShimmering == True )
		return true;
	else return false;
	
}
 

FluX

Grizzled Veteran
Oct 26, 2010
5,394
234
63
www.fluxiserver.co.uk
What Dr_Killjoy meant with his code was that you can access ServerPerks stat object through KFPCServ (ServerPerks Player Controller). KFPRI.Owner (from method arguments) holds a reference to an Actor, which would be KFPCServ, thus the cast. Once you have that reference, you can then access your stat object by casting KFPCServ.SteamStatsAndAchievements to ServerStStats, then accessing it via MyServerStStats.MyStatObject.MyRequiredStatValue

Example:
Code:
local KFPCServ MyKFPC;
local ServerStStats MyStats;

if ( class<Fs_WeaponBase>(Weapon).default.CamoID => 0 )
{
	MyKFPC = KFPCServ(KFPRI.Owner);
	MyStats = ServerStStats(MyKFPC.SteamStatsAndAchievements);

	// Shimmering Water
	if ( class<Fs_WeaponBase>(Weapon).default.CamoID == 1 && MyStats.MyRequiredStat.DLCShimmering == True )
		return true;
	else return false;
	
}

Thanks for clarifying it. I will see how it goes and if any problems, will respond here.

Cheers to both :)