GroundLoop

Mortar Support

12 posts in this topic

I stumbled across this script and thought I could place the trigger in XM8 app. This actually worked and I was able to call in a Mortar Strike. Sweet!

The are some things that don't seem to work though.

1. I'm only getting a hint message but nothing from HQ on the sidechat.

2. It feels like the script doesn't release or end.. I can no longer TP by clicking on the map after using this and have to relog. 

Please, I need help!

Spoiler

////////////////////////////////////////////////////////////////////////
// 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";

 

1 person likes this

Share this post


Link to post
Share on other sites

I'm still trying to figure this out. In so doing, I came across Fockers Arma Scripting guide. First lesson learned... turn on script errors lol. Since his guide used examples in the mpeditor, after I learned the addaction I tried out the script and everything works as intended including the message from COSSROADS.

Now I'm really stumped. Obviously there is a difference between a script for mp and a server. This is gona be a long climb lol.

Again, any assistance, guidance and input is greatly appreciated. Thanks!

Share this post


Link to post
Share on other sites
Advertisement

Are you using infiSTAR ? It could be interfering if you are maybe ?

Share this post


Link to post
Share on other sites

No, no antihack software at all. This is just a test server on my local box.

It appears that the way the onMapSingleClick is handled, is now incorrect. The BIS wiki says to use BIS_fnc_addStackedEventHandler but in another post on these forums I read that this BIS function is not implemented? I'm still searching and messing with it.. lol

I'm surprised it works, but I'm not sure if another player would have access to it too. But it's also the messages that I can't get to work. The hint comes up fine but no messages from CROSSROADS.

Share this post


Link to post
Share on other sites

Maybe change the "_HQ sidechat" to something that is used in Exile instead of _HQ ?

Share this post


Link to post
Share on other sites

Thank you! I'm going to do some more reading on the subject now. I've already tried inserting bits of script from stuff that works, but whatever I do seems to break it lol.

Share this post


Link to post
Share on other sites
6 hours ago, MetalHead said:

Maybe change the "_HQ sidechat" to something that is used in Exile instead of _HQ ?

You da man! :)

I know I had changed the sideChat before, but always tried to incorporate the "HQ" bit. I managed to work my way through the script, changing a few other things (mostly trial and error lol)  along the way until the script errors stopped popping up.

So, this is what it looks like now.

Spoiler

if(SMxm8app) then {
 (findDisplay 24015) closeDisplay 0;
};

private ["_rounds", "_roundType", "_radiusSpread", "_travelTime", "_delay", "_reloadTime", "_position", "_received"];

_rounds = 4;     // Number of rounds to fire
_roundType = "Sh_120mm_HE";  // Ammo Names that can be used - (Tested) Sh_120mm_HE, Sh_155mm_AMOS, (Not Tested) M_RPG32_F, Bo_GBU12_LGB_MI10, Bo_GBU12_LGB, Sh_120mm_APFSDS
_radiusSpread = 30;    // Accuracy of each round (meters)
_travelTime = 5 + random 10; // Delay between firing and splash (seconds)
_delay =  3;     // Delay between each round (seconds)
_reloadTime = 10;    // Delay between fire missions (seconds)

_received = "FIRE MISSION RECEIVED. WAIT OUT.";

if ( !(isNil "artyReady") ) exitWith {hint "Artillary not currently available"};
openMap true;
systemChat "Awaiting Fire Mission Coordinates";
hint "Click map location for artillery";
onMapSingleClick "
 artyMrk = createMarker [""artyPos"",_pos];
    artyMrk setMarkerType ""mil_warning"";
    artyMrk setMarkerColor ""ColorRed"";
    artyMrk setMarkerText ""Artillery"";
    mapClicked = true;
    onMapSingleClick {};
    hint """";
";

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

artyReady = false;
publicVariable "artyReady";

[_received,0,1,2,2] spawn bis_fnc_dynamictext;
systemChat _received;
sleep _delay;
sleep 3;
openMap false;

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

systemChat format ["ETA %1 seconds",round _travelTime];
sleep _travelTime - 0.5;

_position = markerPos "artyPos";
systemChat format["Splash round %1",_rounds];
for "_round" from 0 to _rounds do {
   
    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;
};
sleep 3;
systemChat "FIRE MISSION COMPLETE.";
deleteMarker "artyPos";
sleep _reloadTime;
systemChat "Artillary ready. Awaiting orders...";
artyReady = nil;
publicVariable "artyReady";

Although I have tested this on my server, I'm not sure what happens if several people ordered a strike. They may not even have access to it.. As soon as I can find someone crazy enough to join me, I'm going to test that.

In the meantime I'm going to see how I can charge poptabs for this hehe

Share this post


Link to post
Share on other sites

Posted (edited)

Maybe put in a delay so it can only be used once by any player at any given time ?

Edited by MetalHead

Share this post


Link to post
Share on other sites

That's taken care of with this variable in the script.

12 hours ago, GroundLoop said:

_reloadTime = 10;    // Delay between fire missions (seconds)

It's set for ten seconds now but can be set to whatever works for your scenario.

I think I would prefer controlling it through poptabs though when I figure it out. That way new players joining wouldn't have access to things like this until they have a better feel for the server they are playing on, and by adjusting the different variables (including price hehe) regular players would only use this feature twice maybe per 4hr server cycle.

That's the plan anyway :)

Share this post


Link to post
Share on other sites

Looking good so far. Give me a shout if you need it testing, I'm usually server hopping in the evenings. ;)

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.