ARTY - another simple artillery script

Changelog

Function

Generates an artillery request dialog. One can set target coordinates, the amount of shells and the spread of the salvo.

Remark: Coordinates have 4 digits. The first three digits are taken from the ingame map. For example: Right = 038, Up = 014. The center of this 100m square will be 0385/0145. The upper left 10m square will be 0381/0149 and not 0381/0141. The bottom right 10m square will therefore be 0389/0141 and not 0389/0149.

Why: I'm used to do so... You can change this by editing "dialog/definitions.sqf" (Line 27)

_UTMCorr = true; //set false if not. Set false if maps 000/000 is on the left-bottom corner of the map (usually all ArmA2 OA maps)

Usage

Example: Actionmenu entry for player (via init.sqf)


player addAction ["<t color ='#FFCC00'>Call Artillery</t>","tn_arty\dialog\openMenu.sqf",[],1,false,true,"",""];

Variables

The following global variables can be set:

NameTypeDescriptionExample
TNARTY_ShellsLeftMaxIntegerMaximum of available shellsTNARTY_ShellsLeftMax = 50;
TNARTY_TimeBetweenFireRequestsRealAmount of time in seconds between two fire requestsTNARTY_TimeBetweenFireRequests = 30.0;
TNARTY_ammoTypeStringConfig-name of ammotype (see: ArmA 2: Weapons )TNARTY_ammoType = "ARTY_Sh_81_HE";

Marker

The following marker have to be set by the missionmaker

MarkernameDescription
artysiteLocation of the virtual artillery site. Determines distance to target.
corMarkerHas to be set manually on map-coordinates 000/000 (regulary left-top). Is needed to auto-correct the map bug, which causes that map coordinates will differ from editor coordinates. It's adviced to set an invisible marker.

Ballistics background

Both "Flying time of the shell to target" and "Spread of the shells as a function of distance" are roughly estimated only.

Flying time of shells

_v0 = 174; //initial velocity of 81mm mortar shell in meters per second
_timeToTarget = sqrt(( ( 9.81 * _spreadDistance * _spreadDistance * 1000000) / ( 2 * _v0 * _v0) ) * 2 / 9.81 );

Where "_spreadDistance" is the distance between the virtual artillery site and the target in kilometers. Therefore multiplied by "1000000" to get meters again. "9.81" is the average gravitation acceleration in meters per second.
The formula "the trajectory of a thrown object", which is the simplest case of "the so-called trajectory parabola" and estimates here the full calculation of the ballistic curve.

Spread by target distance

_spread = (exp (_spreadDistance/2) ) * 2; 

Where "_spreadDistance" is the distance between the virtual artillery site and the target in kilometers. For a plot (x = _spreaddistance, y = spread at target in meters) see Wolfram Alpha. Which means: At 10 kilometers (between virtual artillery site and the target) the shells will hit somewhere within a radius of 300 meters.