Jump to content
Sign in to follow this  
bangabob

Simple Mortar script

Recommended Posts

SIMPLE MORTAR SCRIPT FOR ARMA 3

Description



Fires set amount of rounds towards your target (mapclick).

Features

- Realistic dispersion between rounds

- High customization options

- Very simple/easy to use

- MP compatible

How to use

1. Copy mortar.sqf into your mission folder

2. Place radio repeatable trigger in editor

3. null = [3] execVM "mortar.sqf";

Parameter is number of rounds fired during the fire mission

Mortar.sqf

////////////////////////////////////////////////////////////////////////
// SIMPLE - just pass number of rounds needed
// [3] execVM "mortar.sqf";
//
// OPTIONAL
// [NumRounds, AmmoType, Spread, TravelTime, Delay, ReloadTime, Side ] execVM "mortar.sqf";
//
// NumRounds    - Number of rounds to fire (number)             - 3
// AmmoType     - Config ammo name (string)                     - "Sh_120mm_HE"
// Spread       - Accuracy of each round (meters)               - 30
// TravelTime   - Delay between firing and splash (seconds)     - 10
// Delay        - Delay between each battery (seconds)          - 3
// ReloadTime   - Delay between fire missions (seconds)         - 10
// Side         - Side of artillary (east, west) etc            - west
//////////////////////////////////////////////////////////////////////

private ["_rounds", "_roundType", "_radiusSpread", "_travelTime", "_delay", "_reloadtime", "_side", "_HQ", "_position"];

_rounds = [_this,0,3,[0]] call BIS_fnc_param;
_roundType = [_this,1,"Sh_120mm_HE",[""]] call BIS_fnc_param;
_radiusSpread = [_this,2,30,[0]] call BIS_fnc_param;
_travelTime = [_this,3,10,[0]] call BIS_fnc_param;
_delay =  [_this,4,3,[0]] call BIS_fnc_param;
_reloadtime = [_this,5,10,[0]] call BIS_fnc_param;
_side = [_this,6,west,[sideUnknown]] call BIS_fnc_param;
_HQ = [_side,"HQ"];


if ( !(isNil "BOB_sms_artyReady") ) exitWith {hint "Artillary not currently available"};
openMap true;
_HQ sideChat "Awaiting Fire Mission Coordinates";
hint "Click map location for artillery";
onMapSingleClick "
   BOB_sms_artyMrk = createmarker [""BOB_sms_artyPos"",_pos];
   BOB_sms_artyMrk setMarkerType ""hd_dot"";
   BOB_sms_artyMrk setMarkerColor ""ColorGreen"";
   BOB_sms_artyMrk setMarkerText ""Artillery"";
   BOB_sms_mapClicked = true;
   onMapSingleClick {};
   hint """";
";

waitUntil { !(isNil "BOB_sms_mapClicked") };
BOB_sms_mapClicked = nil;

BOB_sms_artyReady = false;
publicVariable "BOB_sms_artyReady";


_HQ sideChat "FIRE MISSION RECEIVED. WAIT OUT";
sleep _delay;

   sleep 3;
   openMap false;

for "_round" from 1 to _rounds do {
   _HQ sideChat format ["Firing Battery %1",_round];
   sleep _delay;
};

_HQ sideChat format ["ETA %1 seconds",_travelTime];
sleep _travelTime - 0.5;

_position = markerPos "BOB_sms_artyPos";
for "_round" from 1 to _rounds do {
   _HQ sideChat format["Splash round %1",_round];
   sleep 0.5;
   _mortarPos = [(_position select 0)-_radiusSpread*sin(random 360),(_position select 1)-_radiusSpread*cos(random 360),200];
   _bomb = _roundType createVehicle _mortarPos;
   [_bomb, -90, 0] call BIS_fnc_setPitchBank;
   _bomb setVelocity [0,0,-100];
   sleep _delay - 0.5;
};

_HQ sideChat "FIRE MISSION COMPLETE.";
sleep _reloadtime;

_HQ sideChat "Artillary ready. Awaiting orders...";
deleteMarker "BOB_sms_artyPos";
BOB_sms_artyReady = nil;
publicVariable "BOB_sms_artyReady";  

Credits

BangaBob for writing original script

Anthonyfromtheuk & Larrow for updating script

Edited by BangaBob

Share this post


Link to post
Share on other sites

Nice Script :)

But is it possible to get it to work in MP for all players? Right now it only works for him hosting the game :confused:

Excuse my English, I use Google Translate

Share this post


Link to post
Share on other sites
Nice Script :)

But is it possible to get it to work in MP for all players? Right now it only works for him hosting the game :confused:

Excuse my English, I use Google Translate

Thanks for bringing this to my attention. I will have a look soon

Share this post


Link to post
Share on other sites

:yay:Very nice!!!

It is possible to have it activated by a trigger? I explain: I want to set up an area where if a unit is present the mortars start bombing that specific area. Basically, I don't want to use the radio trigger, but have it behave like a mine field, just with mortar shells instead.Is it possible?

Share this post


Link to post
Share on other sites

Hi, nice work!!!

It is possible to have it activated by a trigger if a unit is present in a specific area?More or less like a minefield but with mortar shell. Basically I don't want to use the radio trigger.Sorry for my silly questions but I'm a noob at mission editing and scripting.

Share this post


Link to post
Share on other sites

What would be a good idea if using for MP is to only allow Team Leaders or a single unit the ability to use it otherwise everyone and there dog will be using it,. but would be to Re-sync after death.

Share this post


Link to post
Share on other sites

Well true.Still, it can be be used once at a time. So only one artillery fire mission can be called at any one time.

I looked into making it specific for certain players. But then it become "not so simple mortar script"

I think all the tools are there for your own editing if you want to change things

Share this post


Link to post
Share on other sites

Hey Bangabob,

Nice script.... Currently it only works in the in game server.... Do you have the intention to make it work on a dedicated server? Or do you know how to make it work there???

I dont know why but I couldnt make it work in a dedicated server. It fires, the text appears until the third round hoewever nothing happens after.... I mean this is what I get:

CROSSROAD fire 1

CROSSROAD fire 2

CROSSROAD fire 3

But nothing else and the explosions doesnt splash out....

Do you have any idea what could happen?

BR and good job!

Edited by legio4777

Share this post


Link to post
Share on other sites
Hey Bangabob,

Nice script.... Currently it only works in the in game server.... Do you have the intention to make it work on a dedicated server? Or do you know how to make it work there???

I dont know why but I couldnt make it work in a dedicated server. It fires, the text appears until the third round hoewever nothing happens after.... I mean this is what I get:

CROSSROAD fire 1

CROSSROAD fire 2

CROSSROAD fire 3

But nothing else and the explosions doesnt splash out....

Do you have any idea what could happen?

BR and good job!

I have tried to make it compatible with a dedicated. But it just doesn't work. If anyone has the know how feel free to update it or let me know how

Share this post


Link to post
Share on other sites

Hi Bangabob, love your work! (I'm currently making a mission using EOS)

I wondered if it would be possible (meaning not too hard) to make a version that requires map coordinates or something a bit more challenging than clicking on the map to call in mortars?

It just seems too easy to take out a whole base/town etc. it would be nice if it was kinda hard to get the mortars to drop exactly where the enemy are, then you would feel more of a sense of accomplishment when you take something out with mortars.

Any thoughts on this?

Share this post


Link to post
Share on other sites

No, explosions are happening for me, the rest works fine, the explosion just doesn't happen :/

Share this post


Link to post
Share on other sites

Not working for me either, I've tried changing the ammo but nothing seems to spawn.

Share this post


Link to post
Share on other sites

The ammo type "M_RPG32_F" is no longer valid, many ammo types need some velocity to make them collide with the ground to get an explosion out of them, some ammo types need their pitch/bank set if spawned in the air so their tails dont look wierd whilst falling.

Heres a quick clean up of bob's script ( hope you dont mind)

////////////////////////////////////////////////////////////////////////
// SIMPLE - just pass number of rounds needed
// [3] execVM "mortar.sqf";
//
// OPTIONAL
// [NumRounds, AmmoType, Spread, TravelTime, Delay, ReloadTime, Side ] execVM "mortar.sqf";
//
// NumRounds    - Number of rounds to fire (number)             - 3
// AmmoType     - Config ammo name (string)                     - "Sh_120mm_HE"
// Spread       - Accuracy of each round (meters)               - 30
// TravelTime   - Delay between firing and splash (seconds)     - 10
// Delay        - Delay between each battery (seconds)          - 3
// ReloadTime   - Delay between fire missions (seconds)         - 10
// Side         - Side of artillary (east, west) etc            - west
//////////////////////////////////////////////////////////////////////

private ["_rounds", "_roundType", "_radiusSpread", "_travelTime", "_delay", "_reloadtime", "_side", "_HQ", "_position"];

_rounds = [_this,0,3,[0]] call BIS_fnc_param;
_roundType = [_this,1,"Sh_120mm_HE",[""]] call BIS_fnc_param;
_radiusSpread = [_this,2,30,[0]] call BIS_fnc_param;
_travelTime = [_this,3,10,[0]] call BIS_fnc_param;
_delay =  [_this,4,3,[0]] call BIS_fnc_param;
_reloadtime = [_this,5,10,[0]] call BIS_fnc_param;
_side = [_this,6,west,[sideUnknown]] call BIS_fnc_param;
_HQ = [_side,"HQ"];


if ( !(isNil "BOB_sms_artyReady") ) exitWith {hint "Artillary not currently available"};

_HQ sideChat "Awaiting Fire Mission Coordinates";
hint "Click map location for artillery";
onMapSingleClick "
BOB_sms_artyMrk = createmarker [""BOB_sms_artyPos"",_pos];
BOB_sms_artyMrk setMarkerType ""hd_dot"";
BOB_sms_artyMrk setMarkerColor ""ColorGreen"";
BOB_sms_artyMrk setMarkerText ""Artillery"";
BOB_sms_mapClicked = true;
onMapSingleClick {};
hint """";
";

waitUntil { !(isNil "BOB_sms_mapClicked") };
BOB_sms_mapClicked = nil;

BOB_sms_artyReady = false;
publicVariable "BOB_sms_artyReady";

_HQ sideChat "FIRE MISSION RECEIVED. WAIT OUT";
sleep _delay;

for "_round" from 1 to _rounds do {
_HQ sideChat format ["Firing Battery %1",_round];
sleep _delay;
};

_HQ sideChat format ["Salvos ETA %1 seconds",_travelTime];
sleep _travelTime - 0.5;

_position = markerPos "BOB_sms_artyPos";
for "_round" from 1 to _rounds do {
_HQ sideChat format["Splash round %1",_round];
sleep 0.5;
_mortarPos = [(_position select 0)-_radiusSpread*sin(random 360),(_position select 1)-_radiusSpread*cos(random 360),200];
_bomb = _roundType createVehicle _mortarPos;
[_bomb, -90, 0] call BIS_fnc_setPitchBank;
_bomb setVelocity [0,0,-100];
sleep _delay - 0.5;
};

_HQ sideChat "FIRE MISSION COMPLETE.";
sleep _reloadtime;

_HQ sideChat "Artillary ready. Awaiting orders...";
deleteMarker "BOB_sms_artyPos";
BOB_sms_artyReady = nil;
publicVariable "BOB_sms_artyReady";

Edited by Larrow

Share this post


Link to post
Share on other sites
The ammo type "M_RPG32_F" is no longer valid, many ammo types need some velocity to make them collide with the ground to get an explosion out of them, some ammo types need their pitch/bank set if spawned in the air so their tails dont look wierd whilst falling.

Heres a quick clean up of bob's script ( hope you dont mind)

////////////////////////////////////////////////////////////////////////
// SIMPLE - just pass number of rounds needed
// [3] execVM "mortar.sqf";
//
// OPTIONAL
// [NumRounds, AmmoType, Spread, TravelTime, Delay, ReloadTime, Side ] execVM "mortar.sqf";
//
// NumRounds    - Number of rounds to fire (number)             - 3
// AmmoType     - Config ammo name (string)                     - "Sh_120mm_HE"
// Spread       - Accuracy of each round (meters)               - 30
// TravelTime   - Delay between firing and splash (seconds)     - 10
// Delay        - Delay between each battery (seconds)          - 3
// ReloadTime   - Delay between fire missions (seconds)         - 10
// Side         - Side of artillary (east, west) etc            - west
//////////////////////////////////////////////////////////////////////

private ["_rounds", "_roundType", "_radiusSpread", "_travelTime", "_delay", "_reloadtime", "_side", "_HQ", "_position"];

_rounds = [_this,0,3,[0]] call BIS_fnc_param;
_roundType = [_this,1,"Sh_120mm_HE",[""]] call BIS_fnc_param;
_radiusSpread = [_this,2,30,[0]] call BIS_fnc_param;
_travelTime = [_this,3,10,[0]] call BIS_fnc_param;
_delay =  [_this,4,3,[0]] call BIS_fnc_param;
_reloadtime = [_this,5,10,[0]] call BIS_fnc_param;
_side = [_this,6,west,[sideUnknown]] call BIS_fnc_param;
_HQ = [_side,"HQ"];


if ( !(isNil "BOB_sms_artyReady") ) exitWith {hint "Artillary not currently available"};

_HQ sideChat "Awaiting Fire Mission Coordinates";
hint "Click map location for artillery";
onMapSingleClick "
BOB_sms_artyMrk = createmarker [""BOB_sms_artyPos"",_pos];
BOB_sms_artyMrk setMarkerType ""hd_dot"";
BOB_sms_artyMrk setMarkerColor ""ColorGreen"";
BOB_sms_artyMrk setMarkerText ""Artillery"";
BOB_sms_mapClicked = true;
onMapSingleClick {};
hint "";
";

waitUntil { !(isNil "BOB_sms_mapClicked") };
BOB_sms_mapClicked = nil;

BOB_sms_artyReady = false;
publicVariable "BOB_sms_artyReady";

_HQ sideChat "FIRE MISSION RECEIVED. WAIT OUT";
sleep _delay;

for "_round" from 1 to _rounds do {
_HQ sideChat format ["Firing Battery %1",_round];
sleep _delay;
};

_HQ sideChat format ["Salvos ETA %1 seconds",_travelTime];
sleep _travelTime - 0.5;

_position = markerPos "BOB_sms_artyPos";
for "_round" from 1 to _rounds do {
_HQ sideChat format["Splash round %1",_round];
sleep 0.5;
_mortarPos = [(_position select 0)-_radiusSpread*sin(random 360),(_position select 1)-_radiusSpread*cos(random 360),200];
_bomb = _roundType createVehicle _mortarPos;
[_bomb, -90, 0] call BIS_fnc_setPitchBank;
_bomb setVelocity [0,0,-100];
sleep _delay - 0.5;
};

_HQ sideChat "FIRE MISSION COMPLETE.";
sleep _reloadtime;

_HQ sideChat "Artillary ready. Awaiting orders...";
deleteMarker "BOB_sms_artyPos";
BOB_sms_artyReady = nil;
publicVariable "BOB_sms_artyReady";

that doesnt work for me, in fact with the template mission niether versions work, it ask me to click the map and does nothing.

Share this post


Link to post
Share on other sites

Had not looked at the template, but its just a simple radio trigger.

...Ah sorry my fail at the last moment i added a hint to the map click to clear the "Click map location for artillery" but forgot to add the double quotes because its in the onSingleMapClick command. Updated post.

Share this post


Link to post
Share on other sites

Sweet this works great now, I added openMap true; and openMap false; so the map opens when I use the trigger and closes 3 after I set the target. One thing I would like to know is how do I change the sidechat name of the arty??? It is currently CROSSROAD

Share this post


Link to post
Share on other sites

Anthonyfromtheuk, can you pleas post your update to the script, i'm not so pro to add them bymyself :)

Share this post


Link to post
Share on other sites
Anthonyfromtheuk, can you pleas post your update to the script, i'm not so pro to add them bymyself :)
Im not so pro either it was just a bit of trial and error until I was happy with the result but here it is. (probably could be done better)
////////////////////////////////////////////////////////////////////////
// SIMPLE - just pass number of rounds needed
// [3] execVM "mortar.sqf";
//
// OPTIONAL
// [NumRounds, AmmoType, Spread, TravelTime, Delay, ReloadTime, Side ] execVM "mortar.sqf";
//
// NumRounds    - Number of rounds to fire (number)             - 3
// AmmoType     - Config ammo name (string)                     - "Sh_120mm_HE"
// Spread       - Accuracy of each round (meters)               - 30
// TravelTime   - Delay between firing and splash (seconds)     - 10
// Delay        - Delay between each battery (seconds)          - 3
// ReloadTime   - Delay between fire missions (seconds)         - 10
// Side         - Side of artillary (east, west) etc            - west
//////////////////////////////////////////////////////////////////////

private ["_rounds", "_roundType", "_radiusSpread", "_travelTime", "_delay", "_reloadtime", "_side", "_HQ", "_position"];

_rounds = [_this,0,3,[0]] call BIS_fnc_param;
_roundType = [_this,1,"Sh_120mm_HE",[""]] call BIS_fnc_param;
_radiusSpread = [_this,2,30,[0]] call BIS_fnc_param;
_travelTime = [_this,3,10,[0]] call BIS_fnc_param;
_delay =  [_this,4,3,[0]] call BIS_fnc_param;
_reloadtime = [_this,5,10,[0]] call BIS_fnc_param;
_side = [_this,6,west,[sideUnknown]] call BIS_fnc_param;
_HQ = [_side,"HQ"];


if ( !(isNil "BOB_sms_artyReady") ) exitWith {hint "Artillary not currently available"};
openMap true;
_HQ sideChat "Awaiting Fire Mission Coordinates";
hint "Click map location for artillery";
onMapSingleClick "
   BOB_sms_artyMrk = createmarker [""BOB_sms_artyPos"",_pos];
   BOB_sms_artyMrk setMarkerType ""hd_dot"";
   BOB_sms_artyMrk setMarkerColor ""ColorGreen"";
   BOB_sms_artyMrk setMarkerText ""Artillery"";
   BOB_sms_mapClicked = true;
   onMapSingleClick {};
   hint """";
";

waitUntil { !(isNil "BOB_sms_mapClicked") };
BOB_sms_mapClicked = nil;

BOB_sms_artyReady = false;
publicVariable "BOB_sms_artyReady";


_HQ sideChat "FIRE MISSION RECEIVED. WAIT OUT";
sleep _delay;

   sleep 3;
   openMap false;

for "_round" from 1 to _rounds do {
   _HQ sideChat format ["Firing Battery %1",_round];
   sleep _delay;
};

_HQ sideChat format ["ETA %1 seconds",_travelTime];
sleep _travelTime - 0.5;

_position = markerPos "BOB_sms_artyPos";
for "_round" from 1 to _rounds do {
   _HQ sideChat format["Splash round %1",_round];
   sleep 0.5;
   _mortarPos = [(_position select 0)-_radiusSpread*sin(random 360),(_position select 1)-_radiusSpread*cos(random 360),200];
   _bomb = _roundType createVehicle _mortarPos;
   [_bomb, -90, 0] call BIS_fnc_setPitchBank;
   _bomb setVelocity [0,0,-100];
   sleep _delay - 0.5;
};

_HQ sideChat "FIRE MISSION COMPLETE.";
sleep _reloadtime;

_HQ sideChat "Artillary ready. Awaiting orders...";
deleteMarker "BOB_sms_artyPos";
BOB_sms_artyReady = nil;
publicVariable "BOB_sms_artyReady";

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×