Running With Rifles Wiki
Advertisement

There are five things you need to know in order to create your own weapon.


1. IT IS VERY IMPORTANT to make a backups folder WHENEVER you're modifying vanilla_winter or vanilla. If you fail to do so, you may never play RWR multiplayer ever again! (incompatibility) Also, making a backups folder inside vanilla file doesn't affect the game at all.


2. The Model: The model is made with the RWR Voxel Editor, and detailed instructions for use can be found here: How to use RWR voxel editor. While this will likely be the most difficult part of the process, simply stated, it's just forming the blocks to look like a gun. From close up it will look blocky but when viewed at a distance, your gun will look like a gun (Yay!). See the example file inside the voxel editor folder to take a closer peek at a pre-existing gun. Just remember to make sure that the size of your model isn't too big or too small for the weapon you are trying to make.


3. Sounds: You could just take sounds for your new weapon from the existing Running With Rifles files, however, a second option is to download an audio file from internet. One common problem with sounds downloaded from internet is that they are sometimes too loud when compared to the in-game sounds. If this happens to you, just get a sound editor program (e.g. Audacity) and fix the problem.


4. Stats: Weapon statistics are where a weapon gets its power and its features. These scripts control how the weapon performs in game.

The following are the stats for the G36 for example:
<?xml version="1.0" encoding="utf-8"?>
<weapon file="base_primary.weapon" key="g36.weapon">
    <tag name="assault"/> 
<specification 
          retrigger_time="0.110" 
          accuracy_factor="1.0" 
          sight_range_modifier="1.0" 
          sustained_fire_grow_step="0.36" 
          sustained_fire_diminish_rate="1.38" 
          magazine_size="30" 
          can_shoot_standing="1" 
          suppressed="0" 
          name="G36" 
          class="0" 
          projectile_speed="100.0" 
          barrel_offset="0.4" />

<animation key="recoil" ref="12"/> 
<animation key="recoil" ref="13"/> 
<animation key="recoil" ref="14"/> 
<animation state_key="reload" animation_key="reloading, g36"/> 

<animation state_key="celebrate_shoot" animation_key="celebrating, shooting"/> 

<sound key="fire" fileref="g36_shot.wav" pitch_variety="0.06" volume="0.8"/> 
<sound key="magazine_out" fileref="rifle_clip_out.wav" />
<sound key="magazine_in" fileref="rifle_clip_in.wav" />
<sound key="cycle" fileref="rifle_chamber.wav" />
<sound class="impact" fileref="rifle_drop.wav" />

<model filename="assault_rifle2.xml" />

<hud_icon filename="hud_g36.png"/> 

<commonness value="0.2"/> 
<inventory encumbrance="11.0" price="2.0"/> 

<weak_hand_hold offset="0.0"/>
<projectile file="bullet.projectile"
        result class="hit"  kill_probability="0.5" kill_decay_start_time="0.35" kill_decay_end_time="0.70" 
</projectile>

<modifier class="speed" value="-0.018"/> 

</weapon>


For a simple mod, "commonness value", "price", "name", "suppressed", "can shoot standing/crouching", and "magazine size" are the only settings you need to mess with.

For more advanced modifications, the table below should help explain the less self-explanatory parts of the script:


Script Explanation
<?xml version="1.0" encoding="utf-8"?> This is the XML declaration, unless you are absolutely sure of what you are doing, try not to mess with it.
weapon file="base_primary.weapon" dictates the weapon base there are two primary weapon bases base_primary and base_primary_rare these just tell how long it takes for the weapon to despawn. (base is like 30 seconds rare is 90 seconds)
key="g36.weapon" this is the weapons key, this is what you would be putting into the faction file for the team you want for example for the g36 you would put in the following <weapon key='g36.weapon' /> this would go in the faction primaries file. (another topic)
tag name="assault" This is the tag for the weapon type, other tags are assault, machine gun, sniper, cqb, stealth, flashbang, bazooka and more this determines how the AI uses and responds to the weapons for example cqb are close quarters combat weapons and are used as such.
specification This is the parts that determine the weapons stats
retrigger_time="0.110" How much you have to wait between each shot. Divide 60 by the desired RPM (rounds/bullets per minute) to determine retrigger_time. e.g. 60/545.45 = 0.11. If you add a - or minus before the retrigger time, like "-1.0" it means you won't be able to hold the mouse button to fire it automatically, aka you have to click the mouse button for each shot. Usually used for bolt action weapons and the like.
accuracy_factor="1.0" how accurate the weapon is when used is between 1.0 and 0.0, 1 being 100% accurate while 0, well, please don't set it to that!
sight_range_modifier="1.0" weapons with a zoom (e.g. sniper rifles have a higher value. If not specified or a value of "1.0" then it's default sight range
sustained_fire_grow_step="0.36" This value determines how much recoil value the gun will obtain with every shot, it is recommended to go with your gut and learn after if you are a first-time modder. Values above 1 don't seem to have any additional effect on recoil.
sustained_fire_diminish_rate="1.38" This value represents how much recoil value the gun will remove every SECOND. Remember that this value often determines if a gun is UP (underpowered) perfectly balanced, or OP. (overpowered) A good rule to stick to when editing this value is that, the higher you set this value, the higher recoil per shot and/or a faster RPM you will need to compensate for a faster recoil recovery. Unlike sustained_fire_grow_step, values above 1 do have an effect and increase recoil recovery.
magazine_size="30" This value determines how many bullets/rounds you can shoot from this gun before it needs you to reload it.
can_shoot_standing="1" "1" is yes, "0" is no. The value "0" is mostly used on LMGs which can only be shot while prone.
suppressed="0" "1" is yes, "0" is no. If set to 1, a shot of the weapon will not alert an enemy. A suppressed weapon always has a 100% kill probability on a non-alerted enemy as long as the shooter is not seen by the enemy.
name="G36" This is the name of your weapon, and does not have any gameplay effect, other than maybe you would want to name your gun 'The Pew pew gun' for pure entertainment, or for identification.
class="0" Dictates if the weapon is fully automatic (0), semi automatic/burst-fire (4), bolt-action (2), or other/misc deployable (5). note if class four burst_shots="#" determines how many shots are fired per burst
projectile_speed="100.0" This controls the speed your bullet travels at. 100 is very likely the standard. Changing projectile speed needs to be handled carefully because it affects a lot of other things too. For example, the kill decay is measured in seconds, so if you double the projectile speed without changing the kill decay stats, you will effectively double the range of the weapon. Another effect of projectile speed is that higher projectile speed makes weapons more accurate and lower projectile speed makes weapons less accurate. While it isn't too noticeable in the 100-200 ranges, at extreme values of 300+ projectile speed, weapons become insanely accurate, with recoil and accuracy penalties from movement barely having any effect.
barrel_offset="0.4" define the distance away from the end of the barrel that the bullet begins to exist when fired. Weapons have different length, thus having different offset values.
animation key the animation keys are referencing the soldier_animations.xml which holds all animations for the soldiers these basically tell what animations are being used, and if you have the know how/experience allows you to make custom ones. Note that reload speed is determined by the length of the reload animation.
sound key="fire" fileref="g36_shot.wav" "Sound key" refers to different actions that the weapon takes, namely "fire", "magazine out/in", and "cycle" if you got custom audio files for your weapon, you will need to edit these entries.
pitch_variety="0.06" volume="0.8" Shot sound volume adjustment. The pitch variety adds a random pitch withing the value to give the shot sounds a bit of randomness.
model filename="assault_rifle2.xml" This section determines what model the weapon will use, and determines how it appears IN-GAME.
hud_icon filename="hud_g36.png" This section determines is what model the weapon will use for its HUD icon.
commonness value="0.2" This multiplied by 100 is the percentage of the likelihood of an AI soldier to spawn with this weapon.
inventory encumbrance="11.0" This designates weight; multiply by 10 for % weight (e.g. all basic ARs weigh 11.0 = 110%). Remember that for extra-light things, you can set this to a decimal number, like 0.2 for 2% weight.
price="2.0" This designates price, in RP. Note that this is unlike XP value, every ONE unit of RP will equal ONE unit of actual RP in-game. It is not recommended to set this to something like 1.5
weak_hand_hold offset="0.0" used in animations only, basically how far the "Weak hand" can go from the gun in an animation.
projectile file="bullet.projectile" This section selects what projectile is used by the weapon when it is shot.
result class="hit" Don't change this part at all, leave it alone or the game will likely break.
kill_probability="0.5" This is the probability that a hit will result in a kill. (or any other state specified in 'character_state=?' This is not accuracy. If you set this to 1.0, for example, it means every bullet that hits an enemy will ALWAYS inflict the specified character_state onto that character. If you set this to 0.0, you might as well name that gun 'Toy AK47' or something. Kill probabilities of more than 1 can destroy multiple vest/armor layers corresponding to the kill probability, for example a bullet with 3 kill probability will go through 3 vest layers.
kill_decay_start_time="0.35" kill_decay_end_time="0.70" kill_decay_start_time represents how long it takes before the bullet loses power. This has a big impact on the weapon's effective range.

kill_decay_end_time is how long it takes for the bullet to become ineffective. This decides the maximum range of the weapon.

Logically, the higher bullet caliber, both these values will become higher as it has more power.

OTHER STATS
projectiles_per_shot="5" Used by shotguns to determine pellet/shot count every time the weapon is shot. (Not used on the G36).
character_state="stun" goes after decay time determines what happens if the projectile hits, can have 'kill', 'wound', 'stun', or 'none' set. Note that if unspecified, this option will default to 'kill', and vests can make a difference.
modifier class="speed" value="-0.05" modifies movement speed while carrying the weapon (relative to the speed when weaponless), for example the G36 reduces your movement speed by -1.8%, while -0.05 means your movement speed is decreased by -5%!
reload_one_at_a_time="1" "0" means that it reloads a full magazine at time, "1" means it reloads only one projectile (shotguns for example)
stance state_key=? found in some weapons allows you to modify the accuracy per stance, for example stance state_key="running" accuracy="0.5" would make a weapon 50% accurate while running even if the weapon was a 100% accurate weapon. The lower the number, the greater the accuracy penalty for that stance.
when not specified, the default values are as following:
    <stance state_key="running" accuracy="0.3" />
    <stance state_key="walking" accuracy="0.675" />
    <stance state_key="crouch_moving" accuracy="0.75" />
    <stance state_key="standing" accuracy="0.85" />
    <stance state_key="crouching" accuracy="0.9" />
    <stance state_key="prone" accuracy="0.93" /> 
    <stance state_key="prone_moving" accuracy="0.3" />
    <stance state_key="over_wall" accuracy="0.85" /> 
can_shoot_crouching="1" Like 'can_shoot_standing', and usually used in conjunction with 'can_shoot_standing = 0' on LMGs to disable the player from crouching while shooting given weapon. This will default to 1 if not defined.
can_shoot_prone="1" Rarely used, but this works like 'can_shoot_standing' and 'can_shoot_crouching'. When set to 0 you can't shoot the weapon while prone.
drop_count_factor_on_death="1.0" You can add this value after key=something, which determines in percentage the chance of dropping the weapon after its user is killed. and it varies from 0.0 to 1.0, set this to 0.0 if you don't want anyone to pick up this weapon, otherwise it will default to 1.0 if not defined.
time_to_live_out_in_the_open="45.0" This is how long the weapon stays as a pickup item after being dropped before disappearing, in seconds.
burst_shots="6" Mainly used to determine how many bullets should be fired in a single burst by burst-fire weapons, but can also be set to 1 to force the weapon to behave like a semi-automatic.
slot="1" When set to 0, the weapon will take the primary slot. When set to 1, the weapon will take the secondary slot.
stab_enabled="0" Whether you can stab with the weapon. When set to 0, you can't stab, and when set to 1, you can.
consume="1" For medkits, wrenches, and other consumables, this determines whether the weapon will be consumed upon use. 1=yes, 0=no.
carry_in_two_hands="0" Whether this weapon is carried with two hands, or one hand. When set to 0 the weapon is carried with one hand, perfect for pistols.
use_basic_muzzle_smoke_effect="0" When set to 0, the weapon won't emit smoke from the barrel when shooting. Perfect for bows, crossbows, and other non gunpowder weapons.
in_stock="1" Whether the weapon can be purchased at the armory. 1=yes, 0=no.
can_respawn_with="1" Whether the weapon can be given to respawning players. This doesn't affect AI soldiers, whose weapons are decided by files in the 'factions' folder.
hud_icon filename="hud_wrench.png" Determines how the weapon will show up in the player's HUD. These files should be located in the 'textures' folder.

A notice there are many other stats for the weapons, but these are just the basic, best way to learn is to rip open the text files and start messing around you will never know what you might find. (remember though, backups folder!)

For example this article doesn't even go over arced projectiles and custom bullets.


5. Weapon HUD: This is optional but strongly recommended for a proper weapon mod. All you really need to do is modify the HUD for your weapon from a picture you snagged from the interwebs, another game, or your friend who spends all his time making vector drawings in Adobe Illustrator. Whatever route you go, make sure that your weapon's image is standing with it's barrel pointed up, in proper Running With Rifles fashion. If you really want you get fancy and know your way around Gimp or Photoshop, you should try to add some shadow and polish to make it fit in with the "factory settings" RWR guns. While you may not care for your own personal use, if you intend to share your mod with others, they will probably appreciate it. Generally speaking, if it looks like it was meant to be there in the first place, it will be a much more appreciated mod than if it sticks out like a sore thumb. Microsoft Paint should be enough, but an advanced picture editing program is recommended so you can make your HUD shiny. If you don't already have it, gimp is a free, open-sourced, advanced picture editing program for all of your image editing needs.


If you can add more information to this entry, please, don't hesitate to edit it.

Advertisement