Editing Modding Tutorials/Items

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 1: Line 1:
{{BackToTutorials}}
+
{{UC}}
{{delete|reason=Obsolete - See talk page}}
 
  
 
In this tutorial, we'll make a simple item. This item will act as a resource that can be hauled around and consumed.
 
In this tutorial, we'll make a simple item. This item will act as a resource that can be hauled around and consumed.
Line 7: Line 6:
  
 
You should have read the [[Modding Tutorials/Getting Started|Getting Started]] tutorial, which gets you up to speed with how mods are structured in RimWorld. You should also have a good understanding of where files are located (such as <code>About.xml</code>, def XML files, where you should put textures, and so on).
 
You should have read the [[Modding Tutorials/Getting Started|Getting Started]] tutorial, which gets you up to speed with how mods are structured in RimWorld. You should also have a good understanding of where files are located (such as <code>About.xml</code>, def XML files, where you should put textures, and so on).
 
== Making the folders ==
 
 
If you haven't already created a ThingDef folder as taught in the [[Modding Tutorials/Getting Started|Getting Started]] tutorial, you will need to create a new folder in which will contain your new item xml. Inside your <code>Defs</code> folder create a new subfolder called <code>ThingDefs</code>. You're now done as far as creating folders go.
 
 
== Creating the new resource item (Titanium example) ==
 
 
In this example, we'll be making a new resource called Titanium. This will be a resource in the game that can be used to make and build other things.
 
 
First of all we need to make it so the game will read this xml and let it know it's requesting new resources be added to the game.
 
Start of by making your xml look like this.
 
 
<source lang="xml">
 
<?xml version="1.0" encoding="utf-8" ?>
 
<Resources>
 
 
 
 
</Resources>
 
</source>
 
 
Now, we need to add a new abstract ThingDef which will be the base properties of the resource.
 
Add this Between <Resources> and </Resources>
 
 
<source lang="xml">
 
<ThingDef Name="ResourceBase" Abstract="True">
 
<defName>base_Resource</defName>
 
<thingClass>ThingResource</thingClass>
 
<label>Unspecified resource</label>
 
<category>Item</category>
 
<eType>Item</eType>
 
<resourceCountPriority>Middle</resourceCountPriority>
 
<useStandardHealth>true</useStandardHealth>
 
<selectable>true</selectable>
 
<maxHealth>100</maxHealth>
 
<altitudeLayer>Item</altitudeLayer>
 
<stackLimit>75</stackLimit>
 
<purchasable>true</purchasable>
 
<comps>
 
<li><compClass>CompForbiddable</compClass></li>
 
</comps>
 
<beauty>Ugly</beauty>
 
<alwaysHaulable>true</alwaysHaulable>
 
<drawGUIOverlay>true</drawGUIOverlay>
 
<rotatable>false</rotatable>
 
<pathCost>15</pathCost>
 
</ThingDef>
 
</source>
 
 
None of this changes, as we can override everything in the new resource def. Now add this under the new Abstract ThingDef but above </Resource> which should be at the bottom.
 
 
<source lang="xml">
 
<ThingDef ParentName="ResourceBase">
 
<defName>Titanium</defName>
 
<label>Titanium</label>
 
<description>A rare strong and useful metal.</description>
 
<texturePath>Things/Item/Resource/Titanium</texturePath>
 
<interactSound>MetalDrop</interactSound>
 
<basePrice>3</basePrice>
 
<useStandardHealth>false</useStandardHealth>
 
<storeCategories>
 
<li>ResourcesRaw</li>
 
</storeCategories>
 
</ThingDef>
 
</source>
 
 
Hopefully, you’ll be able to understand what each property is once you read the page on [[ThingDef|ThingDef]].
 
 
== Testing ==
 
 
Let’s test our new mod! Fire up RimWorld, making sure to turn on <code>Development mode</code> in the options menu. Open the mods menu and make sure your mod is ticked (For active), and then press the tilde key (~) to check for any errors thrown on runtime. That’s right, no errors! Now start a new game and activate <code>God mode</code>, then attempt to spawn your resource into the game! In further tutorials we will teach you how to add uses to this resource aswell as add ways to obtain it.
 
 
== Conclusion ==
 
 
You now know how to:
 
* make a simple resource
 
* know most of the thingDef's global attributes and their functions with the optional choices
 
 
Tutorial brought to you by Cala13er, If you have any questions about this tutorial. Message either Cala13er or Tynan on the forums.
 
 
Next we'll learn how to make a flooring!
 

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)

This page is a member of 1 hidden category: