Adding a Mod to a Gamemode

From King Arthur's Gold Wiki
Revision as of 23:07, 23 January 2013 by Splittingred (Talk | contribs)

Jump to: navigation, search

Say you have a mod that wants to add some new functionality to a gamemode (not add a new Entity or Vehicle), like say a mod that allows for people to type !fireworks to get fireworks in the sky. How would you add it? This tutorial explains how.

First off, let's assume your mod's name is "fireworks", and contains a single file, "fireworks.as". Make sure your mod is loaded. This means your file is at:

/Mods/fireworks/fireworks.as

Second, go into the gamemode that you wish to edit. For this tutorial, we'll assume the WAR mode. Find the WAR's gamemode.cfg, in Base/Rules/WAR/gamemode.cfg.

Look for these lines (they may be a bit different, but the main part is finding the "scripts" variable:

    scripts = WAR.as;
          WAR_Interface.as;
          WAR_PickSpawn.as;
          TimeToEnd.as;
          RestartAfterShortPostGame.as;
          ChatCommands.as;
          Editor.as;
          TeamMenuJustSpectator.as;
          KillMessages.as;
          SpawnTraders.as;

Simply add the relative path of your file from your mod's directory to the end of list of scripts to load:

     fireworks.as;

(Note, if your script had been in /Mods/fireworks/Rules/fireworks.as, then you would put Rules/fireworks.as here, rather than just fireworks.as, since the path is relative.)

This will tell KAG to load your script after loading all the other scripts. From here you can use Hooks or functions or whatever you want to customize the gamemode functionality. The gamemode.cfg part that we edited should now look like this:


    scripts = WAR.as;
          WAR_Interface.as;
          WAR_PickSpawn.as;
          TimeToEnd.as;
          RestartAfterShortPostGame.as;
          ChatCommands.as;
          Editor.as;
          TeamMenuJustSpectator.as;
          KillMessages.as;
          SpawnTraders.as;
          fireworks.as;