Making a simple mod

From Star Ruler 2 Wiki
Jump to: navigation, search

Create a new mod via the mod menu and call it whatever you like.

Go to the overview tab and you will see a list of files on the left (probably mostly empty right now except for modinfo.txt) and a set of buttons on the right.

The buttons each open a tab for one of the areas the mod editor can edit. The file list can be used to jump straight to a mod file or delete files.

In this tutorial we will change one building and add a new one, so [b]Click on the Buildings button[/b].

A new tab will open. The file list on the left will now show all of the games core files in the building directory. Find Farm.txt and click on it.

This opens the megafarm's data file. If we change it by reducing the Base Cost to 80 or the Size to 2x2, the file will go yellow in the tree at the left. Yellow means it is [i]overriding[/i] a base game file. Overrides change the base game but make a mod incompatible with anything that overrides the same file.

If you then [b]Duplicate[/b] the Farm.txt file by clicking the blue duplicate button at the bottom of the file tree, it will ask you for a filename. Put "Metalmine" after the slash and accept.

The new file should be in the same folder as Farm.txt, called Metalmine.txt. It will have a building called DUPLICATE_Farm that is otherwise identical to the farm. Unlike Farm.txt it will be green in the file tree, as it is an entirely new file and not an override. New files like this should be compatible with any other mod that does not add a new file of the same name.

Change the building name to MetalMine, then change the resource added to Titanium. Adjust the other stats of this new building as desired.

The editor autosaves (interval unknown, possibly just on focus change), but you can force a save by clicking on any file from the list on the left, including the file you're currently working on. Do this now, then exit the mod editor.

You can load your mod from the main star-ruler mod menu, but you should restart after doing so. Be sure to check the console (either ` or ') for errors. In game you should now be able to construct farms for cheaper/smaller, and metal mines which add titanium to any of your worlds.