Creating a Mod

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

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Adding the Mod to the Loader

Creating mods in 1.0 is fairly simple; just add your mod directory to the Mods/ subdirectory in your KAG directory, and then edit the DefaultMods.as file. For example, if you had a Mod called "herobrine", you would just place it in the following directory:

KAG/Mods/herobrine/

Then, you'd go into Base/Scripts/Default/DefaultMods.as, and add this inside the method "LoadDefaultMods":

AddMod("herobrine");

This would load your mod whenever KAG loads.

What Happens When a Mod is Loaded

When a mod is loaded with AddMod, KAG will automatically add all of your files to the front of the auto-file-loading engine that KAG uses to load the scripts in Base/. This means that your mod's scripts will *replace* any scripts with the same relative path in Base. For example, if I were to make a file in my herobrine mod at this location:

KAG/Mods/herobrine/Entities/Characters/Archer/ArcherCommon.as

Then KAG would not load the Base/Entities/Characters/Archer/ArcherCommon.as file, and instead load mine. So I'd need to make sure that my modded file contains all that file used to have plus my modifications, so I didn't break functionality.

Resolving Conflicts

Since the above method can obviously cause conflicts when two mods override the same file (the last loaded mod will take preference), it is recommended to not override files if possible, but rather just create new Entities, Rules, gamemodes, etc. That way you can plug-and-play them in, rather than modifying the existing base sets.