Plague Gun/Introduction

From RimWorld Wiki
Jump to navigation Jump to search

Modding Tutorials

This page is obsolete for the current version of RimWorld and is kept as a resource for modders of previous versions. For the current version see: Plague Gun (1.1)

This tutorial was originally written by Jecrell. Thread.

Introduction

In this tutorial we're going to create a weapon that covers many different aspects of RimWorld's systems. This provides us with a clearer understanding of how RimWorld works for modding.

By following this tutorial, you will be able to do your own complex RimWorld modding in XML and C# in the same way that I can. I will give you all my tools and know-how.

This weapon will be known as The Plague Gun. When fired, if it hits its target, it will have a chance to make the target catch the plague.

To make this mod happen, we will need to create the ThingDefs in XML for the bullet and gun, and create a C# assembly that uses the Projectile class to define a new Impact event for our plague projectile.

This tutorial cannot fully teach XML and C#, and it can help you familiarize yourself a bit with them, but there are lots of free resources online to learn them.

  1. XML -> https://www.w3schools.com/xml/
  2. C# -> http://www.learncs.org/

The completed mod

For a working example, check out this GitHub repo.

See also

  1. Required Items
  2. XML Stage
  3. Connecting XML and C#
  4. C# Assembly Setup
  5. C# Coding
  6. Localisation