Difference between revisions of "Creating a Mod"
Splittingred (Talk | contribs) (Created page with "== 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 DefaultM...") |
Splittingred (Talk | contribs) |
||
Line 12: | Line 12: | ||
This would load your mod whenever KAG loads. | This would load your mod whenever KAG loads. | ||
+ | |||
+ | '''''Never, ever put files in the Base/ folder.''''' The Base/ folder is erased and reloaded during upgrades, so anything you place in here will get nuked on an upgrade. | ||
== What Happens When a Mod is Loaded == | == What Happens When a Mod is Loaded == |
Revision as of 22:32, 23 January 2013
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":
This would load your mod whenever KAG loads.
Never, ever put files in the Base/ folder. The Base/ folder is erased and reloaded during upgrades, so anything you place in here will get nuked on an upgrade.
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.