Skip to content

ATDRL_Firearm

Klian edited this page Mar 23, 2023 · 10 revisions

Parent: ATDRL_Melee


The firearm class is derived from the melee class, so your weapon can easily be an hybrid melee/firearm weapon.

Firearm Static Data Structure

The Firearm Static Data Structure contains all the important information about the Melee Weapon itself during the game.

The main functionality of this class is spawning instances derived from the ATDRL_ProjectileBase, which will handle the damage event.

image

  • AnimMontages: AnimMontages to play for different actions (Primary, Secondary and Reload)
  • Projectile Class: Projectile class to spawn (must derive from ATDRL_ProjectileBase)
  • Fire Rate: Fire rate of this weapon. Fire rate means bullets/time, therefore increasing this value will slow down the weapon
  • Fire Delay: Time to wait before spawning the bullet, after pulling the trigger
  • Burst: Number of projectile sequentially spawned when fire. Can't be stopped, unless the magazine is empty. Set its value to 1 is the equivalent to a semi-auto weapon. Set its value to 0 is the equivalent to a full-auto weapon.
  • Max Ammo: Max amount of ammo in the "bag"
  • Magazine Size: Max amount of ammo in the magazine
  • Reload Time: Time needed to reload this weapon
  • Loudness: Noise loudness when firing (but not hitting, check the projectile class for that)
  • Noise Tag: Noise tag when attacking (used for AI perception)
  • Ammo Tag: Tag used to pair ammo pickup (see ATDRL_Ammo)

Runtime variables

image

  • Ammunition: Ammunition contained in the inventory [runtime]. Limited by "Max Ammo" (Firearm Static Data).
  • Magazine Ammunition: Ammunition contained in the firearm's magazine [runtime]. Limited by "Magazine Size" (Firearm Static Data).

These variables are shown in the default HUD example (Refresh Ammo Slot):

image

Primary Action

By default, in this template the Primary Action will trigger the main fire cycle, depending on the firearm's setting (Full auto, Semi auto or Burst).

image

Secondary Action

By default, in this template the Secondary Action will trigger the main melee attack.

image

RAction

By default, in this template the R Action will trigger the reload event.

image