New to this and need a question answered

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

justin_s

FNG / Fresh Meat
Apr 25, 2010
6
0
0
Hi,

Could someone explain to me how you get values of config set variables? I am unsure as to how to do it and can't really find out how =/, Any help will be appreciated.
 

Benjamin

Grizzled Veteran
May 17, 2009
3,631
635
113
France
Could you elaborate or give an example of what values you want to access? I'm not sure what it is that you want.
 

justin_s

FNG / Fresh Meat
Apr 25, 2010
6
0
0
I am trying to read and write variables like "bWeaponStay" under Engine.Gameinfo in the Killingfloor.ini file.


EDIT: Sorry just realised it uses the variables in [KFMod.KFGameType] but i still want to know how to edit these vars with a mutator :(.
 
Last edited:

Benjamin

Grizzled Veteran
May 17, 2009
3,631
635
113
France
It depends where the variable is declared. That particular variable is declared in GameInfo, and can be accessed like this:

Code:
Level.Game.bWeaponStay = true;
 

Benjamin

Grizzled Veteran
May 17, 2009
3,631
635
113
France
Same place:

Code:
Level.Game.MaxPlayers = NewMaxPlayers;

I'd recommend using Windows Grep for finding where variables are declared (and referenced) in files.
 

justin_s

FNG / Fresh Meat
Apr 25, 2010
6
0
0
Is there a limit as to what i can set? I tried setting the starting cash and even the maxplayers. Neither of them worked so i tried setting a timer just out of curiosity incase it would work, that failed also.

Code:
class KFSettingsTest extends Mutator;

function PostBeginPlay()
{
    Level.Game.StartingCash = 500;  

}

defaultproperties
{
    GroupName="KFSettingTest"
    FriendlyName="Setting Test"
    Description="Mutator to handle the settings"
}
 

Benjamin

Grizzled Veteran
May 17, 2009
3,631
635
113
France
It seems the StartingCash variable gets set depending on the level of difficulty. Thus:

Code:
class KFSettingsTest extends Mutator;

function PostBeginPlay()
{
	KFGameType(Level.Game).StartingCashNormal = 9999;
	KFGameType(Level.Game).MinRespawnCashNormal = 9999;
	
	Level.Game.MaxPlayers = 7; // Doesn't work
	
	SetTimer(1, false);
}

function Timer()
{
	Level.Game.MaxPlayers = 7; // Does
}

defaultproperties
{
    GroupName="KFSettingTest"
    FriendlyName="Setting Test"
    Description="Mutator to handle the settings"
}

I'm not sure why but you must delay the setting of MaxPlayers.
 

justin_s

FNG / Fresh Meat
Apr 25, 2010
6
0
0
Thanks, i understand it now. Sadly i noticed that perks were completely disabled :S and that perk replacement mod is good but i'd still prefer the standard perk choosing.
 

Benjamin

Grizzled Veteran
May 17, 2009
3,631
635
113
France
Yeah, it's a shame but it seems that at the moment there's no known way to securely allow perks to be used when non-whitelisted mutators are running (since technically speaking you could write a mutator that modifies your perks). When testing I use this mutator for perks.