-
Notifications
You must be signed in to change notification settings - Fork 20
Creating a Mutator
This guide will teach you basics of how to create a simple mutator.
For illustrative purposes, our task will be to write a mutator that will send a periodic message to all players connected to the server.
This guide assumes that you have already installed the DarkestHourDev development environment.
Mutators are compiled code and/or asset packages that, when applied to a game server, can make modifications and additions to the base game. Mutators can be used to add weapons, vehicles, administration menus, and entirely new game types to Darkest Hour.
All of the code files (*.uc
) for a mutator must live inside of a package. Our first job is to create that package.
To create a mutator package, we must first create a folder in the Red Orchestra directory with the name of our package.
- Navigate to the Red Orchestra directory (eg.
C:\Program Files (x86)\Steam\SteamApps\common\Red Orchestra
). - Create a folder named
MyMutator
. - Inside the
MyMutator
folder, create a folder calledClasses
.
Now your package folder is set up. Simple, right? Now we need to add some code so our mutator will do something!
Create a file called MyMutator.uc
inside the %RODIR%/MyMutator/Classes
directory. This will be the primary file for your mutator.
Once the file is created, copy and paste the the code below into MyMutator.uc
and save it.
class MyMutator extends Mutator;
function PostBeginPlay()
{
SetTimer(60.0, true);
}
function Timer()
{
Level.Game.Broadcast(self, "Welcome to" @ Level.Game.GameReplicationInfo.ServerName $ ", enjoy your stay!");
}
Now that we've got our mutator package created and some code to execute, we need to compile the package so that it can be executed on your server.
The first thing we need to do is to add the name of our package to a list of packages to be compiled.
The file we need to edit is %RODIR%/DarkestHourDev/System/DarkestHourDev.ini
.
DarkestHourDev.ini
does not exist if you have not run DarkestHourDev before. To runDarkestHourDev
, use the batch file located at%RODIR%/System/DarkestHourDev.bat
.
Open DarkestHourDev.ini
in any text editor and search for EditPackages
. You should see the following:
...
EditPackages=DH_Effects
EditPackages=DH_Engine
EditPackages=DH_Game
EditPackages=DH_Interface
EditPackages=DH_Weapons
EditPackages=DH_Vehicles
EditPackages=DH_Guns
EditPackages=DH_Equipment
EditPackages=DH_ATWeapons
EditPackages=DH_Mortars
EditPackages=DH_LevelActors
EditPackages=DH_GerPlayers
EditPackages=DH_BritishPlayers
EditPackages=DH_USPlayers
In order to compile your mutator, add the following line after the last EditPackages
line in the file.
EditPackages=MyMutator
Now we're ready to compile! To compile the mutator, execute the following batch file:
%RODIR%\tools\make\make.bat
This wiki is a work in progress. If you require more in-depth support, please contact us on Discord.
- IMPORTANT: Disclaimer For Server Owners
- Dedicated Server Installation
- Basic Server Configuration
- Server Troubleshooting
- Debug & Admin Commands