Making a "Change Inventory" Mutator

From BiaSDK
Jump to: navigation, search

This page describes the process in creating a mutator that replaces an inventory item with another inventory item. It can work for SP and for MP - that depends on the inventory item.

Ok, let´s go. First you have to decide which inventory item do you want to change. There are two inventory type: first inventory and secondary inventory. The first inventory are the weapons (rifels, mp´s, pistols). The secondary inventory are the handgrenades. So let´s try to change the handgrenades to specialgrenades. Our file is called UsableSpecialGrenade.uc for that.

First we have to search which *.uc file we have to change. For this open a MP map and check the properties: gbxMPPlayerStart -> RequiredEquipment. There you find this: gbxInventory.UsableUSHandGrenadeMP

So we have to change the UsableUSHandGrenadeMP.uc.

For that we use this function:

function string GetInventoryClassOverride(string InventoryClassName)
{
if ( InventoryClassName == "gbxInventory.UsableUSHandGrenadeMP")
InventoryClassName = "SpecialGrenadeMutator.UsableSpecialGrenade";
return InventoryClassName;
}

Now we create our Mutator.uc. Inside your BrothersInArms folder (or BrothersInArmsEiB folder, if you have Earned In Blood), create a new folder called "SpecialGrenadeMutator". Inside this SpecialGrenadeMutator folder, create a folder called "Classes". SpecialGrenadeMutator will be the package name for our new mutator.\\ Open up Notepad (or any text editor) and place the following code in it...

// ******* SpecialGrenade Mutator *******
class SpecialGrenade extends Mutator;
function string GetInventoryClassOverride(string InventoryClassName) { if ( InventoryClassName == "gbxInventory.UsableUSHandGrenadeMP") InventoryClassName = "SpecialGrenadeMutator.UsableSpecialGrenade"; return InventoryClassName; }
defaultproperties { GroupName="SpecialGrenade" FriendlyName="SpecialGrenade" Description="This small mutator replaces the handgrenades to specialgrenades." }

Now we need to build the SpecialGrenadeMutator package by compiling our new script code.\\ Open the BiA.ini file (or the EiB.ini file if you are using Earned In Blood) and search for "EditPackages=".\\ Add this line immediately BELOW all of the other EditPackages= lines in the .ini file...

EditPackages=SpecialGrenadeMutator

Save the .ini file, then right click on it in Windows Explorer and check the 'Read-Only' box to make it read-only (so that the game won't overwrite it with your Profile version). Now open up an MS-DOS Prompt window and change directories to the BiA System folder. Run "ucc make" to build the UnrealScipt code. You should see it compiling the 'SpecialGrenadeMutator' package and you shouldn't get any errors(if you do get errors, double check your UsableSpecialGrenade.uc code against the code shown above). When the compiler is done, you should have SpecialGrenadeMutator.u in your System folder (if not, go back and double check all of the steps above).

Now, to have the mutator show up in the Multiplayer game menu, you will need to create a .int file in your BiA System folder. The .int file must have the same filename as the package name (in this case it will be SpecialGrenadeMutator.int).\\ So let's open Notepad again and put the following in it...

[public]
Mutator=(Class=Class,MetaClass=Engine.Mutator,Name=SpecialGrenadeMutator.SpecialGrenade,

Description="This small mutator replaces the handgrenades to specialgrenades.")

...and save this as "SpecialGrenadeMutator.int" in the System folder.

For the german version you have to save it as "SpecialGrenadeMutator.det"in the System folder.

When you create a Multiplayer game, you can click on the 'Mutators' item at the bottom of the game menu screen to add a mutator to your game. Select the SpecialGrenadeMutator and click on 'Add' to add it to the list on the right, then click on 'Back' to return to the previous game menu screen.


Back to Main Page