Artillery Module

ArmA 2 editing; configs, modeling, missions, textures, terrain etc.

Moderators: Lone Wolf, Snake Man

Snake Man
Commander-In-Chief
Posts: 9354
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC

Artillery Module

Post by Snake Man » 2009-05-29 23:28:38

Artillery Module

I have opened PMC Editing Wiki: ArmA 2 Artillery Module. Check it out.
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Re: Artillery Module

Post by T_Rex » 2009-12-03 16:19:04

I'm not sure if this is wiki-worthy, but I've worked out a way to use the SOM module (and the virtual arty game logic) to give the player some artillery options via script.

This uses the radio channel to allow the player to call artillery.

Code: Select all

_artyTrig = createTrigger ["EmptyDetector", (getpos Player)];
_artyTrig setTriggerArea [0, 0, 0, false];
_artyTrig setTriggerActivation ["ALPHA", "PRESENT", true];
_artyTrig setTriggerText "Connect to Ripper (field artillery)";
_artyTrig setTriggerStatements ["this", 'nul = [_artyTrig] execVM "JTD_artyCall.sqf"', ""];
Then, the JTD_artyCall script is simply:

Code: Select all

private ["_trig", "_artyTrig"];
_trig = _this select 0;
[["artillery_barrage"], player] call BIS_SOM_addSupportRequestFunc;
This adds all the available SOM artillery types to the player.
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.
Now, I've also faked opfor artillery.

This script is more in development. It requires the placement of a virtual artillery game logic (I named it JTD_arty), and it uses some gyrations to decide a target location.

Code: Select all

private ["_FRgroup", "_fireMission", "_frDist", "_keepLooping", "_rand", "_dir", "_dist", "_posX", "_posY", "_tgtPos", "_tempNear", "_mrk"];


_FRgroup = _this select 0;

// default arty to illumination
_fireMission = ["IMMEDIATE", "ILLUM", 0, 15];
_frDist = 1000;
// wait until FR team is within range, then random sleep
_keepLooping = true;

waituntil {((getPos (leader _FRgroup)) distance JTD_targCityPos) < 600};

while {_keepLooping} do
{
	// keep looping until FR team is dead/beyond 500m
	_cnt = {alive _x} count (units _Frgroup);
	if (_cnt == 0) then
	{
		_keepLooping = false;
		diag_log text "FR team dead.";
	}
	else
	{
	_frDist = (getPos (leader _FRgroup)) distance JTD_targCityPos;
	_rand = random 1;
		// 50% chance of triggering arty 
		if ((_frDist < 600) && (_rand < .5)) then
		{
		// also need a global to stop arty if blue ground attack starts JTD_blueAssault

			sleep ((random 300) + 180);

			_dir = random 360;
			_dist = (random 250) + 100;
			_posX = (JTD_targCityPos select 0) + sin (_dir) * _dist;
			_posY = (JTD_targCityPos select 1) + cos (_dir) * _dist;
			_tgtPos = [_posX, _posY, 0];

				// check to see if anything around there?
				// if house within 100, then use SADARM
				// if not, then use HE
				// if water, then nothing
				
			if ([_posX, _posY] surfaceIsWater) then
			{
				diag_log text "Arty target wet.";
				// maybe send a couple rounds anyway :)
				_tgtPos = JTD_targCityPos;
				_fireMission = ["IMMEDIATE", "HE", 1, 2];
			}
			else
			{
				_tempNear = nearestObjects [_tgtPos, ["HOUSE"], 100];
				if (count _tempNear) > 1 then
				{
					// firemission = sadam
					_fireMission = ["TIMED", "SADARM", 1, 5];
				}
				else
				{
					// firemission = HE
					_fireMission = ["TIMED", "HE", 2, 30];
				};

					[JTD_arty, _tgtPos, _fireMission] spawn BIS_ARTY_F_ExecuteTemplateMission;
					diag_log text format ["%1: Firing.", (_fireMission select 1)];
					_mrk = createMarker ["Target", _tgtPos];
					_mrk setMarkerColor "ColorBlack";
					_mrk setMarkerShape "ICON";
					_mrk setMarkerType "mil_objective";
					
					
					sleep 20;
					
					deleteMarker _mrk;
			};
		};
	};
};
The marker is placed for debugging. It seems to work.
Sic Semper tyrannosauro.

Snake Man
Commander-In-Chief
Posts: 9354
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC

Re: Artillery Module

Post by Snake Man » 2009-12-03 16:26:21

Thanks, I'll tag this with queued for our wiki :)
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

Who is online

Users browsing this forum: No registered users and 0 guests