Editing Modding Tutorials/Getting started with mods

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 26: Line 26:
 
There are many code editors out there, some of the most commonly used are:
 
There are many code editors out there, some of the most commonly used are:
 
* [https://code.visualstudio.com/ Visual Studio Code] is a free code editor and has a lot of useful features and tools You can add extensions tools to make coding work easier (this is what we will use in this tutorial).
 
* [https://code.visualstudio.com/ Visual Studio Code] is a free code editor and has a lot of useful features and tools You can add extensions tools to make coding work easier (this is what we will use in this tutorial).
* [https://visualstudio.microsoft.com/ Visual Studio] you can get the Windows, MAC or Linux version, a program made by Microsoft.
+
* [https://visualstudio.microsoft.com/ Visual Studio] you can get for Windows or MAC, a program made by Microsoft.
 
* [https://notepad-plus-plus.org/ Notepad++] is a very lightweight code editor that is very easy to use, however it is missing some features that make it less useful for larger projects. It is easy to use when you are a beginner in coding.
 
* [https://notepad-plus-plus.org/ Notepad++] is a very lightweight code editor that is very easy to use, however it is missing some features that make it less useful for larger projects. It is easy to use when you are a beginner in coding.
 
* [https://www.sublimetext.com/ Sublime Text] is a free code editor that is popular.
 
* [https://www.sublimetext.com/ Sublime Text] is a free code editor that is popular.
Line 35: Line 35:
 
=Making the folder structure=
 
=Making the folder structure=
 
'''''There are mod templates available for quick setup, however it is recommended to create the folder structure manually at least once to get a better understanding of how mods work.'''''
 
'''''There are mod templates available for quick setup, however it is recommended to create the folder structure manually at least once to get a better understanding of how mods work.'''''
To start making a mod, we need to create a folder for the mod. This folder will contain all the files and folders that make up the mod.<br>
+
To start making a mod, we need to create a folder for the mod. This folder will contain all the files and folders that make up the mod. To keep things organized, we will create a folder in RimWorld's mod local folder. This is located at:
'''Note:''' Avoid putting your local mod in the Steam mods' folder, as it's meant for published workshop mods. Many beginners make this mistake and then wonder why their mod isn't visible in their test game.
 
To keep things organized, we will create a folder in RimWorld's mod local folder, which is located at:  
 
 
<pre>(RimWorldInstallFolder)/Mods/</pre>
 
<pre>(RimWorldInstallFolder)/Mods/</pre>
 +
'''''Note: it is not recommended to put your mod in the steam mods' folder''''' since it is a local mod and not yet published on the Steam workshop.
  
 
==Making an "about” file. ==
 
==Making an "about” file. ==
Line 44: Line 43:
 
Inside the About folder, we will create a file called About.xml. This file will contain information about the mod. Inside the file, we will add the following code:
 
Inside the About folder, we will create a file called About.xml. This file will contain information about the mod. Inside the file, we will add the following code:
 
<pre>
 
<pre>
<?xml version="1.0" encoding="UTF-8"?> <!-- Comments in XML look like this -->
+
<?xml version="1.0" encoding="UTF-8"?> <! -- Comments in XML look like this-->
 
</pre>
 
</pre>
 
This is the first line of every XML file. It tells the computer that this is an XML file and what encoding to use. Get used by putting this line in every XML file you make)<br>
 
This is the first line of every XML file. It tells the computer that this is an XML file and what encoding to use. Get used by putting this line in every XML file you make)<br>
Line 62: Line 61:
 
Now save the file and close it. '''Note: the name of the file must be exactly "About.xml"'''
 
Now save the file and close it. '''Note: the name of the file must be exactly "About.xml"'''
 
Open RimPy and sort by local mods. You should see your mod listed. If you click on it, you should see the information you have entered in the About.xml file. <br>
 
Open RimPy and sort by local mods. You should see your mod listed. If you click on it, you should see the information you have entered in the About.xml file. <br>
'''''When adding a preview image to your mod you must name the image "Preview.png" and place it in the About folder, the image resolution should be 512×512 pixels and the size must be under 2mb'''''
+
'''''When adding a preview image to your mod you must name the image "Preview.png" and place it in the About folder, the image resolution should be 512×512 pixels and the size must be under 2mb'''''  
  
 
==Creating the other folder==
 
==Creating the other folder==
 
Now let's make a Def's folder inside the mod folder. This folder will contain all the XML files that define the content the mod will add.<br>
 
Now let's make a Def's folder inside the mod folder. This folder will contain all the XML files that define the content the mod will add.<br>
 
Start by creating a folder called "Defs" inside the mod folder, inside the Defs folder create a file called "ThingDefs.xml" <br>
 
Start by creating a folder called "Defs" inside the mod folder, inside the Defs folder create a file called "ThingDefs.xml" <br>
 +
In the root of the mod folder create a folder called "Patches". this folder will contain XML files that will be used to patch existing content in the game. Inside the Patches folder create a file called "ThingDefs_Patch.xml" <br>
 
let's also create a folder called "Textures" inside the mod folder. this folder will contain all the images that will be used in the mod.<br>
 
let's also create a folder called "Textures" inside the mod folder. this folder will contain all the images that will be used in the mod.<br>
 
Your mod folder should now look like this:  
 
Your mod folder should now look like this:  
Line 76: Line 76:
 
     Defs
 
     Defs
 
         ThingDefs.xml
 
         ThingDefs.xml
 +
    Patches
 +
        ThingDefs_Patch.xml
 
     Textures
 
     Textures
 
</pre>
 
</pre>
Line 85: Line 87:
 
Remember, this is the first line of every XML file.
 
Remember, this is the first line of every XML file.
 
<pre>
 
<pre>
<?xml version="1.0" encoding="UTF-8"?>
+
<?xml version="1.0” encoding="UTF-8”?>
 
</pre>
 
</pre>
 
Let's start by adding a new item to the game, open the “ThingDefs.xml” file and add the following code:
 
Let's start by adding a new item to the game, open the “ThingDefs.xml” file and add the following code:
Line 138: Line 140:
 
<pre>
 
<pre>
 
<comps>
 
<comps>
    <tickerType>Rare</tickerType>
+
     <li Class="CompProperties_Rottable"> <!-- This means that the comp can be rotated -->
     <li Class="CompProperties_Rottable"> <!-- This tells the game that the item can rot -->
 
 
         <daysToRotStart>2</daysToRotStart> <!-- This is the number of days it takes for the item to start rotting -->
 
         <daysToRotStart>2</daysToRotStart> <!-- This is the number of days it takes for the item to start rotting -->
 
         <daysToDessicated>3</daysToDessicated> <!-- This is the number of days it takes for the item to start desiccating -->
 
         <daysToDessicated>3</daysToDessicated> <!-- This is the number of days it takes for the item to start desiccating -->
Line 154: Line 155:
 
=GitHub files=
 
=GitHub files=
 
* All the files made in this tutorial can be found [https://github.com/Zeta-of-the-rim/RimWorld-Mod-Tutorials here] on GitHub. this allows you to download the files and use them as a reference when making your own mods.
 
* All the files made in this tutorial can be found [https://github.com/Zeta-of-the-rim/RimWorld-Mod-Tutorials here] on GitHub. this allows you to download the files and use them as a reference when making your own mods.
 +
* Bradson made a Mod template on GitHub, you can clone this to your profile and select is as template when you want to make your first mod. You can find it here: [https://github.com/bbradson/ModTemplate/ Mod template]
 
GitHub is a great tool for sharing code and is especially useful when you are ready to start programming in C#.
 
GitHub is a great tool for sharing code and is especially useful when you are ready to start programming in C#.
  

Please note that all contributions to RimWorld Wiki are considered to be released under the CC BY-SA 3.0 (see RimWorld Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Template used on this page: