MountedWeapon

Constructors

Constructor

Description

MountedWeapon()

Members

Member

Description

activeSightModeIndex

activeSubWeapon

Get the currently active Sub Weapon from the alternativeWeapons list.

activeSubWeaponIndex

Get the currently active Sub Weapon index.

aimCamera

aimChangeSpeed

aimFov

The Field Of View (zoom level) applied to the player when aiming this weapon

alternativeWeapons

ammo

animator

Get the weapon animator.

applyHeat

If true, each shot will heat up the weapon.

baseSpread

canFire

Returns true if the weapon can be fired.

chargeTime

cooldown

currentMuzzleTransform

The muzzle transform that the next projectile will fire from.

currentSpreadMagnitude

The current spread magnitude of a weapon.

currentSpreadMaxAngleRadians

The current maximum spread of a weapon in radians.

difficultyAir

Difficulty of hitting Air target with this weapon.

difficultyAirFastMover

Difficulty of hitting AirFastMover target with this weapon.

difficultyGroundVehicles

Difficulty of hitting GroundVehicles target with this weapon.

difficultyInfantry

Difficulty of hitting Infantry target with this weapon.

difficultyInfantryGroup

Difficulty of hitting InfantryGroup target with this weapon.

effectivenessAir

Effectiveness of this weapon against Air targets.

effectivenessAirFastMover

Effectiveness of this weapon against Airplane targets.

effectivenessArmored

Effectiveness of this weapon against Armored targets.

effectivenessInfantry

Effectiveness of this weapon against Infantry targets.

effectivenessInfantryGroup

Effectiveness of this weapon against InfantryGroup targets.

effectivenessUnarmored

Effectiveness of this weapon against Unarmored targets.

effectiveRange

The range at which the weapon is considered effective.

followupSpread

gameObject

hasAdvancedReload

hasLoadedAmmo

hasSpareAmmo

heat

The current heat value of the weapon if applyHeat is enabled.

heatDrainRate

The rate at which heat drains in units per second.

heatGainPerShot

isAiming

isAuto

isCharged

True if fire input has been held long enough to fire the weapon.

isCoolingDown

isEmpty

isFull

isHoldingFire

True while fire button is held down.

isLocked

Locked weapons cannot be fired by the user.

isLoud

A loud weapon will alert nearby enemies when being fired.

isOverheating

isReloading

isUnholstered

killCredit

The actor that gets damage/kill credits from this weapon.

maxAmmo

maxSpareAmmo

muzzleTransforms

overrideCamera

projectilesPerShot

The number of projectiles spawned when the weapons is fired.

recoilBaseKickback

recoilKickbackProneMultiplier

recoilRandomKickback

recoilSnapDuration

recoilSnapFrequency

recoilSnapMagnitude

recoilSnapProneMultiplier

reloadTime

scopeAimObject

seat

slot

spareAmmo

thirdPersonOffset

thirdPersonRotation

thirdPersonScale

transform

uiSprite

unholsterTime

useChargeTime

When true, the weapon must charge before firing.

user

weaponEntry

vehicleRigidbodyRecoilForce

Events

Event

Description

onFire

Invoked when the weapon is fired.

onSpawnProjectiles

Invoked when the weapon is fired.

Methods

Method

Description

AddSubWeapon(subWeapon)

Add a subweapon to this parent weapon, returning the subweapon index.

EquipSubWeapon(subWeaponIndex)

Switch to the next Sub Weapon in the Weapon’s alternativeWeapons list.

GenerateWeaponRoleFromStats()

Matches a weapon role based on the weapon’s current stats.

GetProjectilePrefab()

Returns the weapon’s projectile prefab

InstantlyReload()

LockWeapon()

Lock the weapon so it cannot be fired.

NextSightMode()

NextSubWeapon()

Switch to the next Sub Weapon in the Weapon’s alternativeWeapons list.

PreviousSightMode()

Reload()

RemoveSubWeapon(subWeaponIndex)

Removes a subweapon from this parent weapon.

RemoveSubWeapon(subWeapon)

Removes a subweapon from this parent weapon.

SetProjectilePrefab(prefab)

Sets the weapon’s projectile prefab

SetRenderersInvisible()

Makes the weapon invisible

SetRenderersVisible()

Makes the weapon visible

Shoot(force)

Shoots this weapon.

ToString()

UnlockWeapon()

Unlock the weapon so it can be fired.

Details

class MountedWeapon
MountedWeapon MountedWeapon()
const int activeSightModeIndex
const Weapon activeSubWeapon

Get the currently active Sub Weapon from the alternativeWeapons list.

const int activeSubWeaponIndex

Get the currently active Sub Weapon index.

const Camera aimCamera
float aimChangeSpeed
float aimFov

The Field Of View (zoom level) applied to the player when aiming this weapon

const array<Weapon> alternativeWeapons
int ammo
const Animator animator

Get the weapon animator. Please note that weapons carried by the AI never have animators. Only player carried weapons and MountedWeapons can have animators.

bool applyHeat

If true, each shot will heat up the weapon. If the heat value reaches 1 the gun overheats, and cannot be fired again until it cools down.

float baseSpread
const bool canFire

Returns true if the weapon can be fired. Checks ammo, cooldown, overheat, lock, target tracker and misc flags

float chargeTime
float cooldown
const Transform currentMuzzleTransform

The muzzle transform that the next projectile will fire from.

const float currentSpreadMagnitude

The current spread magnitude of a weapon. The spread magnitude is the radius of a sphere 1 meter in front of the muzzle. The projectile may fire towards a random point inside that sphere.

const float currentSpreadMaxAngleRadians

The current maximum spread of a weapon in radians.

Difficulty difficultyAir

Difficulty of hitting Air target with this weapon.

Difficulty difficultyAirFastMover

Difficulty of hitting AirFastMover target with this weapon.

Difficulty difficultyGroundVehicles

Difficulty of hitting GroundVehicles target with this weapon.

Difficulty difficultyInfantry

Difficulty of hitting Infantry target with this weapon.

Difficulty difficultyInfantryGroup

Difficulty of hitting InfantryGroup target with this weapon.

Effectiveness effectivenessAir

Effectiveness of this weapon against Air targets. This value is used by AI and TargetTrackers to prioritize targets.

Effectiveness effectivenessAirFastMover

Effectiveness of this weapon against Airplane targets. This value is used by AI and TargetTrackers to prioritize targets.

Effectiveness effectivenessArmored

Effectiveness of this weapon against Armored targets. This value is used by AI and TargetTrackers to prioritize targets.

Effectiveness effectivenessInfantry

Effectiveness of this weapon against Infantry targets. This value is used by AI and TargetTrackers to prioritize targets.

Effectiveness effectivenessInfantryGroup

Effectiveness of this weapon against InfantryGroup targets. This value is used by AI and TargetTrackers to prioritize targets.

Effectiveness effectivenessUnarmored

Effectiveness of this weapon against Unarmored targets. This value is used by AI and TargetTrackers to prioritize targets.

float effectiveRange

The range at which the weapon is considered effective.

FollowupSpread followupSpread
const GameObject gameObject
const bool hasAdvancedReload
const bool hasLoadedAmmo
const bool hasSpareAmmo
float heat

The current heat value of the weapon if applyHeat is enabled. When heat reaches 1, the weapon cannot be fired until the heat reaches 0 again.

float heatDrainRate

The rate at which heat drains in units per second.

float heatGainPerShot
const bool isAiming
bool isAuto
const bool isCharged

True if fire input has been held long enough to fire the weapon.

const bool isCoolingDown
const bool isEmpty
const bool isFull
const bool isHoldingFire

True while fire button is held down.

bool isLocked

Locked weapons cannot be fired by the user.

bool isLoud

A loud weapon will alert nearby enemies when being fired.

const bool isOverheating
const bool isReloading
const bool isUnholstered
Actor killCredit

The actor that gets damage/kill credits from this weapon. Automatically set to whoever equips this weapon, but can be overridden if required

int maxAmmo
int maxSpareAmmo
const array<Transform> muzzleTransforms
const Camera overrideCamera
int projectilesPerShot

The number of projectiles spawned when the weapons is fired.

float recoilBaseKickback
float recoilKickbackProneMultiplier
float recoilRandomKickback
float recoilSnapDuration
float recoilSnapFrequency
float recoilSnapMagnitude
float recoilSnapProneMultiplier
float reloadTime
const GameObject scopeAimObject
const Seat seat
const int slot
int spareAmmo
const Vector3 thirdPersonOffset
const Quaternion thirdPersonRotation
const float thirdPersonScale
const Transform transform
const Sprite uiSprite
float unholsterTime
bool useChargeTime

When true, the weapon must charge before firing. Requires the fire button to be held for chargeTime seconds before firing.

const Actor user
const WeaponEntry weaponEntry
float vehicleRigidbodyRecoilForce
const ScriptEvent onFire

Callback Signature:

void callback()

Note

This event can be consumed by calling CurrentEvent.Consume(). Consuming this event stops the weapon from firing.

Invoked when the weapon is fired.

const ScriptEvent onSpawnProjectiles

Callback Signature:

void callback()

Invoked when the weapon is fired. Provides an array of all spawned projectiles.

int AddSubWeapon(Weapon subWeapon)

Add a subweapon to this parent weapon, returning the subweapon index.

void EquipSubWeapon(int subWeaponIndex)

Switch to the next Sub Weapon in the Weapon’s alternativeWeapons list.

WeaponRole GenerateWeaponRoleFromStats()

Matches a weapon role based on the weapon’s current stats.

GameObject GetProjectilePrefab()

Returns the weapon’s projectile prefab

void InstantlyReload()
void LockWeapon()

Lock the weapon so it cannot be fired.

void NextSightMode()
void NextSubWeapon()

Switch to the next Sub Weapon in the Weapon’s alternativeWeapons list.

void PreviousSightMode()
void Reload()
void RemoveSubWeapon(int subWeaponIndex)

Removes a subweapon from this parent weapon.

void RemoveSubWeapon(Weapon subWeapon)

Removes a subweapon from this parent weapon.

void SetProjectilePrefab(GameObject prefab)

Sets the weapon’s projectile prefab

void SetRenderersInvisible()

Makes the weapon invisible

void SetRenderersVisible()

Makes the weapon visible

bool Shoot(bool force)

Shoots this weapon.If force is true, ignores the CanFire() check. Returns true if shot was fired.

string ToString()
void UnlockWeapon()

Unlock the weapon so it can be fired.