weapon

🚧 This incomplete article needs help! Please submit tips and info by pull requests or issues or contacting a maintainer.

Weapons are most commonly seen as the wieldable items dropped by enemies and found in the environment. However, they are also used for items like the CTF flag, oddball, and weapons attached to vehicles.

Weapons are intended to fire instances of the projectile tag, but they can technically reference any object (spawning bipeds, for example). Thrown grenades are not a type of weapon, but rather a projectile referenced by globals.

Structure and fields #

This tag inherits fields from item which are not shown here. See the parent's page for more information. The following information is unique to the weapon tag.

Field Type Comments
weapon flags bitfield(32)
Flag Mask Comments
vertical heat display 0x1
mutually exclusive triggers 0x2
attacks automatically on bump 0x4
must be readied 0x8
doesn't count toward maximum 0x10

Used for weapons like the oddball and flag which technically count as a third carried weapon, despite the game having a soft limit of 2 held weapons (scripts and mods aside).

aim assists only when zoomed 0x20
prevents grenade throwing 0x40
must be picked up 0x80
holds triggers when dropped 0x100
prevents melee attack 0x200
detonates when dropped 0x400

Causes the weapon to explode using its item detonation effect after being dropped. This is used to make the singleplayer fuel rod gun and energy sword explode when the enemies who carry them die.

cannot fire at maximum age 0x800
secondary trigger overrides grenades 0x1000
obsolete does not depower active camo in multilplayer 0x2000
enables integrated night vision 0x4000
ais use weapon melee damage 0x8000
label char[32]
secondary trigger mode enum
Option Value Comments
normal 0x0
slaved to primary 0x1
inhibits primary 0x2
loads alterate ammunition 0x3
loads multiple primary ammunition 0x4
maximum alternate shots loaded u16
weapon a in enum
Option Value Comments
none 0x0
heat 0x1
primary ammunition 0x2
secondary ammunition 0x3
primary rate of fire 0x4
secondary rate of fire 0x5
ready 0x6
primary ejection port 0x7
secondary ejection port 0x8
overheated 0x9
primary charged 0xa
secondary charged 0xb
illumination 0xc
age 0xd
integrated light 0xe
primary firing 0xf
secondary firing 0x10
primary firing on 0x11
secondary firing on 0x12
weapon b in enum
Option Value Comments
none 0x0
heat 0x1
primary ammunition 0x2
secondary ammunition 0x3
primary rate of fire 0x4
secondary rate of fire 0x5
ready 0x6
primary ejection port 0x7
secondary ejection port 0x8
overheated 0x9
primary charged 0xa
secondary charged 0xb
illumination 0xc
age 0xd
integrated light 0xe
primary firing 0xf
secondary firing 0x10
primary firing on 0x11
secondary firing on 0x12
weapon c in enum
Option Value Comments
none 0x0
heat 0x1
primary ammunition 0x2
secondary ammunition 0x3
primary rate of fire 0x4
secondary rate of fire 0x5
ready 0x6
primary ejection port 0x7
secondary ejection port 0x8
overheated 0x9
primary charged 0xa
secondary charged 0xb
illumination 0xc
age 0xd
integrated light 0xe
primary firing 0xf
secondary firing 0x10
primary firing on 0x11
secondary firing on 0x12
weapon d in enum
Option Value Comments
none 0x0
heat 0x1
primary ammunition 0x2
secondary ammunition 0x3
primary rate of fire 0x4
secondary rate of fire 0x5
ready 0x6
primary ejection port 0x7
secondary ejection port 0x8
overheated 0x9
primary charged 0xa
secondary charged 0xb
illumination 0xc
age 0xd
integrated light 0xe
primary firing 0xf
secondary firing 0x10
primary firing on 0x11
secondary firing on 0x12
ready time f32
heat recovery threshold Fraction: f32
  • Maximum: 1
overheated threshold Fraction: f32
  • Maximum: 1
heat detonation threshold Fraction: f32
  • Maximum: 1
heat detonation fraction Fraction: f32
  • Maximum: 1
heat loss per second Fraction: f32
  • Maximum: 1
heat illumination Fraction: f32
  • Maximum: 1
pad(16)
pad(8)
near reticle range f32 (world units)
far reticle range f32 (world units)
intersection reticle range f32
pad(2)
magnification levels u16
magnification range f32 (world units) (min & max)
autoaim angle Angle: f32

Determines the aiming cone where projectiles paths will be pulled towards the target. This is the "red reticle" angle.

autoaim range f32 (world units)

The maximum range of the autoaim cone.

magnetism angle Angle: f32

For controller input, sets the angle where crosshair "stickiness" becomes a factor and aiming direction automatically tracks targets.

magnetism range f32 (world units)

The maximum target distance for magnetism to apply.

deviation angle Angle: f32

Used for vehicle weapons to control the maximum angle of deviation when the aiming direction does not match the direction the weapon is facing. For example, the Ghost's deviation angle of 45 degrees allows the driver to fire in the direction they are aiming even if the Ghost has not yet turned to face that direction. Compare this to the Warthog gun's tighter 10 degree limit.

pad(4)
movement penalized enum

Unused. This was meant to slow the player when using certain weapons like the rocket launcher, but it has no effect ingame regardless of the options, penalty values used, or game mode.

Option Value Comments
always 0x0

No effect.

when zoomed 0x1

No effect.

when zoomed or reloading 0x2

No effect.

pad(2)
forward movement penalty Fraction: f32

No effect.

sideways movement penalty Fraction: f32

No effect.

pad(4)
minimum target range f32
looking time modifier f32
pad(4)
light power on time f32 (seconds)
light power off time f32 (seconds)
age heat recovery penalty f32
age rate of fire penalty f32
age misfire start Fraction: f32
  • Maximum: 1
age misfire chance Fraction: f32
  • Maximum: 1
pad(12)
pad(4)
pad(12)
active camo ding f32
active camo regrowth rate f32
pad(12)
pad(2)
weapon type enum
Option Value Comments
undefined 0x0
shotgun 0x1
needler 0x2
plasma pistol 0x3
plasma rifle 0x4
more predicted resources Block?
PredictedResource
magazines Block?
Field Type Comments
flags bitfield(32)
Flag Mask Comments
wastes rounds when reloaded 0x1
every round must be chambered 0x2
rounds recharged u16
rounds total initial u16
rounds total maximum u16
rounds loaded maximum u16
pad(8)
reload time f32
rounds reloaded u16
pad(2)
chamber time f32
pad(8)
pad(16)
pad(12)
magazine objects Block?
Field Type Comments
rounds u16
pad(10)
triggers Block?
Field Type Comments
flags bitfield(32)
Flag Mask Comments
tracks fired projectile 0x1
random firing effects 0x2
can fire with partial ammo 0x4
does not repeat automatically 0x8
locks in on off state 0x10
projectiles use weapon origin 0x20
sticks when dropped 0x40
ejects during chamber 0x80
discharging spews 0x100
analog rate of fire 0x200
use error when unzoomed 0x400
projectile vector cannot be adjusted 0x800
projectiles have identical error 0x1000
projectile is client side only 0x2000
rounds per second f32 (min & max)

Determines the maximum rate of fire of the weapon.

acceleration time f32

Controls how long it takes for the weapon to reach its maximum rate of fire during sustained bursts and automatic fire.

deceleration time f32

Controls how long it takes for the weapon to return to starting rate of fire when not firing.

blurred rate of fire Fraction: f32
pad(8)
magazine Index (magazines)
rounds per shot u16
minimum rounds loaded u16
rounds between tracers u16
pad(6)
firing noise enum
Option Value Comments
silent 0x0
medium 0x1
loud 0x2
shout 0x3
quiet 0x4
error f32 (min & max)

The function of this field is unknown. It is possibly unused by the game. Although labeled in Guerilla as a range [0, 1], the pistol has a max value of 2. Setting this to 0 does not affect projectile spread.

error acceleration time f32

Affects how long it takes for the weapon to reach its maximum projectile error angle during rapid or automatic fire.

error deceleration time f32

Affects how long it takes for the weapon to reach its minimum projectile error angle during a pause in firing.

pad(8)
charging time f32
charged time f32
overcharged action enum
Option Value Comments
none 0x0
explode 0x1
discharge 0x2
pad(2)
charged illumination f32
spew time f32
distribution function enum
Option Value Comments
point 0x0
horizontal fan 0x1

Causes projectiles to be spread out in a fan, which actually seems to be vertical.

projectiles per shot u16

Affects how many projectiles are produced by a single shot. For example, the shotgun has this value set to 15. Each projectile is scattered by error angle independently.

distribution angle f32

Affects the spread of projectiles when projectiles per shot is greater than 1 and distribution function is fan.

pad(4)
minimum error Angle: f32

Floor value for error angle. Even if the minimum error angle is 0, this value takes precedence. Note that this field receives a hard-coded singleplayer adjustment at map compile time for the pistol.

error angle Angle: f32 (min & max)

Determines the minimum and maximum angle of the "error cone". The min angle is for when you begin firing, while the max is reached after a period of sustained fire. The values are shown in degrees in Guerilla, but internally stored in radians. Note that these fields receives hard-coded singleplayer adjustments at map compile time for the pistol and plasma rifle.

first person offset
Point3D
  • x: f32
  • y: f32
  • z: f32
pad(4)
ejection port recovery time f32
illumination recovery time f32
pad(12)
heat generated per round Fraction: f32
  • Maximum: 1
age generated per round Fraction: f32
  • Maximum: 1
pad(4)
overload time f32 (seconds)
pad(8)
pad(32)
illumination recovery rate f32 (little endian?)
  • Only set when the tag is compiled into a map cache.
ejection port recovery rate f32 (little endian?)
  • Only set when the tag is compiled into a map cache.
firing acceleration rate f32 (little endian?)

Pre-calculated rate of firing rate increase, based on the acceleration time field.

  • Only set when the tag is compiled into a map cache.
firing deceleration rate f32 (little endian?)

Pre-calculated rate of firing rate decrease, based on the deceleration time field.

  • Only set when the tag is compiled into a map cache.
error acceleration rate f32 (little endian?)

Pre-calculated rate of error angle increase, based on the error acceleration time field.

  • Only set when the tag is compiled into a map cache.
error deceleration rate f32 (little endian?)

Pre-calculated rate of error angle decrease, based on the error deceleration time field.

  • Only set when the tag is compiled into a map cache.
firing effects Block?
Field Type Comments
shot count lower bound u16
shot count upper bound u16
pad(32)

This information was partially generated using Invader tag definitions.

Acknowledgements

Thanks to the following individuals for their research or contributions to this topic:

  • Jakey (Explaining weapon error fields)
  • Kavawuvi (Invader tag definitions)
  • MosesOfEgypt (Tag structure research)