HOW TO MAKE A WEAPON MOD [Rimworld] (custom weapon/gun)

RimWorld677 views39 favorites8 min readby MR HEIZENBURGERUpdated 7 Sep, 2025View on Steam ↗

Mod structure

In this guide you will learn how to make that thing that is nowhere to be found, but you really want to see it.
Let's start with the mod structure.
Any mod is divided into 3 or more folders:
  • About
  • Defs
  • Textures
The About folder contains a file by which the game 'recognizes' your mod, as well as a preview of the mod with a resolution of 640*360

The Defs folder contains scripts for weapons/technologies, etc.

The Textures folder contains all the textures of your mod.

Creating About.xml

Create a folder with any name and create 3 more folders with the names above in it.
In the About folder, create a text file and change its name and format to About.xml

Insert the following code into the file:
<?xml version="1.0" encoding="utf-8"?> <ModMetaData> <name>Your mod name</name> <author>Your nick</author> <description>Mod description</description> <packageId>Your_mod_name.Your_nick</packageId> <supportedVersions> <li>1.6</li> </supportedVersions> <loadAfter> <li>Ludeon.RimWorld</li> </loadAfter> </ModMetaData>
Change the lines name author description and packageId.
There should be NO spaces in the packageId line!

supportedVersions - supported versions, i.e. 1.1 1.2 1.4 etc.
loadAfter - after which your mod will be loaded (In this case, after the official rimword content, it is better not to change it)

To add a preview, simply add the desired 640*360 image named Preview.png to the about folder (Optional)

If you have not created a folder with the mod in the rimworld mods folder, then move it there.
After creating this file, your mod will already be displayed in the mods menu.

Defs

The Defs folder contains your mod's scripts, let's look at melee and ranged weapons.
Create a file with your name and xml extension, for example gun.xml
Paste the following script into it -
For melee:
<?xml version="1.0" encoding="utf-8"?> <Defs> <ThingDef ParentName="BaseMeleeWeapon_Sharp_Quality"> <!--This line determines whether your weapon will be sharp or dull.(Sharp или Blunt) Quality - does the weapon have quality after crafting (normal, masterpiece, bad, etc.)--> <defName>gun_name_for_game(no spaces)</defName> <label>Gun name</label> <description>Description</description> <graphicData> <texPath>Texture name in textures folder format png (example - gun.png)</texPath> <graphicClass>Graphic_Single</graphicClass> </graphicData> <costList> <Steel>80</Steel> <Plasteel>100</Plasteel> <ComponentIndustrial>6</ComponentIndustrial> <!--Here we write the resources required to create weapons. Examples: ComponentIndustrial - component, ComponentSpacer - advanced component, wood--> </costList> <statBases> <WorkToMake>12000</WorkToMake> <!--How much work does it take to create--> <Mass>3</Mass> <!--Mass--> <DeteriorationRate>0</DeteriorationRate> <!--How fast does the weapon rot? 1 - normal speed, 0 - does not rot.--> <AccuracyTouch>0.95</AccuracyTouch> <!--Weapon accuracy--> <AccuracyShort>0.85</AccuracyShort> <AccuracyMedium>0.75</AccuracyMedium> <AccuracyLong>0.65</AccuracyLong> <!--In theory, the rest of the accuracy can remain unchanged, it doesn't affect anything --> <RangedWeapon_Cooldown>1.5</RangedWeapon_Cooldown> <!--In theory it doesn't affect anything (without these lines it didn't work for me)--> </statBases> <equippedStatOffsets> <MoveSpeed>0.3</MoveSpeed> <!--Modifiers when wearing MoveSpeed ​​- speed--> </equippedStatOffsets> <weaponTags> <li>Archotech</li> <!--Weapon tags Industrial, Medieval, Spacer etc. It doesn't matter to the player--> </weaponTags> <recipeMaker> <skillRequirements> <Crafting>10</Crafting> <!--Skill level required--> </skillRequirements> <researchPrerequisite>ArchotechWeapons</researchPrerequisite> <!--(OPTIONAL STRING)WITHOUT STRING WEAPON IS AVAILABLE IMMEDIATELY. Required research for crafting, below will tell you how to make a custom one. Vanilla research can be found in the rimworld core defs.--> </recipeMaker> <!--Below will come the types of strikes (with a handle, blade, etc.)--> <tools> <li> <label>label in game</label> <capacities> <li>Cut</li> <!--Damage type Cut, Stab, Blunt--> </capacities> <power>26</power> <!--Basic damage(qty-normal)--> <cooldownTime>1.5</cooldownTime> <!--Hit cooldown time in seconds--> <armorPenetration>0.75</armorPenetration> <!--Armor Penetration--> </li> </tools> <tools> <li> <label>point</label> <capacities> <li>Stab</li> </capacities> <power>22</power> <cooldownTime>1.4</cooldownTime> <armorPenetration>0.9</armorPenetration> </li> </tools> </ThingDef> </Defs>
IF SOMETHING DOESN'T WORK TRY DELETING COMMENTS - <!--comment-->
OR ASK ME A QUESTION

Ranged Defs

If something in the code does not work, try deleting the comments, as some of them can be read by the game as code - < !-- -- >
<?xml version="1.0" encoding="utf-8" ?> <Defs> <ThingDef ParentName="BaseHumanMakeableGun"> <defName>Label_for_game</defName> <label>Label in game</label> <description>Description</description> <graphicData> <texPath>Path to the image (png format, just the name of the texture if it is in the textures folder)</texPath> <graphicClass>Graphic_Single</graphicClass> </graphicData> <soundInteract>Interact_Rifle</soundInteract> < !--Sound when picking up, can be found in the game files (this vanilla one)-- > <generateCommonality>0.3</generateCommonality> < !--prevalence of weapons-- > <weaponClasses> <li>RangedHeavy</li> </weaponClasses> < !--Weapon class(can be skipped)-- > <weaponTags Inherit="False"> <li>HeavyGrenade</li> </weaponTags> < !--Weapon tag(can be skipped)-- > <tradeTags> <li>WeaponRanged</li> </tradeTags> < !--Trade tag weapons(can be skipped)-- > <statBases> <WorkToMake>30000</WorkToMake> <Mass>3.4</Mass> < !--Mass and work needed to create-- > <RangedWeapon_Cooldown>4</RangedWeapon_Cooldown> </statBases> <costList> <Steel>75</Steel> <ComponentIndustrial>8</ComponentIndustrial> </costList> < !--What weapons are made of (list of examples were in melee defs)-- > <recipeMaker> <skillRequirements> <Crafting>5</Crafting> </skillRequirements> < !--Skill level required to create-- > <researchPrerequisite>MicroelectronicsBasics</researchPrerequisite> < !--What research is required to create (research defname needed)-- > <displayPriority>471</displayPriority> </recipeMaker> < !--Affects the display order in the study-- > <verbs> <li> <verbClass>Verb_Shoot</verbClass> <hasStandardCommand>true</hasStandardCommand> <defaultProjectile>Defname вашего снаряда(ниже)</defaultProjectile> <warmupTime>3</warmupTime> < !--Affects the speed of weapon preparation (in seconds)-- > <range>30</range> < !--Weapon range-- > <forcedMissRadius>1</forcedMissRadius> < !--THIS LINE IS ONLY FOR GRENADE LAUNCHER ETC (IT MUST BE REMOVED FOR OTHER WEAPONS)-- > <burstShotCount>1</burstShotCount> < !--How many shells will your gun fire at once?-- > <ticksBetweenBurstShots>40</ticksBetweenBurstShots> < !--THIS LINE ONLY IF BURSTSHOT IS GREATER THAN 1 (REMOVE IF 1)-- > <soundCast>Shot_IncendiaryLauncher</soundCast> <soundCastTail>GunTail_Medium</soundCastTail> < !--The sounds of your weapon can also be found in the game files, example - ChargeLance_Fire - energy spear-- > <muzzleFlashScale>14</muzzleFlashScale> < !--Muzzle flash size when fired (cosmetics)-- > <targetParams> <canTargetLocations>true</canTargetLocations> < !--Can it target the ground like a grenade?-- > </targetParams> </li> </verbs> <tools> <li> <label>stock</label> <capacities> <li>Blunt</li> </capacities> <power>9</power> <cooldownTime>2</cooldownTime> </li> < !--Your weapon's melee attack type (sharp/blunt), damage, cooldown time-- > <li> <label>barrel</label> <capacities> <li>Blunt</li> <li>Poke</li> </capacities> <power>9</power> <cooldownTime>2</cooldownTime> </li> < !--Your melee weapon's attack type (sharp/blunt), damage, cooldown time-- > </tools> </ThingDef> < !--Below is a description of your bullet (this is all one file)-- > </ThingDef> <ThingDef ParentName="BaseBullet"> <defName>BULLET DEFINITION YOU INSERT IT INTO THE WEAPON LINE (without spaces)</defName> <label>LABEL IN GAME</label> <graphicData> <texPath>path to texture</texPath> <graphicClass>Graphic_Single</graphicClass> <shaderType>TransparentPostLight</shaderType> <drawSize>0.5</drawSize> < !--bullet draw size-- > </graphicData> <projectile> <damageDef>Bullet</damageDef> < !--Damage type, more examples - Bomb and Fire-- > <damageAmountBase>30</damageAmountBase> < !--Base damage at normal quality-- > <armorPenetrationBase>0.7</armorPenetrationBase> < !--How well does your weapon penetrate armor-- > <stoppingPower>1</stoppingPower> < !--Stopping ability (slow damage)-- > <speed>100</speed> < !--The speed of your projectile-- > </projectile> </ThingDef> </Defs>
A separate example of a bullet script for a grenade launcher or rocket launcher (anything exploding):
<ThingDef ParentName="BaseBullet"> <defName>BULLET DEFINITION YOU INSERT IT INTO THE WEAPON LINE</defName> <label>bullet label</label> <graphicData> <texPath>path to texture (just the name of the texture if it is in the textures folder)</texPath> <graphicClass>Graphic_Single</graphicClass> <shaderType>TransparentPostLight</shaderType> <color>(140,135,156)</color> </graphicData> <thingClass>Projectile_Explosive</thingClass> <projectile> <speed>45</speed> <damageDef>Bomb</damageDef> <explosionRadius>2</explosionRadius> < !-Радиус взрыва-- > <explosionRadiusDisplayPadding>2</explosionRadiusDisplayPadding> <ai_IsIncendiary>true</ai_IsIncendiary> < !--is it incendiary(Is AI)-- > <arcHeightFactor>0.2</arcHeightFactor> <shadowSize>0.6</shadowSize> <screenShakeFactor>0.6</screenShakeFactor> < !-Screen shake-- > </projectile> </ThingDef> </Defs>
If something in the code does not work, try deleting comments (< !-- -- >), as some of them can be read by the game as code.

Research Defs

This section is only for those who do custom studies.
Create another xml file and insert the following code:
<Defs> <ResearchProjectDef> <defName>THE DEFNAME MUST BE INSERTED INTO THE WEAPON(without spaces)</defName> <label>label in game</label> <description>Description in game</description> <baseCost>6000</baseCost> <!--How many study points are needed--> <techLevel>Archotech</techLevel> <!--Medieval Industrial Spacer etc--> <prerequisites> <li>MultiAnalyzer</li> <!--After which technology does yours come?--> </prerequisites> <researchViewX>6.00</researchViewX> <researchViewY>4.00</researchViewY> <!--Graphical layout in the studies tab--> </ResearchProjectDef> </Defs>
That's all for the scripts, all that's left is to make the textures.

Textures

It's time for the last folder of your mod.
Weapon textures are usually 64*64 pixels, you can have more, but without the option enabled in the settings, the game will 'compress' your texture to 64*64.
I use Photoshop to create textures, but at worst, paint will do.
There is no specific algorithm for creating an ideal texture, but here are some tips from official and semi-official sources:
  • It is better not to create details on the texture smaller than 3 pixels, if the contrast is low, because they will blend in with the environment

  • Almost all vanilla textures have a stroke of 1 layer of black pixels, so that the texture is easier to distinguish.

  • Too bright and prominent details, especially small ones, hurt the eye, it is better to adhere to a single style.
If you are really lazy, here are several textures, all vanilla except the first one.
https://images.steamusercontent.com/ugc/10098245677582381428/3AB16ADFE672D125AF8C2EC3D45D37A56EFC0496/?imw=256&&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=false

AR

https://images.steamusercontent.com/ugc/12396468455816294815/DC3A4C6DD56C60FB3D03D998DF5775606B0BA2F2/?imw=256&&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=false

Sniper riffle

https://images.steamusercontent.com/ugc/9604042858718696344/04CE1A38310F70337EF7C8689DF73C58865D7848/?imw=256&&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=false

Two-handed sword

https://images.steamusercontent.com/ugc/13537722830701001543/BEC1FAD21D2E0C3E48FCE696E06CC00E9C59F889/?imw=256&&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=false

Grenade launcher

You can find more textures on the Internet, they were officially posted by the developer (they are not in the game files)
Also, additional information on mods, scripts, etc. is on the rimworld website (search for rimworld modding) there is information in English

Conclusion

THE MOST IMPORTANT THING!!! If you want to make any mod that does not require creating c# scripts, but do not know how to create it, then just find a similar mod in the workshop and change its Defs and textures for yourself. Mods from the steam workshop are stored in the steam/steamapps/worksop/content/294100 folder

If you want to upload your mod to the workshop, then in the modding tab your mod will have an advanced settings tab, through which your mod will be uploaded to steam (only the official version of the game)

This is a completely original guide written by me. I am not the most experienced modder, but I did, and most importantly, I figured out how to make mods for a wide variety of weapons. If you have any questions, ask them below.
Perhaps there will be more guides on custom clothing (here you will need to draw a lot of textures), plants and much more.

This guide was created by its original author on the Steam Community. Are you the author and want it removed? Request removal.