Jump to content

[Tutorial] How to create a mutator


Agent

Recommended Posts

The previous guides were written before the SDK was released, and consequently included extremely out-of-date information. So here's a new guide in hopes that someone might find it useful.

 

Setup

Before you can get started on creating any content, you will need to download the Software Development Kit from the Downloads section. Once the download is completed, extract the zip file to whatever location you prefer. With the SDK installed, the following steps will setup an extremely basic mutator that does nothing:

  1. Navigate to the SDK's /Development/Src/ directory, and create a folder named MyPackage (or whatever you want your mutator's package name to be).
  2. Create a directory named Classes in your new MyPackage directory. This is where all of your source files should go.
  3. Create an file named MyMutator.uc in MyPackage/Classes/.
  4. Write and save the following contents to MyMutator.uc: class MyMutator extends Rx_Mutator;
  5. Navigate to the SDK's /UDKGame/Config/ directory, and open DefaultEngineUDK.ini. Navigate to the UnrealEd.EditorEngine section in the file, and at the bottom of the section add: +ModEditPackages=MyPackage
  6. Now you need to compile your mutator. Simply create a compile.bat file, then write and save the following contents to it: start /Binaries/Win32/UDK.exe make
  7. Run compile.bat to compile your mutator. Some IDEs (such as the nFringe plugin for Visual Studio) allow you to compile directly inside of your editor. There is also compile scripts using /Binaries/UnrealFrontend.exe
  8. Your compiled mutator package will be named MyPackage.u, and can be found in /UDKGame/Script/.

You're done! You've now created an extremely basic mutator that does absolutely nothing. To load your mutator, simply copy your MyPackage.u file to your game/server client's UDKGame/CookedPC directory, then add ?mutator=MyPackage.MyMutator when starting a server/match. For example in-game you might press F5 and type: open CNC-Field?mutator=MyPackage.MyMutator. On a server, you can add ?mutator=MyPackage.MyMutator to your server's batch script. If you have multiple mutators, simply add commas as necessary: ?mutator=MyPackage.MyMutator,MyPackage.MyOtherMutator,RenX_ExampleMutators.InfiniteAmmo

You can have as many mutators in an individual package as you wish, but you have to load each one separately (as shown above) or create a mutator to load the other mutators automatically.

 

Self Loading

It is also possible to load a mutator directly inside of a level. To do such a thing, you would have to create a dumby Actor and then call AddMutator on your actual mutator class from PostBeginPlay, and place this dumby Actor somewhere in your level. For example:

class MyMutatorLoader extends Actor;

function PostBeginPlay()
{
	WorldInfo.Game.AddMutator("MyPackage.MyMutator", false);
}

Then you just place MyMutatorLoader somewhere in your level.

 

Notes

Alright, now that initial setup is out of the way, you can actually start making your wonderful mutator. You can use the mutators located in your SDK's /Development/Src/RenX_ExampleMutators/Classes/ for references as to how to add some basic features such as giving every weapon infinite ammo or giving sniper rifles to Stealth Black Hands. There's also plenty of resources and references available for UnrealScript in general, and are extremely relevant when working on RenX, which I've included at the bottom of this post. You will also probably have to look at the classes in RenX_Game/Classes quite a bit for interacting with Renegade X specific content and systems.

 

The 'Rx_Mutator' class differs from the 'UTMutator' class only in that it adds a function named 'InitRconCommands', which is called when RCON commands are first initialized. RCON commands are only initialized once, and that is during the initialization of the first level. RCON commands are persistent between levels. Be careful with that, because if there are any non-null Actors references in your command at the end of the level, your game/server WILL crash.

 

Resources

My favorite of the above references is the Unreal Wiki (wiki.beyondunreal.com).

  • Like 3
Link to comment
Share on other sites

It may also be possible to load a mutator through the level. To do such a thing, you would have to create a dumby Actor and then call AddMutator on your actual mutator class from PostBeginPlay, and place this dumby Actor somewhere in your level.

 

Something along these lines:

class MyMutatorLoader extends Actor;

function PostBeginPlay()
{
	WorldInfo.Game.AddMutator('MyPackage.MyMutator', false);
}

Then you just place MyMutatorLoader somewhere in your level.

Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...