Vehicle Loadouts – Arma 3

From Bohemia Interactive Community
Revision as of 16:56, 10 February 2017 by Ondrejkuzel (talk | contribs) (created - WIP -)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Cfg ref


!!! Current state of dynamic loadout is still work-in-progress. Names or parameters of config variables or script commands may change in future !!!

Overview

In-game customization of vehicle's external armament.

Forum thread: Dynamic Loadouts

Goal

  • allow players to add/change weapons on vehicle's hardpoints on the begining of a mission, during the mission, in 3DEN,...
  • add system that will allow addon-makers (configs) and designers (scripts) manage weapons on vehicles (mainly helicopters and airplanes) in a similar way to how it works in real world

Features

  • done similarly to how the current missiles work - by a proxy system with simulation "maverick"
    • allows to set missile directly on pylon by pylon ID
    • supports both missile holder (rail) and multi-missile holder (rack)
    • future-compatible with non-missile equipment such as fuel tanks, pylon mounted HMG, electronics equipment,...

Configuration

CfgNonAIVehicles: simulation: pylonpod

class CfgNonAIVehicles
{
    class ProxyWeapon;
    class ProxyPylonPod_3x_Missile_AGM_02_F: ProxyWeapon
    {
        model = "\A3\Weapons_F\DynamicLoadout\PylonPod_3x_Missile_AGM_02_F.p3d";
        simulation = "pylonpod";
    };
};

This says to engine that model PylonPod_3x_Missile_AGM_02_F - used as proxy in parent model - is the place for an item under pylon. Proxy ID corresponds with ID in config and script command to determine where to draw the item. Only models that are used in airplanes' P3Ds have to be CfgNonAIVehicles. Models that are only in CfgMagazines doen't need to be in CfgNonAIVehicles.

Magazine and weapon

class CfgMagazines
{
    class 6Rnd_Missile_AGM_02_F;
     class PylonPod_1Rnd_Missile_AGM_02_F: 6Rnd_Missile_AGM_02_F
    {
        displayName        = "1x Macer";
        model = "\A3\Weapons_F\DynamicLoadout\PylonPod_1x_Missile_AGM_02_F.p3d";
        count = 1;
        hardpoint[] = {"SUU_63_PYLON","BRU_32_EJECTOR","US_BOMB"};
        pylonWeapon = "Missile_AGM_02_Plane_CAS_01_F";
    };
    class PylonPod_3Rnd_Missile_AGM_02_F: PylonPod_1Rnd_Missile_AGM_02_F
    {
        displayName       = "3x Macer";
        model = "\A3\Weapons_F\DynamicLoadout\PylonPod_3x_Missile_AGM_02_F.p3d";
        count = 3;
        pylonWeapon = "Missile_AGM_02_Plane_CAS_01_F";
        mirrorMissilesIndexes[] = {2,1,3}; // when on pylon with mirroredMissilePos = true, proxies will be taken/fired in this order
   };
};
class CfgWeapons
{
    class MissileLauncher;
    class Missile_AGM_02_Plane_CAS_01_F: MissileLauncher
    {
        magazines[] = {6Rnd_Missile_AGM_02_F, PylonPod_1Rnd_Missile_AGM_02_F, PylonPod_3Rnd_Missile_AGM_02_F};
    };
};

Arma 3 hardpoint naming example

  • B_BOMB_PYLON - default Blufor bomb pylon, attachable NATO bomb + NATO ejectors
  • O_BOMB_PYLON - default Opfor bomb pylon
  • B_ASRAAM - build in ejector (mostly wing tip); only AIM-9 compatible missiles
  • B_AH_99_PYLON - special pylons, only AH-99 compatible weapon

Hardpoint[] is only array of string, when one or more hardpoint from magazine and pylon are same, and mass of missile is OK, weapon can be used.

pylonWeapon property

  • Pylon magazines require double side connection of pylon weapons and pylon magazine
  • Each weapon has to have a list of compatible magazines. No change here. But the new pylon magazine requires a new parameter called "pylonWeapon" with a name of default weapon which is added automatically when adding missile by setPylonLoadout script command or by 3DEN

Example:

                                         
class CfgMagazines
{
    class PylonPod_AA
    {
        pylonWeapon = "Missile_AGM_02_Plane_CAS_01_F";
    };
};
class CfgWeapons
{
    class Launcher_AA
    {
        magazines[] = {PylonPod_AA};       
    };
    class Launcher_AA_v2
    {
        magazines[] = {PylonPod_AA};       
    };   
};

In case of new vehicle in 3DEN, Launcher_AA will be added automatically. If you call script command setPylonLoadOut then only Launcher_AA will be added. To add Launcher_AA_v2 call: veh addweapon Launcher_AA_v2; and then {veh setPylonLoadOut [1, "PylonPod_AA"]; In this case Launcher_AA will not be added because compatible weapon is already present

vehicle config - CfgVehicles

class CfgVehicles
{
    class Plane_Base_F;
    class Plane_CAS_01_base_F:Plane_Base_F
    {
        class Components;
    };
    class B_Plane_CAS_01_Pylons_F: Plane_CAS_01_base_F
    {
        class Components:Components
        {
            class TransportPylonComponent
            {
                class pylons
                {
                    class pylons1 // left wingtip
                    {
                        maxweight = 560; //kg ,magazine with higher mass will not be allowed on this pylon
                        hardpoints[] = {"B_BOMB_PYLON"}; // magazine with at least one same hardpoints name will be attachable
                        //hardpoint[] = {"A164_PYLON_1_10","LAU_7","B_ASRAAM", "SUU_63_PYLON","BRU_32_EJECTOR","B_BOMB_PYLON",....}; // just example for community, I am sure you will go closer to realism
                        attachment = "PylonPod_1Rnd_Missile_AA_04_F"; // default magazine
                        bay = -1; // index of bay for animation
                        priority = 5; // pylon with higher priority is used to fire missile first, this can by changed in run time by script command setPylonsPriority
                        UIposition[] = {0.1, 0.25}; // x,y coordinates in 3DEN UI
                        turret[] = {}; // default owner of pylon/weapon, empty for driver
                        mirroredMissilePos = false; // when true proxies/missiles on rack on this pylon will be re-indexed by magazine::mirrorMissilesIndexes[]
                    };
                    class pylons2:pylons1
                    {
                        maxweight = 800; //kg
                        attachment[] = {ProxyPylonPod_3x_Missile_AGM_02_F};
                        priority = 4;
                    };
                    class pylons3:pylons1{priority = 3;};
                    class pylons4:pylons1{priority = 2;};
                    class pylons5:pylons1{priority = 1;};
                    class pylons6:pylons5{};
                    class pylons7:pylons4{};
                    class pylons8:pylons3{};
                    class pylons9:pylons2{};
                    class pylons10:pylons1{}; // right wingtip
                };
                class Bays
                {
                    class BayCenter // corresponding to pylons/##pylon##/bay=1;
                    {
                        bayOpenTime = 1;
                        openBayWhenWeaponSelected = 1.0; // float value, can be used to half open bay
                         
                         // -1 keep open, 0 close after last missile, > 0 keep open for given time after last shot                       
                        autoCloseWhenEmptyDelay = 2; // when last shot keep 2s open after last shot
                    };
                    class BayRight   // corresponding to pylons/##pylon##/bay=2;
                    {
                        bayOpenTime = 0.8;
                        openBayWhenWeaponSelected = 0.0;
                    };
                    class BayLeft:BayRight{}; // corresponding to pylons/##pylon##/bay=3;
                };
            };
 `     };
    };
};
  • pylons:hardpoint: if one or more matches with magazine:hardpoints then magazine can be attached, setPylonLoadOut with force = true will ignore this check.

Scripting

   vehicle setPylonLoadOut [pylonID, magazine name, forced = false, turret path = []]
  • adds missile to vehicle pylon; TransportPylonsComponent in config is required
  • pylonID can be number/index corresponding to order in config or string name of pylon in config
  vehicle setPylonsPriority [priority pylon 1, priority pylon 2,..., priority pylon n]
  • overrides default pylons priorities
  • can be used to make weapon fire in different order or to force burst of all weapons of same type
   vehicle AnimateBay [bay index, value <-1,1>, bool instant]
  • will force bay to animate to given position, use -1 reset to default (engine driven) state
   vehicle AnimatePylon [pylon index, value <-1,1>, bool instant]
  • will force pylon to animate to given position, use -1 reset to default (engine driven) state
  • both script command above will in case that state < 1 make attached weapon unable to release missile, because missile can be released only when bay.animation == 1 && pylon.animation == 1
   vehicle AmmoOnPylon pylon name/index
  • returns ammo count on given pylon
   vehicle SetAmmoOnPylon [pylon name/index, ammo count]
  • set count of ammo in magazine on pylon
   GetPylonMagazines vehicle
  • return array of magazines on pylons, size is equal to count of pylons

Animation sources

plane/helicopter

  • bay.1, bay.2,...bay.X - animation state of bay
  • pylonReadyPos.X - animation state of pylon, missile is released when anim. state of bay and pylon is 1
  • pylonIsEmpty.X - return 1 when no magazine is attached on pylon
  • pylonReload.X - reload state of weapon on given pylon
  • pylonRevolving.X - revolving state of weapon on given pylon

magazine

  • revolving - revolving state of weapon, can be used in model.cfg for model of magazine/pylon ejector model
  • ammo - real count of ammunition from 0 to maxAmmo
  • reload - reload state of pylon magazine, same as reload for non - pylon weapons


Related