Taking out the MKB with a Mutator

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

Kerc Kasha

FNG / Fresh Meat
Sep 11, 2011
293
162
0
Naut's having some problems with posting so I'm posting this for him:

I've been trying to use this code instead and see if it worked. The problem is, I have no idea how to get to "RORoleInfo..." from the mutator class. In this bit of code I tried something, but the address is wrong and it will refuse to compile
Code:
event PreBeginPlay()
{
Super.PreBeginPlay();
WorldInfo.Game.RORoleInfoAlliesAssault = class'NoMKB.RORoleInfoAlliesAssaultNoMKB';
WorldInfo.Game.RORoleInfoAxisAssault = class'NoMKB.RORoleInfoAxisAssaultNoMKB';
}
Is there any way to easily find the address for something like RORoleInfoAxisAssault and its equivelent? Or am I just completely overlooking something that Unrealscript implemented?

This is the compile error:
Code:
[0013.26] C:\Steam\Steamapps\common\red orchestra  2\Development\Src\NoMKB\Classes\MutNoMoreMKB.uc(22) : Error,  Unrecognized member 'RORoleInfoAlliesAssault' in class 'GameInfo'
I personally believe he should use Super.PostBeginPlay(); but it's not really the issue atm.
 

Ducky

Super Moderator
May 22, 2011
6,358
237
0
Netherlands
Naut's having some problems with posting so I'm posting this for him:

I personally believe he should use Super.PostBeginPlay(); but it's not really the issue atm.

First of all, WorldInfo.Game is a GameInfo instance. You need to typecast it to a ROGameInfo instance to be able to reach any of the RORoleInfo properties
Do it like:
Code:
ROGameInfo(WorldInfo.Game).xxxxxxxx
Where xxxxxxxx is the name of the property.

Second, the RORoleInfo classes do not have RORoleInfoAlliesAssault or RORoleInfoAxisAssault properties. The only RORoleInfo properties are:
Code:
var    array<RORoleInfoClasses>    AxisRoleContentClasses;                // Stores class references for all available role and level combinations
var    array<RORoleInfoClasses>    AlliesRoleContentClasses;            // Stores class references for all available role and level combinations
var    array<RORoleInfoClasses>    AxisWinterRoleContentClasses;        // Stores class references for all available role and level combinations
var    array<RORoleInfoClasses>    AlliesWinterRoleContentClasses;        // Stores class references for all available role and level combinations
You need to assign your derived classes to those arrays. Something like:
Code:
function OverrideMKB()
{
    local ROGameInfo  game;

    game = ROGameInfo(WorldInfo.Game);

    // Assault role is at index 0
    game.AxisRoleContentClasses[0] = Spawn(class'NoMKB.RORoleInfoAxisAssaultNoMKB', game.AxisRoleContentClasses[0].Owner);
    game.AlliesRoleContentClasses[0] = Spawn(class'NoMKB.RORoleInfoAlliesAssaultNoMKB', game.AlliesRoleContentClasses[0].Owner);
       :
       :
}
But you are still not done. Done of the original classes properties (in general all that did get a dynamic value) need to be copied from the original RORoleInfoxxxAssault class instance to your derived class instance. That is most of the work. If you skip it, then your server or the clients will probably crash.
 
Last edited: