Vehicle Weapon Switching – Arma 3
(Created page with "{{GVI|A3|1.54|category}} Vehicle Weapon Switching As part of Arma 3 release 1.54, we added four new actions offering the ability to switch vehicle...") |
Lou Montana (talk | contribs) m (Text replacement - "{{GVI|A3|" to "{{GVI|arma3|") |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{GVI| | {{GVI|arma3|1.54}} | ||
As part of Arma 3 release 1.54, four actions were added offering the ability to switch between vehicle weapons based on categorization, which avoided the need to cycle through every weapon. | |||
As part of Arma 3 release 1.54, | The system was made fully configurable so developers can specify exactly where they want their weapons. | ||
== Config Defines == | |||
The weapon groups use enumerated data types and are defined in Arma 3’s basic defines as the following: | The weapon groups use enumerated data types and are defined in Arma 3’s basic defines as the following: | ||
< | <syntaxhighlight lang="cpp"> | ||
#define WEAPONGROUP_MGUNS | #define WEAPONGROUP_CANNONS 1 // Cannons | ||
#define WEAPONGROUP_ROCKETS | #define WEAPONGROUP_MGUNS 2 // Machine Guns | ||
#define WEAPONGROUP_AAMISSILES 8 | #define WEAPONGROUP_ROCKETS 4 // Rockets | ||
#define WEAPONGROUP_ATMISSILES 16 | #define WEAPONGROUP_AAMISSILES 8 // Anti-Air Missiles | ||
#define WEAPONGROUP_MISSILES | #define WEAPONGROUP_ATMISSILES 16 // Anti-Tank Missiles | ||
#define WEAPONGROUP_BOMBS | #define WEAPONGROUP_MISSILES 32 // All / Other Missiles | ||
#define WEAPONGROUP_SPECIAL | #define WEAPONGROUP_BOMBS 64 // Bombs | ||
#define WEAPONGROUP_SPECIAL 128 // Laser Designator + Misc | |||
</syntaxhighlight> | |||
Weapon category definitions can be added to iterative '''weaponsGroup''' parameters in the vehicle class structure, which simply adds that category to a specific weapons group, which can then be directly selected from the controls. All vehicles that inherit from Arma 3's base classes will already have some weapon grouping template. | Weapon category definitions can be added to iterative '''weaponsGroup''' parameters in the vehicle class structure, which simply adds that category to a specific weapons group, which can then be directly selected from the controls. All vehicles that inherit from Arma 3's base classes will already have some weapon grouping template. | ||
< | <syntaxhighlight lang="cpp"> | ||
class CfgVehicles | |||
{ | { | ||
class MyPrettyAirplane | |||
{ | |||
weaponsGroup1 = WEAPONGROUP_CANNONS + WEAPONGROUP_MGUNS; // Adds Cannons and Machine Guns to Weapons Group 1 | |||
weaponsGroup2 = WEAPONGROUP_ROCKETS; // Adds Rockets to Weapons Group 2 | |||
weaponsGroup3 = WEAPONGROUP_AAMISSILES + WEAPONGROUP_ATMISSILES + WEAPONGROUP_MISSILES; // Adds All Missile types to Weapons Group 3 | |||
weaponsGroup4 = WEAPONGROUP_BOMBS + WEAPONGROUP_SPECIAL; // Adds Bombs and Laser Designators to Weapons Group 4 | |||
}; | |||
};</ | }; | ||
</syntaxhighlight> | |||
Once this is defined, the "Switch to Weapons Group" actions will correlate to the groups in the vehicle config, since the engine automatically determines the category for each weapon based on the ammo simulation. | Once this is defined, the "Switch to Weapons Group" actions will correlate to the groups in the vehicle config, since the engine automatically determines the category for each weapon based on the ammo simulation. | ||
==Weapon Override== | |||
== Weapon Override == | |||
It is possible to override the engine's determination of weapon category by altering the '''weaponType''' parameter in the ammunition of the weapon, found in ''CfgAmmo'': | It is possible to override the engine's determination of weapon category by altering the '''weaponType''' parameter in the ammunition of the weapon, found in ''CfgAmmo'': | ||
< | <syntaxhighlight lang="cpp"> | ||
class CfgAmmo | |||
{ | { | ||
class B_19mm_HE; | |||
class B_30mm_HE : B_19mm_HE { weaponType = "cannon"; }; | |||
class BulletBase; | |||
class B_30mm_AP : BulletBase { weaponType = "cannon"; }; | |||
};</ | }; | ||
</syntaxhighlight> | |||
The weapon category strings are: | The weapon category strings are: | ||
* "cannon" | * "cannon" | ||
* "mGun" | * "mGun" | ||
Line 52: | Line 61: | ||
* "bomb" | * "bomb" | ||
* "special" | * "special" | ||
{{GameCategory|arma3|Vehicle Configuration}} | |||
[[Category:Introduced with Arma 3 version 1.54]] |
Latest revision as of 17:34, 23 May 2021
1.54 As part of Arma 3 release 1.54, four actions were added offering the ability to switch between vehicle weapons based on categorization, which avoided the need to cycle through every weapon. The system was made fully configurable so developers can specify exactly where they want their weapons.
Config Defines
The weapon groups use enumerated data types and are defined in Arma 3’s basic defines as the following:
#define WEAPONGROUP_CANNONS 1 // Cannons
#define WEAPONGROUP_MGUNS 2 // Machine Guns
#define WEAPONGROUP_ROCKETS 4 // Rockets
#define WEAPONGROUP_AAMISSILES 8 // Anti-Air Missiles
#define WEAPONGROUP_ATMISSILES 16 // Anti-Tank Missiles
#define WEAPONGROUP_MISSILES 32 // All / Other Missiles
#define WEAPONGROUP_BOMBS 64 // Bombs
#define WEAPONGROUP_SPECIAL 128 // Laser Designator + Misc
Weapon category definitions can be added to iterative weaponsGroup parameters in the vehicle class structure, which simply adds that category to a specific weapons group, which can then be directly selected from the controls. All vehicles that inherit from Arma 3's base classes will already have some weapon grouping template.
class CfgVehicles
{
class MyPrettyAirplane
{
weaponsGroup1 = WEAPONGROUP_CANNONS + WEAPONGROUP_MGUNS; // Adds Cannons and Machine Guns to Weapons Group 1
weaponsGroup2 = WEAPONGROUP_ROCKETS; // Adds Rockets to Weapons Group 2
weaponsGroup3 = WEAPONGROUP_AAMISSILES + WEAPONGROUP_ATMISSILES + WEAPONGROUP_MISSILES; // Adds All Missile types to Weapons Group 3
weaponsGroup4 = WEAPONGROUP_BOMBS + WEAPONGROUP_SPECIAL; // Adds Bombs and Laser Designators to Weapons Group 4
};
};
Once this is defined, the "Switch to Weapons Group" actions will correlate to the groups in the vehicle config, since the engine automatically determines the category for each weapon based on the ammo simulation.
Weapon Override
It is possible to override the engine's determination of weapon category by altering the weaponType parameter in the ammunition of the weapon, found in CfgAmmo:
class CfgAmmo
{
class B_19mm_HE;
class B_30mm_HE : B_19mm_HE { weaponType = "cannon"; };
class BulletBase;
class B_30mm_AP : BulletBase { weaponType = "cannon"; };
};
The weapon category strings are:
- "cannon"
- "mGun"
- "rocket"
- "missileAA"
- "missileAT"
- "missileAAAT"
- "bomb"
- "special"