Jump to content

Recommended Posts

Hello everyone! Can you please tell me if there is a script for calling artillery by clicking on the map for multiplayer? I need that the map interface in the window be called up and that you can click on the target and that the action of calling an artillery strike can be tied to an object (for example, to a radio station lying on the table) and, if possible, a limited number of times. Thanks everyone and sorry for my english.

Share this post


Link to post
Share on other sites

hello. Welcome on forum.

Did you try the BI support module (virtual artillery or linked to an existing one?) Do you experience some difficulties with these modules or do you need something different?

Share this post


Link to post
Share on other sites
6 minutes ago, pierremgi said:

hello. Welcome on forum.

Did you try the BI support module (virtual artillery or linked to an existing one?) Do you experience some difficulties with these modules or do you need something different?

Pierremgi, thanks for the answer! Yes, I tried the standard modules from BI, but they have what I don't need and don't like - calling support using the radio. I would like to have a script that would invoke support using the context menu through a click on the map.

 

Share this post


Link to post
Share on other sites
16 minutes ago, pierremgi said:

hello. Welcome on forum.

Did you try the BI support module (virtual artillery or linked to an existing one?) Do you experience some difficulties with these modules or do you need something different?

I tried the following method, but as I understand it, it will only work locally for the player who is performing the action. If you can remake it for multiplayer, it would be great.
This is how my script looks like:

Spoiler


openMap true;

onMapSingleClick {
onMapSingleClick {};
[_pos, "rhs_ammo_3of56", 120, 10, 10] spawn BIS_fnc_fireSupportVirtual;
openMap false;
true
};

 

And so it can be called through the mouse wheel, if you go to the object, in the initialization of which the following is written:

Spoiler

this addAction ["Call the support",{null = [] execVM "arty.sqf"}];

 

Share this post


Link to post
Share on other sites

No, that should work in MP as well.

Your addAction is visible by all because you placed it in init field on an object (pole, vehicle or else). If this object is OK when a player joins, so the code (addAction) runs and any player can call the artillery.

The inner code of the addAction (so called by one player), is local but you are using a BI function (BIS_fnc_fireSupportVirtual) which calls itself createVehicle command for the explosive. the created vehicle is global (visible by any player) So, yes, MP compatible, imho.

Share this post


Link to post
Share on other sites
9 minutes ago, pierremgi said:

No, that should work in MP as well.

Your addAction is visible by all because you placed it in init field on an object (pole, vehicle or else). If this object is OK when a player joins, so the code (addAction) runs and any player can call the artillery.

The inner code of the addAction (so called by one player), is local but you are using a BI function (BIS_fnc_fireSupportVirtual) which calls itself createVehicle command for the explosive. the created vehicle is global (visible by any player) So, yes, MP compatible, imho.

Hmm.Thanks for this answer too! I will try to test the script with other players soon.
If it does not make it difficult, you could not suggest the following:
1) Is it possible to make a delay between the execution of the addAction command and the start of an artillery strike (the shells just start falling immediately)?
2) Is it possible to limit the number of artillery calls using my script?
3) Is it possible to make this action call a specific player named "Radioman" (as an example)?

Share this post


Link to post
Share on other sites

The next step is the use for bis_fnc_addStackedEventHandler "onMapSingleClick" instead of onMapSingleClick command:


 

this addAction ["Call the support",
  {
    openMap true;
    ["customArtillery", "onMapSingleClick", {
      params ["","_pos","",""];
      openMap false;
      [_pos] spawn {
        params ["_pos"];
        sleep 20;
        [_pos, "Sh_82mm_AMOS", 120, 10, 1] call BIS_fnc_fireSupportVirtual;
      };
      ["customArtillery", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
    }] call BIS_fnc_addStackedEventHandler;
  },nil,1.5, true,true, "", "_this == radioMan", 5,false
];

 

If you want to limit the artillery use, just add a counter.
Something like:
 

if (isServer) then {
  artyCounter = 1;
  publicVariable "artyCounter";
};

this addAction ["Call the support",
  {
    openMap true;
    ["customArtillery", "onMapSingleClick", {
      params ["","_pos","",""];
      openMap false;
      [_pos] spawn {
        params ["_pos"];
        artyCounter = artyCounter + 1;
        publicVariable "artyCounter";
        sleep 20;
        [_pos, "Sh_82mm_AMOS", 120, 10, 1] call BIS_fnc_fireSupportVirtual;
      };
      ["customArtillery", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
    }] call BIS_fnc_addStackedEventHandler;
  },nil,1.5, true,true, "", "_this == radioMan && artyCounter < 5", 5,false
];

 

Adding a "cooler", avoiding too fast repetition:


 

if (isServer) then {
  artyCounter = 1;
  publicVariable "artyCounter";
};

this addAction ["Call the support",
  {
    params ["_tgt"];
    openMap true;
    ["customArtillery", "onMapSingleClick", {
      params ["","_pos","","","_arg"];
      _arg params ["_tgt"];
      openMap false;
      [_pos,_tgt] spawn {
        params ["_pos","_tgt"];
        artyCounter = artyCounter + 1;
        publicVariable "artyCounter";
        _tgt setvariable ["cooledDown",TRUE,TRUE];
        _tgt spawn {
          params ["_obj"];
          sleep 10;
          _obj setVariable ["cooledDown",nil,TRUE];
        };
        sleep 20;
        [_pos, "Sh_82mm_AMOS", 120, 10, 1] call BIS_fnc_fireSupportVirtual;
      };
      ["customArtillery", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
    },[_tgt]] call BIS_fnc_addStackedEventHandler;
  },nil,1.5, true,true, "", "_this == radioMan && artyCounter < 5 && isnil {_target getVariable 'cooledDown'} ", 5,false
];

 

  • Like 2

Share this post


Link to post
Share on other sites
4 hours ago, pierremgi said:

The next step is the use for bis_fnc_addStackedEventHandler "onMapSingleClick" instead of onMapSingleClick command:


 


this addAction ["Call the support",
  {
    openMap true;
    ["customArtillery", "onMapSingleClick", {
      params ["","_pos","",""];
      openMap false;
      [_pos] spawn {
        params ["_pos"];
        sleep 20;
        [_pos, "Sh_82mm_AMOS", 120, 10, 1] call BIS_fnc_fireSupportVirtual;
      };
      ["customArtillery", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
    }] call BIS_fnc_addStackedEventHandler;
  },nil,1.5, true,true, "", "_this == radioMan", 5,false
];

 

If you want to limit the artillery use, just add a counter.
Something like:
 


if (isServer) then {
  artyCounter = 1;
  publicVariable "artyCounter";
};

this addAction ["Call the support",
  {
    openMap true;
    ["customArtillery", "onMapSingleClick", {
      params ["","_pos","",""];
      openMap false;
      [_pos] spawn {
        params ["_pos"];
        artyCounter = artyCounter + 1;
        sleep 20;
        [_pos, "Sh_82mm_AMOS", 120, 10, 1] call BIS_fnc_fireSupportVirtual;
        publicVariable "artyCounter";
      };
      ["customArtillery", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
    }] call BIS_fnc_addStackedEventHandler;
  },nil,1.5, true,true, "", "_this == radioMan && artyCounter < 5", 5,false
];

 

Adding a "cooler", avoiding too fast repetition:


 


if (isServer) then {
  artyCounter = 1;
  publicVariable "artyCounter";
};

this addAction ["Call the support",
  {
    params ["_tgt"];
    openMap true;
    ["customArtillery", "onMapSingleClick", {
      params ["","_pos","","","_arg"];
      _arg params ["_tgt"];
      openMap false;
      [_pos,_tgt] spawn {
        params ["_pos","_tgt"];
        artyCounter = artyCounter + 1;
        publicVariable "artyCounter";
        _tgt setvariable ["cooledDown",TRUE,TRUE];
        _tgt spawn {
          params ["_obj"];
          sleep 10;
          _obj setVariable ["cooledDown",nil,TRUE];
        };
        sleep 20;
        [_pos, "Sh_82mm_AMOS", 120, 10, 1] call BIS_fnc_fireSupportVirtual;
      };
      ["customArtillery", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
    },[_tgt]] call BIS_fnc_addStackedEventHandler;
  },nil,1.5, true,true, "", "_this == radioMan && artyCounter < 5 && isnil {_target getVariable 'cooledDown'} ", 5,false
];

 

Wow! It's some kind of magic (like in a song by Queen). I thank you for your answers and great help.
How I try to do this - I'll let you know. Thank you so much!😉

Share this post


Link to post
Share on other sites

Very interesting script! - does any one have a fully working sample mission...? 🙂

Share this post


Link to post
Share on other sites
On 5/2/2021 at 9:49 AM, pierremgi said:

The next step is the use for bis_fnc_addStackedEventHandler "onMapSingleClick" instead of onMapSingleClick command:


 


this addAction ["Call the support",
  {
    openMap true;
    ["customArtillery", "onMapSingleClick", {
      params ["","_pos","",""];
      openMap false;
      [_pos] spawn {
        params ["_pos"];
        sleep 20;
        [_pos, "Sh_82mm_AMOS", 120, 10, 1] call BIS_fnc_fireSupportVirtual;
      };
      ["customArtillery", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
    }] call BIS_fnc_addStackedEventHandler;
  },nil,1.5, true,true, "", "_this == radioMan", 5,false
];

 

If you want to limit the artillery use, just add a counter.
Something like:
 


if (isServer) then {
  artyCounter = 1;
  publicVariable "artyCounter";
};

this addAction ["Call the support",
  {
    openMap true;
    ["customArtillery", "onMapSingleClick", {
      params ["","_pos","",""];
      openMap false;
      [_pos] spawn {
        params ["_pos"];
        artyCounter = artyCounter + 1;
        publicVariable "artyCounter";
        sleep 20;
        [_pos, "Sh_82mm_AMOS", 120, 10, 1] call BIS_fnc_fireSupportVirtual;
      };
      ["customArtillery", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
    }] call BIS_fnc_addStackedEventHandler;
  },nil,1.5, true,true, "", "_this == radioMan && artyCounter < 5", 5,false
];

 

Adding a "cooler", avoiding too fast repetition:


 


if (isServer) then {
  artyCounter = 1;
  publicVariable "artyCounter";
};

this addAction ["Call the support",
  {
    params ["_tgt"];
    openMap true;
    ["customArtillery", "onMapSingleClick", {
      params ["","_pos","","","_arg"];
      _arg params ["_tgt"];
      openMap false;
      [_pos,_tgt] spawn {
        params ["_pos","_tgt"];
        artyCounter = artyCounter + 1;
        publicVariable "artyCounter";
        _tgt setvariable ["cooledDown",TRUE,TRUE];
        _tgt spawn {
          params ["_obj"];
          sleep 10;
          _obj setVariable ["cooledDown",nil,TRUE];
        };
        sleep 20;
        [_pos, "Sh_82mm_AMOS", 120, 10, 1] call BIS_fnc_fireSupportVirtual;
      };
      ["customArtillery", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
    },[_tgt]] call BIS_fnc_addStackedEventHandler;
  },nil,1.5, true,true, "", "_this == radioMan && artyCounter < 5 && isnil {_target getVariable 'cooledDown'} ", 5,false
];

 


Its been a hot minute since this was posted, however I am interested in this and i am having trouble getting it to work. I'm unsure what part to put in the objects init to "Call the support" and what to put in an sqf. Can you assist with this please?

Share this post


Link to post
Share on other sites

That was answering to kurluha for adding action on an object, iot call a virtual artillery (without BI support module). So the entire code can be put into an init field of this object.

The player must be called:  radioMan It's a condition in addAction parameters you can remove.

It's a basic code, for example.

Share this post


Link to post
Share on other sites

Yeah thanks, just found out earlier. Was now trying to see what line of code I need to remove so the radioMan isn't a condition and that anyone would be able to use it. Whatever i try to remove creates an error.

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

×