• 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 GRI accessibility in mutators vs serveractors

FZFalzar

Grizzled Veteran
May 11, 2011
128
3
UCC.exe
Does anyone know why WorldInfo.GameReplicationInfo and WorldInfo.Game.GRI gives None on the server when your mutator is loaded? Is it a quirk of KF2's engine or does it use a different method?

If its loaded as a server actor, those variables can be accessed fine. However loading it as a serveractor doesn't give the ability to do client side magic.
 
Does anyone know why WorldInfo.GameReplicationInfo and WorldInfo.Game.GRI gives None on the server when your mutator is loaded? Is it a quirk of KF2's engine or does it use a different method?

If its loaded as a server actor, those variables can be accessed fine. However loading it as a serveractor doesn't give the ability to do client side magic.
Isn't it WorldInfo.GRI and WorldInfo.Game.GameReplicationInfo? But I doubt this is your problem.
Maybe it is a matter of timing, so when are you accessing the GRI?

If I remember correctly, ServerActors can be replicated to clients, so you can use it for "client-side magic".
 
Upvote 0
As Mutant said, Mutator.BeginPlay is called during GameInfo.InitGame, but ServerActors BeginPlay is called after all actors BeginPlay.
If you want to access GRI on Mutator you should add a timer and access it one frame later, like:
Code:
function PostBeginPlay()
{
	SetTimer(0.001,false,'CheckGRI');
}
function CheckGRI()
{
	Do something to WorldInfo.GRI
}
 
Upvote 0
Doesn't matter how low the timer value is as long as it's not zero. That will make it wait at least one tick, which is all that's needed.
And timer has nothing to do with having mutator working. Any custom code package loaded on server will just derank the server.

To be honest, it's up to us in the modding community to convince TWI that >6 servers should be allowed (with or without the XP penalty) to gain XP as well and can just be excluded from the data collection.
 
Upvote 0
To be honest, it's up to us in the modding community to convince TWI that >6 servers should be allowed (with or without the XP penalty) to gain XP as well and can just be excluded from the data collection.

The data collection is done in native but I'm sure all they would really need is something like

Code:
if( GetLevelInfo()->Game->MaxPlayers > 6 )
    return NULL;
 
Upvote 0
Hmm that being said, has anyone worked here worked out how to modify the various archetypes on load? In fact, when is the best and correct time to do so, and how? Do archetype changes via code propagate to all instances or they have to be done before the initialization of the object?

#1 being the TraderItems archetype within KFGameReplicationInfo
#2 being the Character_Archetypes within KFPlayerReplicationInfo
 
Upvote 0