Skip to content
ilikegoodfood edited this page Aug 27, 2019 · 22 revisions

What is a Verb?

Within RimWorld's code, attack options are defined as one of two broadly related entities.

  1. Tools are attack options that can only be used in melee combat. These options can be defined in the base code of RimWorld for equipment, Hediffs and race definitions. They are selected from at random during melee fights, and cannot be seected or controlled by the player.
  2. Verbs are ranged attack options. Every time a pawn fires a gun in RimWorld, they are using the verb that is defined by their equipment. While it is possible to add verbs to Hediffs and race definitions, RimWorld's base code does not provide any means of detecting or choosing between these verbs. The Verb Expansion Framework provides a means of viewing, selecting from and using these different verb sources.

Placing a Verb

Before defining the verb, you need to know where to put the definition that you are building. This differs slightly between equipment, Hediffs, and race definitions.

Equipment

Since there are so many examples of equipment already avialbale, this section will not cover them in detail. Instead, we recommend that you take a look at the weapons provided by RimWorld. All of these weapons and can be found by navigating to the game's mods folder. From there, go into Core/Defs/ThingDefs_Misc/Weapons and view the XML files in any text editor.

This is the code that amkes RimWorld run. It is vitally important that you do not change anything in these files!

HediffDefs

Health conditions, inlcuding infections, prostethics and wounds, are defined by HediffDefs. RimWorld's HediffDefs can be found by navigating to the game's mods folder. From there, go into Core/Defs/HediffDefs and view the XML files in any text editor.

This is the code that amkes RimWorld run. It is vitally important that you do not change anything in these files!

To attach a verb to a Hediff, you need to use the comp HediffCompProperties_VerbGiver. This comp needs to be added into the root of the HediffDef according to the structure shown below.

This is a placement guide, not functioning code. Do not just copy and paste it.

<HediffDef>
    <!--Contents of HediffDef-->
    <comps>
        <!--Contents of comps-->
        <li Class="HediffCompProperties_VerbGiver">
            <verbs>
                <li>
                    <!--Contents of Verb-->
                </li>
            </verbs>
        </li>
        <!--Contents of comps-->
    </comps>
    <!--Contents of HediffDef-->
</HediffDef>

Race Definitions

RimWorld's core race definitions can be found by navigating to the game's mods folder. From there, go into Core/Defs/ThinDefs_Races and view the XML files in any text editor.

This is the code that amkes RimWorld run. It is vitally important that you do not change anything in these files!

Each race contains a ThingDef and a PawnKindDef. For the purposes of adding a verb, we only need to concern ourselves with the ThingDef. Within the root of the definition, you need to add the Verbs according to the structure shown below.

This is a placement guide, not functioning code. Do not just copy and paste it.

<ThingDef>
    <!--Contents of ThingDef-->
    <verbs>
        <li>
            <!--Contents of Verb-->
        </li>
    </verbs>
    <!--Contents of ThingDef-->
</ThingDef>
<PawnKindDef>
    <!--Contents of PawnKindDef-->
</PawnKindDef>

Defining a Verb

In order to function, verbs must have a certain set of properties defined in XML. Most of these values have reasonable defaults, meanign that you do not need to declare the property's.

The most commonly altered properties and their values can be seen by examining the verbs in RimWorld itself. All of these verbs are attached to the game's weapons and can be found by navigating to the game's mods folder. From there, go into Core/Defs/ThingDefs_Misc/Weapons and view the XML files in any text editor.

This is the code that amkes RimWorld run. It is vitally important that you do not change anything in these files!

Verb Properties

This is a list of the most important tags, some of their possible values, and their uses.

<verbClass></verbClass>

verbClass tells RimWorld which behaviour set the verb should have. There are only a small set of options:

  • Verb_Shoot is used by most weapons. It is used to make a shot that is repeatable.
  • Verb_ShootOneUse ise used by certain rocket launchers and other once-use pieces of equipment. Once fired, it destroyes the equipment that was used to fire it. Hediffs and race definitions should use Verb_Shoot instead.
  • Verb_Spawnis not used by any item in RimWorld. It allows you to set a ThingDef as an entity to be spawned when the piece of equipment is used, and then it destroys that piece of equipment. If used on Hediffs or race definitions, it can be used an endless number of times. If a pawn has multiple verbs of this type, only one will be usable by the AI. Other types of specialized verbs exist, but are not useful for the creation of new attacks.
<label></label>

label is the string used to display the name of the thing to the player in game. The label should be written entirely in small leters, and with spaces. It is not used in RimWorld itself, as there is no way to see a verb's label, but VEF makes use of it for custom labeling of the verb gizmo.

<minRange></minRange>

minRange is a float that specifies the minimum distance that the verb's user must be from the target in order to use the verb on it. This is highly recommended for area of effect (AoE) weapons such as grenades, molatovs and rocket launchers that would otherwise kill the user.

<range></range>

range is the maximum range of the verb. It cannot be used on a traget that is further away from the verb's user than this distance. Make sure you define it corectly.

<accuracyTouch></accuracyTouch>
<accuracyShort></accuracyShort>
<accuracyMedium></accuracyMedium>
<accuracyLong></accuracyLong>

These four values specify the accuracy of the weapon at different ranges. Touch is almost but not quite melee range. These four values need to be set to a decimal figure between 0 (will always miss) and 1 (will always hit).

<burstShotCount></burstShotCount>

burstShotCount is the number of individual projectiles that are created when the verb is used. It has a default value of 1.

<ticksBetweenBurstShots></ticksBetweenBurstShots>

ticksBetweenBurstShots specifies the delay that occurs between each individual shot of a burst being fired. It is only necessary if the burstShotCountis greater than 1, and it is defined in ticks. Each tick is 1/60th of a second. It is possible to use demical values of ticks.

<hasStandardCommand></hasStandardCommand>

Verbs with hasStandardCommand that are attached to a pawn's equipment can be used through the equipment and verb buttons. Since it has no default value, it is imperrative that it be included in verbs that are attached to equipment.

<onlyManualCast></onlyManualCast>

Verbs with onlyManualCast will not be used by your colonists unless you specifically tell them to shoot it at a given target. This is highly recommended for any verb that is only usable once (Verb_Spawn or Verb_ShootOneUse if attached to a piece of equipment).

<warmupTime></warmupTime>

warmupTime specifies, in seconds, the amount of time it takes a pawn to fire a burst from first aquiring a target. All RimWorld verbs use it.

<defaultCooldownTime></defaultCooldownTime>

defaultCooldownTime is the direct verb version of RangedWeapon_Cooldown. All verbs that are not attached to equipment should have a defaultColdownTime.

<defaultProjectile></defaultProjectile>

defaultProjectile is the projectile defName of the projectile that verb will fire. Without it, any verb that creates a projectile will not work.

<ai_IsWeapon></ai_IsWeapon>

ai_IsWeapon is true by default. It enables the AI to use the weapon in combat against other entities. If the verb is not suitable for combat, set this to false.

<ai_IsBuildingDestroyer></ai_IsBuildingDestroyer>

ai_IsBuildingDestroyer lets the AI know that weapon is good at and should be used to destroy buildings. Certain types of enemy will spawn with weapons with this property.

<ai_AvoidFriendlyFireRadius></ai_AvoidFriendlyFireRadius>

ai_AvoidFriendlyFireRadius is only necessary for weapons with an area of effect (AoE), such as grenades, molotiovs, or rocket launchers. It tells the AI how much space should be between the target of the verb and the nearest friendly creature or person. Without it, colonists and invaders alike will blast eachother with it with no regards to friendly fire.

<soundCast></soundCast>
<soundCastTail></soundCastTail>
<soundAiming></soundAiming>

These three define the sounds that are played when the verb fires a projectile, the sound that fasedes after the shots, and the sound that plays while aiming the weapon respectively. soundAiming is not normally used. To find out what sounds are available in RimWorld itself, look through the verbs provided as part of the weapon definitions, or download the official assets sources from the Ludeon Forums.

<muzzleFlashScale></muzzleFlashScale>

muzzleFlashScale is an optional multiplier for the size of the muzzle flash. It can be used to increase the size of teh muzzle flash for very high-power weapons, or reduce it for very low-power, or non-gun weapons.

<forcedMissRadius></forcedMissRadius>

forcedMissRadius is used to prevent excessive overlap between areas of effect (AoEs) for AoE weapons that fire bursts larger than 1. It is highly recommended to be used in these instances. RimWorld's weapons have this value set slightly smaller than then explosion radius on the projectile. Do not use it if the projectile is not explosive.

<spawnDef></spawnDef>

spawnDef is only used for verbs of the Verb_Spawn class. It specifies the ThingDEf that should be spawned when the verb is used.