Simple Mod Template

Use this code template to create a simple mod that can work in multiplayer or singleplayer.

(Image: preview of code in editor with syntax highlighting)

The Template
This template currently edits the explosion effect of the frag grenade, but can easily be used to mod any feature of the game accessible in a class's defaultproperties.

class FragMod extends Actor;

//a new variable //it is the "string" type, which is basic text var string StringToSend;

//replication tells the game what needs to get sent to clients or server replication {	//here it basically says if the server messes with this variable, //clients need to know reliable if ( Role == ROLE_Authority ) StringToSend; }

//the server will mess with this variable in this event event BeginPlay {	StringToSend = "Frag Grenade Mod active - by UnknownName"; }

//this event is now simulated to run on clients simulated event PostNetBeginPlay {	//add a message in a specific color to the client's console! AddMessageToConsole(StringToSend,class'Canvas'.static.MakeColor(0,255,0)); //this line will replace default explosion with barrel explosion class'R6FragGrenade'.default.m_pExplosionParticles = class'R6SFX.R6explosiveDrum'; }

defaultproperties {	//this line just tells the server how the client will behave RemoteRole=ROLE_SimulatedProxy bHidden=true//this mod class should not appear physically in game bAlwaysRelevant=true//this line is needed or client-side stuff may not reliably happen }

Edit the template how you like. Use StringToSend as a notification for anyone playing your game; the message will appear in your console. Add or modify lines in PostNetBeginPlay in order to change any default value to your desired value.

Compiling And Using
This code must be in a text file with the extension *.uc. Place in a folder called "classes", in another folder named for your project name. When you compile, this project name will be the name of the resulting file.

Once you compile, rename your resulting *.u file as a *.utx file, or your mod may not work in multiplayer. Place the *.utx file into your server's Textures folder, or for singleplayer, in your own Textures folder.

In multiplayer: add the name of the code package as well as the name of your new code actor to the list in Ravenshield.mod, in the format:

ServerPackages=FileName ServerActors=FileName.FragMod

In singleplayer: ensure that you have OpenRVS v1.2+ installed, and enable the experimental mods feature in OpenRVS.ini. Then follow the multiplayer instructions.

Start your game and try it out! You can verify that it is running by opening the console after entering the server or loading the singleplayer map; you should see your notification from the StringToSend variable.