Game API InstallMods

Index: GameAPI

## How to Install a mod

### About

This article should help you install mods in general. It's easy, and doesn't take much time!

If you want further inspiration for mods, see this ModList

### Pre-requisites

In order to install a mod, you must first obtain files for one. It is expected, that you have downloaded a mod, from some source.

It is additionally expected, that you have an Empyrion server installed. Please note, that as of A8.1, **the game only supports running mods on servers**.

Note, that some mods might require compilation beforehand. **If you have not been provided a .dll file, this is the case!**. No guide currently exist on this, but you may refer to GameAPI's basic steps on creating a project, and using google for the rest.

### 1. Required steps

#### The 'mods' folder

First, you must verify, that your Server contains a directory for the mods.

This folder should be located at <path to your server-root>/Content/mods

If it does not exist, you will need to create it.

#### Inside the /mods/ folder

Each mod must have **their own**! directory created inside this folder.

You should be able to call this folder what you want, but it is recommended, to call it the mods name, and the version you downloaded, to easier keep track.

(For instance, if you downloaded 'SpotGuard' version 1.2, you might want to call the folder 'SpotGuard v1.2')

Note that some mods *might* require you to name the directory something specific. If so, it should have been noted from where you downloaded it. If a mod isn't working, you should possibly try to rename the folder, to the same as the supplied **.dll** file was named (if the file was called 'spotguard.dll', try naming the folder 'spotguard')

### 2. Where to put the files

A mod consists of **atleast** one file; A file called <something>.dll

It might contain **additional files** however.

These files needs to be extracted directly into the folder created in **step 1**.

If you called your folder SpotGuard, it should look like the image to the right.

Please make sure, that it is not placed in any additional folders, and that the folder only contain **ONE** **.dll** file.

### 3. Restart your server

If your server is running, you will need to restart it, in order to apply the new mod.

### 4. Confirming it works

If you have followed the above steps, and **if provided, any additional steps required by the mod, such as configuring something or similar**, it should be functional at this point.

You can confirm this, by going to the servers log folder (<path to your server-root>/Logs/<highest number>/), and opening the newest **Dedicated\_<>.log** log (Look at date, or just pick the highest number).

You can open the file with any text-editor.

Inside you should find some lines, similar to these:

```
30-22:52:06.549 00_52 -LOG- EAC: Starting server
Platform assembly: D:\APPS\steamapps\common\Empyrion - Dedicated Server\EmpyrionDedicated_Data\Managed\System.Xml.dll (this message is harmless)
Platform assembly: D:\APPS\steamapps\common\Empyrion - Dedicated Server\EmpyrionDedicated_Data\Managed\System.Configuration.dll (this message is harmless)
30-22:52:06.622 00_52 -LOG- Now listening for PfServers on port 30003
30-22:52:06.630 00_52 -LOG- Loaded mod Mod0 from Backpacktweaks
Non platform assembly: D:\APPS\steamapps\common\Empyrion - Dedicated Server\Content\Mods\CommandCrate\CommandCrate.dll (this message is harmless)
30-22:52:06.639 00_52 -LOG- Loaded mod Mod1 from CommandCrate
Non platform assembly: D:\APPS\steamapps\common\Empyrion - Dedicated Server\Content\Mods\empnot\EmpyrionNotices.dll (this message is harmless)
30-22:52:06.641 00_52 -LOG- Loaded mod Mod2 from empnot
Non platform assembly: D:\APPS\steamapps\common\Empyrion - Dedicated Server\Content\Mods\EPM\EPM.dll (this message is harmless)
30-22:52:06.642 00_52 -LOG- Loaded mod Mod3 from EPM
30-22:52:06.642 00_52 -LOG- Loaded mod Mod4 from PreSpectator
Non platform assembly: D:\APPS\steamapps\common\Empyrion - Dedicated Server\Content\Mods\SpotGuard\SpotGuard.dll (this message is harmless)
30-22:52:06.644 00_52 -LOG- Loaded mod Mod5 from SpotGuard

```

Note the lines "**Loaded mod mod<number> from <foldername>**". This means the game managed to load the mod.

Please be mindfull of errors in these.

### 5. If it didn't work

If you see some error related to the mod.. For instance a line like

```
30-22:52:07.820 00_52 -ERR- Error on executing Game_Event in mod Mod3
30-22:52:07.821 00_52 -EXC- System.NullReferenceException: Object reference not set to an instance of an object
  at EPM.Game_Event (CmdId cmdId, UInt16 seqNr, System.Object data) [0x00000] in <filename unknown>:0
  at Assembly-CSharp.LineEventArgs.CloseComponent (CmdId , UInt16 , System.Object ) [0x00000] in <filename unknown>:0

```

Something went wrong loading the mod.

You may want to first **re-read** the mods instructions, and see if you had to do something specific to get it working.

If that does not fix your issue, please refer to this post: https://empyriononline.com/threads/problem-with-a-mod-please-read-me.38218/

### Updating a mod

Updating a mod is the same process as if you were installing it, although you shouldn't have to create the /mods/ folder, and optionally, only rename the mods' folder (If you called the folder 'SpotGuard v1.2, and you have downloaded a newer version, say v1.3, you may want to rename the folder to 'SpotGuard v1.3')

Simply replace any files inside, with the newer downloaded.

If the mod have **additional files** make sure to read the changelog (if provided by the mod), to see if a config file for instance have gotten additional tags, so you can **insert these** rather than **replacing your current** entirely.