Artillery Module – Arma 2

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " <nowiki>[</nowiki>" to " [<nowiki/>")
m (Text replacement - "ArmA( |_)2" to "Arma 2")
Line 554: Line 554:




[[Category:ArmA 2: Editor Modules]]
[[Category:Arma 2: Editor Modules]]

Revision as of 13:14, 2 May 2020

Template:SideTOC

This guide is about Arma 2. For Arma 3, see this Youtube video.

Introduction

The ARTY module allows scenario designers to utilize AI and player-controlled Artillery in their scenarios. ARTY supports any properly configured unit and will support fixed or self propelled vehicles as artillery pieces. The framework supports rocket artillery such as the MLRS and Grad weapon systems, as well as the standard mortars and howitzers.


ARTY Quick Start

Video Tutorial on a Artillery quick start can be found here.

The Artillery Firing Interface

If you just want to play around with the Artillery as a player, you can do so by doing the following. Set up a static Artillery vehicle (empty). Put an Artillery GameLogic on the map. Syncronize the Artillery GameLogic with the static weapon you placed. If this is not done, the Artillery module features may not run properly in a multiplayer mission. Finally, start the game and get into the Artillery.

In Arma 2: OA, syncronization is not required. All artillery units are synced automatically. To prevent the action showing up in a specific unit, use:

this setVariable ["ARTY_VEHICLE", false]

You will see an option to target the artillery in your action menu. Clicking this brings up the artillery firing interface map. Each fall line on the map shows the fall altitude of your shell (or mortar round) at a given elevation and azimuth.

Note that you will need to be using ARTY ammo for this to work. Load an ARTY Magazine in your vehicle if you do not have one loaded already.

Example init for a M252 mortar:

{ this removeMagazines _x } forEach magazines [[this]; this addMagazine "ARTY_8Rnd_81mmHE_M252"

Setting up a battery

The first step to using the ARTY module with the AI is to set up a battery. You can have either a real battery or a virtual battery. For purposes of this tutorial we will use a real battery. The battery can consist of a group of any kind of artillery unit, but there are some simple ground rules that should be followed:

  • The battery must consist of the same kind of artillery unit. Note that you can have men in the group as well (such as drivers and gunners for the MLRS and Grad).
  • The battery should be crewed by AI. The fire mission execution scripts depend on the AI firing their artillery pieces in the correct sequence. This allows the scripts behind the Artillery System Logic to act like a virtual FDC, giving commands to the members of the battery just as a real FDC would in the field.
  • Self-propelled Artillery vehicles will need to stop to execute fire missions, so take this into account when making your missions.

Setting up a battery involves laying down a few artillery units in the editor and setting them up as a group. In order to “ARTY enable” this group, create an Artillery System game logic and Synchronize it to one of the units using the Synchronize (F5) function of the editor.

Creating an ARTY battery

Note that the Artillery System will consider the unit that is synced to to be the "lead" unit. What this means is that this unit's position will be considered to be the canonical position of the Artillery battery, and firing solutions will be calculated accordingly.

Creating fire missions

Because there are numerous variables involved in setting up a fire mission, there is a type of array known as a fire mission template that is used to generalize specific types of fire missions. To set up a fire mission template, create an array consisting of the following elements, in respective order:

  • Mission Type: “IMMEDIATE” or “TIMED”
    • The IMMEDIATE mission type will complete after a requested number of rounds have been fired.
    • The TIMED mission type will complete after a specific number of seconds have elapsed.
  • Ordnance Type: This is a string indicating the general type of ordnance to fire. Ordnance types are defined either by default or by calling the BIS_ARTY_F_AddOrdnanceType function. For each type of artillery, there are one or more ordnance types. Common default ordnance types include:
    • “HE” - High Explosive
    • “WP” - White Phosphorous (“Willie Pete”)
    • “SADARM” - Search and Destroy Armor
    • “LASER” - Laser guided artillery shell
    • “ILLUM” - Flares
    • “SMOKE” - Non-Incendiary Smoke
  • Rate of Fire: The delay, in seconds, between each shot. This delay will be applied globally throughout the entire battery. For example, if gun 1 fires, there will be a delay between that event and when gun 2 fires (and so on).
  • Duration of Mission OR Round Count: This depends on the mission type. This value is used as follows:
    • For IMMEDIATE missions, the number of rounds to fire.
    • For TIMED missions, the number of seconds to sustain fire.

For example: We want to define a fire mission template that has the battery firing 15 rounds of high explosive ammunition. To do this, we define the following template:

_heTemplate = ["IMMEDIATE", "HE", 0, 15];

Requesting Fire Support

To use your new battery in a fire support role, you can call the BIS_ARTY_F_ExecuteTemplateMission function. In order to do this, you must first have a target. Target coordinates must always be given in 3d, with the Z component being the altitude above sea level. This is particularly critical if you are not using spawn mode, because otherwise the artillery will not be able to properly calculate a firing solution.

The easiest way to test this is to set a target vehicle or unit, and then use:

_targetPos = getPosASL _targetUnit;

Then call the fire mission in on the position by using:

[_myBattery, _targetPos, _heTemplate] call BIS_ARTY_F_ExecuteTemplateMission;

Depending on how far away you are from the battery and its initial orientation, you may have to wait a few moments for it to rotate into place. After this happens, you will hear the artillery firing on the target and soon see the shells hitting in the vicinity (or on top of) your target vehicle.

Also note that when calling any of ARTY's functions, the artillery logic itself counts as your “battery” variable.


ARTY Modes

ARTY has two primary modes of operation: Spawn and non-Spawn. Both modes are useful in different instances.

Spawn Mode

This is the simplest artillery mode and is based on the shell-spawning found in the original Warfare. In this mode, shells will spawn in the air above your target after their time of flight has elapsed. The Artillery battery will still calculate a firing solution so you will see a realistic flight time, but there is no risk of complications from your shells hitting terrain in front of the artillery battery or along the trajectory. You should use spawn mode in cases where the scenario requires that the artillery shells always impact their target and you do not want to worry about micromanaging the position of the artillery battery.

Turn on spawn mode by running the following SQF code, where _battery is your group of artillery pieces:

[_battery, true] call BIS_ARTY_F_SetShellSpawn;

Non-Spawn Mode

In non-spawn mode, artillery shells will be shot at an elevation and azimuth appropriate to the firing solution and will then be allowed to fly to their target on their own. However, you must be careful using this mode as large terrain obstructions, such as mountains, will block the battery's fire. In addition, if you place your battery in a poor position (such as in front of a building or trees), disaster could occur. Since non-spawn mode is the more realistic of the two firing modes, care must be taken in battery deployment to ensure that you do not cause an accident. The ARTY system uses high-angle fires by default.

Non-Spawn mode is enabled by default, but it can be reactivated thusly:

[_battery, false] call BIS_ARTY_F_SetShellSpawn;


Virtual Artillery

Artillery with Virtual Pieces

The virtual artillery feature is used to simulate an artillery battery somewhere on the map, but where none actually exists. To use virtual artillery, set up a battery as you usually would, but instead of an actual artillery piece, lay down a Virtual Artillery Piece gamelogic.

The virtual artillery piece will do everything that a real artillery piece does, without physically existing. It cannot be destroyed by the enemy and will not show up as an enemy vehicle on radar. The virtual artillery piece is primarily used in cases such as during a random Artillery Barrage secop request, where the battery is spawned somewhere on the map and there is no time to pick a suitable place for it.

Because of its “virtual” nature, the virtual artillery piece needs to simulate a specific real artillery piece. By default, it will simulate an M119, but you can change this with the BIS_ARTY_F_SetVirtualGun function. For instance, to set up a virtual D30, do the following on a piece of virtual artillery (in this case _virtualPiece):

[_virtualPiece, "D30"] call BIS_ARTY_F_SetVirtualGun;

The SecOp Manager takes advantage of the virtual artillery system in cases where a real artillery battery is not specified during the addition of the “Artillery Barrage” secop request.

Keep in mind that virtual artillery will operate in spawn and non-spawn mode as well. Shells are being spawned at either end of the trajectory in both cases.


Using ARTY with the Secop Manager

Artillery with SOM

The SecOp Manager (or SOM) is currently the simplest way to take advantage of the artillery system. To use this, you must have a SecOp Manager gamelogic synced to the player. If you want to use SOM with a real artillery battery, you must have constructed a battery using either real or virtual artillery.

To add the artillery barrage to the list of Secop requests, you need to decide which ones should be available. As of the time of this writing, there are 9 fire mission templates loaded into the Secop manager which are available as Secop fire missions:

  1. Immediate suppression, high explosive - Fire 10 rounds as fast as the battery can.
  2. Immediate smoke - Fire 6 smoke shells.
  3. Immediate suppression, Willie Pete - Same as Immediate HE, but with WP.
  4. Illumination mission - One flare munition every 10 seconds for 3 minutes.
  5. LASER - Fire two laser guided HE shells.
  6. SADARM – Stagger three SADARMs ten seconds apart.
  7. HE Fire For Effect - Bombard with continuous HE for one minute.
  8. WP Fire For Effect – Bombard with continuous WP for one minute.
  9. Adjust fire - Fire two HE rounds at the target.

When using a physical or virtual artillery battery, a list of one or more of these FM types (by ID) will need to be included. For instance, if I wanted to have SOM call on my artillery battery (with RIPPER as the Artillery Module logic), I would run the following:

[["artillery_barrage"], player, [[RIPPER, [7,8,9]]], [true]] call BIS_SOM_addSupportRequestFunc;

The above will allow the two fire for effect missions and the adjust fire mission to be called by the SOM. The last parameter "[true]" means the SOM will not expire if you do not use it for X seconds. Once used, you will need to re-add the arty support request if you want to fire arty again.

However, the SOM will also run fire missions without an artillery battery specified. When you add this type of support request, it will utilize spawned virtual artillery pieces set in spawn mode, so you don't need to worry about the position of the battery—SOM will generate it automatically. Adding this type of support request is accomplished without passing parameters to the SOM as follows:

[["artillery_barrage"], player, [[]], [true]] call BIS_SOM_addSupportRequestFunc;

The SOM will handle all communications between the player and the HQ entity. Remember to only provide fire missions that are available for that Artillery battery (for instance, don't give the Grad an Illumination mission) or you will get an error.


Now after this explanation heres a step by step to add your artillery using SOM:


  1. Put a SOM module on the map
  2. Put the following in its init field to stop custom missions:this setVariable ["settings", [[], true, nil, nil, false]];
  3. Link it to your soldier (using F5)
  4. Create a trigger with the following onAct field:[["artillery_barrage"], player, [[]]] call BIS_SOM_addSupportRequestFunc;this will add the support function Artilley to your comm Menu (default 0)
    (The trigger should be of "repeated" type in order for you to add artilley when you need it)


ARTY Function Reference

This section describes the use of the ARTY module's external functions.

Initialization

BIS_ARTY_F_initVehicle

Parameters: [object]

Usage: call

This function can be used to init an artillery piece created with createvehicle.

Locality: The effects of this function are local to the calling machine.

Example:

[_gun] call BIS_ARTY_F_initVehicle;

However, since the object is most likely created in server and the function is local only, it needs to be ran on each player. This is one way to do it:

_gun setVehicleInit "[this] call BIS_ARTY_F_initVehicle";
processInitCommands;

Fire Control

BIS_ARTY_F_ExecuteTemplateMission

Parameters: [battery, targetPosASL, fireMissionTemplate]

Usage: spawn

This will cause the battery to attempt to execute a fire mission at targetPosASL (which is a position in ASL format). The battery will use the fire mission template passed in fireMissionTemplate. Monitoring the battery's mission state variables in addition to using the BIS_ARTY_F_Available function will allow you to determine the status of the mission after execution starts.

Locality: Will not do anything unless executed on the server in MP.


BIS_ARTY_F_PosInRange

Parameters: [battery, positionASL, ordType]

Usage: call

The ordType is one of the standard (or user defined) ordnance types (HE, ILLUM, etc). This is the best way to determine real range limits without manually calculating a firing solution. The function will attempt to find the appropriate magazine type and ballistics table for the ordType before calculating range. It then calculates a firing solution to determine if the artillery battery represented by battery can hit positionASL from the position of the lead element of the battery.

Note that if this function is executed on the server, it will cache the firing solution and subsequently not need to recalculate if a fire mission is executed against the same coordinate as the cached solution.

Returns: true if the position is in range to be fired on by the battery with the specified ordType, false if not.

Example:

// Check to see if position is in range before we fire.
// Second item in _fmTemplate is the ordType (HE, ILLUM, etc)
if ([_battery, _targetPosASL, _fmTemplate select 1] call BIS_ARTY_F_PosInRange) then
{
	[_battery, _targetPosASL, _fmTemplate] call BIS_ARTY_F_ExecuteTemplateMission;
}
else
{
	hint "Target out of range!";
};

Utility

BIS_ARTY_F_Available

Parameters: [battery, fireMissionTemplate]

Usage: call

This will return true if the artillery battery is available to execute a fire mission, false if not. Useful for determining whether or not the battery is busy.


BIS_ARTY_F_StillViable

Parameters: [battery, fireMissionTemplate]

Usage: call

This will return true if the artillery battery is still alive and able to operate (not necessarily whether or not it is busy), false if not. Destroyed batteries will not show as viable.


BIS_ARTY_F_SetVirtualGun

Parameters: [virtualArtillery, weaponType]

Usage: call

This will set the type of artillery piece that a virtual artillery piece is intended to simulate.

Example:

[_myVirtualPiece, "MLRS"] call BIS_ARTY_F_SetVirtualGun; // Virtual MLRS


BIS_ARTY_F_SetShellSpawn

Parameters: [battery, spawnMode]

Usage: call

Pass spawnMode as true to turn spawn mode on, false to turn it off. Spawn mode is off by default. In spawn mode, the artillery will fire but the shell will not be created until the time of flight has nearly elapsed, after which it is spawned on top of the target area. This mode is handy for cases where the mission designer really needs the artillery to hit without terrain interference. It also provides a slight performance boost and simplifies the effects of BIS_ARTY_F_SetDispersion.

This function works for both real and virtual artillery pieces.

Locality: The effect is local to the calling machine, so make sure to run it on the server before executing an AI fire mission.


BIS_ARTY_F_SetDispersion

Parameters: [battery, dispersionVal]

Usage: call

This will set a dispersion value for the artillery battery passed in the function. Dispersion works differently in spawn mode than in non-spawn mode. In non-spawn mode where projectiles fly in a ballistic arc, a random value in units of 0.1 milliradians from 0 to dispersionVal will be added to each shot. In spawn mode, the dispersionVal is simply a radius in meters.

Example:

// Force shells to randomly hit in a 200 meter circle.
[_battery, true] call BIS_ARTY_F_SetShellSpawn; // Turn spawn mode on
[_battery, 200] call BIS_ARTY_F_SetDispersion;

BIS_ARTY_F_ShellsInRadius

Parameters: [position, radius]

Usage: call

This function returns an array of arrays representing any flying shells in the given radius. Useful for simulating things like artillery radar. Each array takes the form of [shellObject, timeFired, firingVehicle].

Locality: Shells that the local client is aware of will be returned with this function.


Map

BIS_ARTY_F_LoadMapRanges

Parameters: [battery, ordType]

Usage: call

battery refers to the Artillery Module logic. ordType refers to the specified ordnance type ("HE", "ILLUM", a custom ordtype, etc). This will load the battery's minimum and max range variables based on The values can be accessed using the following:

_maxRange = _battery getVariable "ARTY_MAX_RANGE";
_minRange = _battery getVariable "ARTY_MIN_RANGE";

Locality: The effects of this function are local to the calling machine.


This is a list of the ARTY-enabled vehicles and their minimum and maximum ranges (in meters), retrieved using BIS_ARTY_F_LoadMapRanges and the ARTY_MIN_RANGE / ARTY_MAX_RANGE variables.

ClassName Description Ordnance Types Min range Max range
M119 105mm Towed Howitzer HE, WP, ILLUM, SADARM, LASER, SMOKE 2375m 5800m
D30 D30 122mm Towed Howitzer HE, WP, ILLUM, SADARM, LASER, SMOKE 2375m 5800m
M252 81mm Mortar HE, WP, ILLUM 100m 3700m
2b14_82mm, 2b14_82mm_INS, 2b14_82mm_CDF, 2b14_82mm_GUE 2B14 82mm Podnos Mortar HE, WP, ILLUM 100m 3700m
MLRS M270 Multiple Launch Rocket System HE 4900m 15550m
GRAD_CDF, GRAD_INS, GRAD_RU BM-21 "Grad" HE 3300m 10100m


ARTY Variable Reference

These are the artillery module logic's scope variables which can be accessed by using the getVariable command. They are useful for monitoring the progress of a fire mission's execution, as well as battery status.

Module Variables

Name Type Contains
BIS_ARTY_LOADED Boolean Will be true when the artillery module is loaded.
ARTY_ONMISSION Boolean Will be true when the artillery battery is on a fire mission.
ARTY_ONBRIEFING Boolean Will be true when the artillery battery is in a briefing phase (such as during the Secop Manager mission briefing).
ARTY_TARGETPOS 3d Position The position of the battery's current target. This is only valid during a fire mission. It is undefined otherwise.
ARTY_SHOTCALLED Boolean True if the artillery battery has shot its first round during a mission. Valid only during fire mission execution.
ARTY_SPLASH Boolean Will contain true during a fire mission when the first round is a few seconds away from impacting.
ARTY_AMMO String Contains the ordnance type being used on the current fire mission. Only valid during a fire mission.
ARTY_COMPLETE Boolean Sets to true when the artillery is "rounds complete" (has finished firing).
ARTY_CANCEL Boolean Sets to true when the artillery battery is canceling the mission. This will happen when the player calls check fire during the Secop Manager fire missions.
ARTY_BADTARGET Boolean This will become true when, after attempting to execute a fire mission, the battery determines that it cannot hit
ARTY_MIN_RANGE Number The minimum range in the artillery's firing envelope for the ordType passed in BIS_ARTY_F_LoadMapRanges. This will also be valid during a fire mission execution.
ARTY_MAX_RANGE Number The maximum 3d range in the artillery's firing envelope for the ordType passed in BIS_ARTY_F_LoadMapRanges. This will also be valid during a fire mission execution.

Examples

Notify the player when a fire mission has started and when it ends.

waitUntil { _battery getVariable "ARTY_ONMISSION" };
hint "The battery is on a mission.";
waitUntil { _battery getVariable "ARTY_COMPLETE" };
hint "Artillery is rounds complete.";

Find out when rounds are about to hit.

waitUntil { _battery getVariable "ARTY_SPLASH" };
hint "Incoming!";

Unit Variables

ARTY_VEHICLE Boolean Module sets this variable to true to each artillery type unit in the mission. It is used to determine if targeting action is displayed when player enters as gunner. To hide the action from a specific unit: myMortarTube setVariable ["ARTY_VEHICLE",false]


ARTY Vehicles and Magazines

This is a list of ARTY-enabled vehicles and their corresponding magazine types. Note that this does not include magazine types not compatible with the Artillery Module.

ClassName Description ARTY Magazines Default Ordnance Types Default SOM Fire Mission IDs
M119 105mm Towed Howitzer (British Royal Ordnance) ARTY_30Rnd_105mmHE_M119, ARTY_30Rnd_105mmWP_M119, ARTY_30Rnd_105mmSADARM_M119, ARTY_30Rnd_105mmLASER_M119, ARTY_30Rnd_105mmSMOKE_M119, ARTY_30Rnd_105mmILLUM_M119 HE, WP, ILLUM, SADARM, LASER, SMOKE 1,2,3,4,5,6,7,8,9
D30 D30 122mm Towed Howitzer (Former Soviet Union) ARTY_30Rnd_122mmHE_D30, ARTY_30Rnd_122mmWP_D30, ARTY_30Rnd_122mmSADARM_D30, ARTY_30Rnd_122mmLASER_D30,ARTY_30Rnd_122mmSMOKE_D30, ARTY_30Rnd_122mmILLUM_D30 HE, WP, ILLUM, SADARM, LASER, SMOKE 1,2,3,4,5,6,7,8,9
M252 81mm Mortar (United States) ARTY_8Rnd_81mmHE_M252, ARTY_8Rnd_81mmWP_M252, ARTY_8Rnd_81mmILLUM_M252 HE, WP, ILLUM 1,3,4,7,8,9
2b14_82mm, 2b14_82mm_INS, 2b14_82mm_CDF, 2b14_82mm_GUE 2B14 82mm Podnos Mortar (Former Soviet Union) ARTY_8Rnd_82mmHE_2B14, ARTY_8Rnd_82mmWP_2B14, ARTY_8Rnd_82mmILLUM_2B14 HE, WP, ILLUM 1,3,4,7,8,9
MLRS M270 Multiple Launch Rocket System (United States) ARTY_12Rnd_227mmHE_M270 HE 1,7,9
GRAD_CDF, GRAD_INS, GRAD_RU BM-21 "Grad" (Former Soviet Union) ARTY_40Rnd_120mmHE_BM21 HE 1,7,9


Frequently Asked Questions

How do I setup an AI battery programmatically without adding the module in the editor?

First Create the BIS_ARTY_LOGIC something like this:

_center = createCenter sideLogic;
_group = createGroup _center;
_pos = getPos _artyman;
_battery = _group createUnit ["BIS_ARTY_LOGIC",_pos , [], 0, ""];
_battery synchronizeObjectsAdd [_artyman]; // artyman is one of the units in the arty group

Then execute your firemision into _battery

I tried using the Secop Module method and it doesn't work. Why?

You may have to wait for the Secop Module to load properly. Spooner provided a helpful example of one useful way to get this to work:

// Assumes you have called your SecOp module "socom".
waitUntil { not isNil { socom getVariable "initDone" } };
waitUntil { socom getVariable "initDone" };

// The request commands in the biki are fine.
[["artillery_barrage"], player, [[]]] call BIS_SOM_addSupportRequestFunc;


Why does the MLRS blow up when I try to use it as a player?

You need to add an Artillery Module magazine with the rocket artillery for it to work properly. Try doing the following in the init field of your MLRS:

this addMagazine "ARTY_12Rnd_227mmHE_M270";

Feel free to remove the current magazines before doing this.


Why can't I get the targeting system to work?

Ensure that you have one of the listed Artillery Module magazines loaded into the vehicle you are using.


How do I refer to a battery for functions (such as BIS_ARTY_F_ExecuteTemplateMission) which take a battery parameter?

You should always use the Artillery Module logic as the battery.


Example Missions

How to use the Artillery Module and the Secop Manager with a physical MLRS battery

This mission puts a MLRS battery on the Southeast corner island. From there, you can put fire on most of the map by using the Secop Manager's support request. To add another support request, use the radio option. Pay attention to the trigger that adds the Secop Request.

ArtyDemo_MLRS_SOM.Chernarus.7z - By Headspace


Demo video for this mission

Arma 2 - Artillery System - MLRS: Youtube video


How to use Virtual Artillery pieces with the Secop Manager

This mission is very similar to the above, but it uses "Virtual" MLRS batteries instead. The init field of the Artillery Module gamelogic describes how to tell the virtual artillery pieces what type of artillery to simulate.

ArtyDemo_MLRS_SOM_VIRTUAL.zip - By Headspace

Operation Arrowhead Compatibility

  • As of Operation Arrowhead v1.55, this module is not needed in single player or multiplayer missions to use the new Artillery Computer.
  • Do not load your static arty weapons with the magazines which have the "ARTY" prefix; these are intended for the Artillery Module in Arma 2 only. Use the same magazine names, but omit the "ARTY_" prefix in the magazine name.