Legends

 

Mod Guide

Page history last edited by raytray25 3 yrs ago

For this guide I shall be using the WeaponMod mod (updated 3/22/06) as the example.

 

 

The main thing to remember about creating a mod is to know what exactly it is you're modding. Some mods require new scripts, new models, new sounds and new textures, while others require simple changes to existing datablocks.

The WeaponMod mod does both of these to show how you are supposed to do it.

 

Inside the WeaponMod.zip file you will see two folders, legends and WeaponMod.

We use the legends folder to store the data for the mod, but not the data folder. There is a bug with the autodownloader where it will not see any data files in the mod folder and try to download them even if they are already there (but the game will use them without any problems), so use your own modnamedata folder inside the legends folder to store your mods data. This will also keeps the legends data folder clean.

The WeaponMod folder is the main mod folder where we store all the mods scripting. The following is a break-down of the mod structure:

 

main.cs -> scripts/init.cs -> scripts/server/game.cs -> scripts/server/weapon.cs -> scripts/server/weapons/NewDiscLauncher.cs

 

The mods main.cs is a basic copy of the legends main.cs but with a few changes to run the mod scripting. We use a copy of the legends main.cs to override the legends package forcing the game to do what we want it to. The reason for this is the timing of executing the mod scripts. It needs to be done at the right moment, which cannot be done by parenting the same functions as in legends/main.cs alone.

The modified main.cs can also be used for TCs by only executing the mod scripts and ignoring any legends scripts.

 

main.cs:

In this file we exec the mod prefs, or exec the default legends prefs if not found.

Then, once all the default Legends scripts are executed we execute the mod scripts via scripts/init.cs

 

scripts/init.cs:

For a server-side mod we only need to parent the initServer function. All we do in here is execute the mods game.cs, but other more complicated mods may need to do more in here.

 

scripts/server/game.cs:

This is where we execute all the server scripts, change the mod name shown in the server browser and modify any existing datablocks.

The onServerCreated executes all the server scripts and is touched just before the game starts to load the mission.

 

scripts/server/weapon.cs:

This just executes anything in the weapons folder. It's not really needed if you only have one weapon, but i've included it just for completions sake.

 

scripts/server/weapons/newdisclauncer.cs:

And now we get to what the mod actually mods. A new weapon.

The file is based on the default disclauncher.cs but with modified paths to show an example of how to create a mod structure friendly weapon.

 

If you want to use any server autoexec'd scripts i'd suggest putting them into the modname/scripts/server/autoexec folder instead of the legends/scripts/server/autoexec folder. This will prevent your server from being forced into a Variant.

 

 

As I stated earlier, there is a bug with the autodownload that prevents you from storing your data files in your mod folder, but there is also another bug that prevents you from using new explosion and shockwave textures. The autodownload does not parse any ifl files (they store explosion anims or multiple texture paths) that are conneted to a dts shape nor does it try to send any textures that are in any datablocks. If you want to use new explosions or any texture that is not directly touched by a dts/dif shape, you will need to supply a client-side pack.

 

-as written by Ilys

Comments (0)

You don't have permission to comment on this page.