Weapon
Members
Member |
Description |
---|---|
Get the currently active Sub Weapon from the |
|
Get the currently active Sub Weapon index. |
|
The Field Of View (zoom level) applied to the player when aiming this weapon |
|
Get the weapon animator. |
|
If true, each shot will heat up the weapon. |
|
Returns true if the weapon can be fired. |
|
The muzzle transform that the next projectile will fire from. |
|
The current spread magnitude of a weapon. |
|
The current maximum spread of a weapon in radians. |
|
Difficulty of hitting Air target with this weapon. |
|
Difficulty of hitting AirFastMover target with this weapon. |
|
Difficulty of hitting GroundVehicles target with this weapon. |
|
Difficulty of hitting Infantry target with this weapon. |
|
Difficulty of hitting InfantryGroup target with this weapon. |
|
Effectiveness of this weapon against Air targets. |
|
Effectiveness of this weapon against Airplane targets. |
|
Effectiveness of this weapon against Armored targets. |
|
Effectiveness of this weapon against Infantry targets. |
|
Effectiveness of this weapon against InfantryGroup targets. |
|
Effectiveness of this weapon against Unarmored targets. |
|
The range at which the weapon is considered effective. |
|
The current heat value of the weapon if applyHeat is enabled. |
|
The rate at which heat drains in units per second. |
|
True if fire input has been held long enough to fire the weapon. |
|
True while fire button is held down. |
|
Locked weapons cannot be fired by the user. |
|
A loud weapon will alert nearby enemies when being fired. |
|
The actor that gets damage/kill credits from this weapon. |
|
The number of projectiles spawned when the weapons is fired. |
|
When true, the weapon must charge before firing. |
|
Events
Event |
Description |
---|---|
Invoked when the weapon is fired. |
|
Invoked when the weapon is fired. |
Methods
Method |
Description |
---|---|
Add a subweapon to this parent weapon, returning the subweapon index. |
|
Switch to the next Sub Weapon in the Weapon’s |
|
Matches a weapon role based on the weapon’s current stats. |
|
Returns the weapon’s projectile prefab |
|
Lock the weapon so it cannot be fired. |
|
Switch to the next Sub Weapon in the Weapon’s |
|
Removes a subweapon from this parent weapon. |
|
Removes a subweapon from this parent weapon. |
|
Sets the weapon’s projectile prefab |
|
Makes the weapon invisible |
|
Makes the weapon visible |
|
Shoots this weapon. |
|
Unlock the weapon so it can be fired. |
Details
-
class Weapon
-
const int activeSightModeIndex
-
const int activeSubWeaponIndex
Get the currently active Sub Weapon index.
-
float aimFov
The Field Of View (zoom level) applied to the player when aiming this weapon
-
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
-
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 int slot
-
int spareAmmo
-
const Quaternion thirdPersonRotation
-
const float thirdPersonScale
-
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 WeaponEntry weaponEntry
-
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.
-
void callback()
-
const ScriptEvent onSpawnProjectiles
Callback Signature:
-
void callback()
Invoked when the weapon is fired. Provides an array of all spawned projectiles.
-
void callback()
-
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 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.
-
const int activeSightModeIndex