Modding

From Aground Wiki
Jump to navigation Jump to search

Basics

First, you will need to install a text editor or other program capable of reading and creating XML files. Atom and Notepad++ are two commonly used ones (But Visual Studio Code is the most updated one). Then, type the following. All of the other code for your mod goes between <init> and <init/>. Remember to use enter to separate lines, and use tab for all code between the two mod tags. Use tab twice for all code between the init tags..

<mod>
<name>Think of a name for your mod<name/>
<description>Describe your mod<description/>
<author>Who made the mod<author/>
<version>Mod version number<version/>
<init>
<init/>
<mod/>

To finish off your mod once you are done coding it, save the file under the name mod.xml. It is best to make a folder for it, so that if you make multiple mods, they don't accidentally overwrite each other. Then right-click on the mod.xml once it is in the folder, and click on send to and click on Compressed (Zipped) Folder. You cannot zip the folder that the XML file is in, you must zip the file itself. Name your Zip file whatever you want, most likely the name of the mod.

Of course u can also make multiple xml files, like for example: item.xml/ vehicle.xml/ structure.xml/ npc.xml (And any other way of naming u come up with).xml ]. To include a new file in mod.xml u just have to:

<init>
<include id="item.xml"/> or <include id="item/item.xml"/> (If mod.xml and item.xml are in different locations.)
</init>

Defining Objects and Items

Now that you know how to make a basic mod, lets get started with making your mod do something. Remember, all of this code goes between the init tags.

Items

To define an item, you need to give it an ID. To do this, type <item id="your_item_id_here"> This is different from the command. You can add things to the item, such as type, weight, sell price, and other variables. We'll start with the most basic type of item, a resource. Replace what you just typed with <item id="your_item_id_here" type="resource">. To add weight and price, simply add weight ="10" (As an example) and cost ="700" (As an example). So, to recap, you can make a resource with 10 weight that sells for 700 coins by typing <item id="your_item_id_here" type="resource" weight="10" cost="700">. The types of items are: food; resource; equipment; tool; potion; object; spellbook; blueprint.

Id duplication avoiding

Remember to not use the same id like in the game (or in another mod), otherwise it will result in merging 2 items/vehicles/structures/npcs. It's a good habit to always come with easy to remember id name, but unusual, so nobody repeats it, when modding his own mod. Example:

<item id="machete" (remaining attributes)/> but u can also type as <item id="mach_ete" (remaining attributes)/>

That way still u know what item it's but is written differently, so chance of someone repeating id is smaller. (Because u know, there are not really such thing, like id list of mods, u know). Yet u probably encountered id list of vanilla game, so don't worry about that one.

Objects

Objects are a lot more complicated. For them, you need to define the type of object. They also require many more animations and statistics to be put into them.

Enemies

Enemies are made in a similar way to vehicles, but they won't have their own type. They need multiple parameters and animations as well. You can extend enemies, similar to how you can extend vehicles. You can also make an enemy version of a vehicle using the same animation, but this is more complicated.

Trees

Trees are one of the most simple types. They need an animation, like everything else, and they also need drops and health.

NPCs

NPCs are extremely complex. If you want to make one, you should definitely extend one that already exists, and make the quests yourself. The easiest way to do this however, is to simply add quests to a pre-existing NPC and not bother with your own.

Other objects

The most simple type, other objects are generally not used in many places, except in the minigames. They don't need anything more than a basic definition and an animation.

Guides

https://steamcommunity.com/sharedfiles/filedetails/?id=1570801575

https://corvblimey.github.io/aground-tutorial/first_mod.html