Jump to content

HELP: Scripting a motorised mortar section for a multiplayer mission..

Recommended Posts

Hello! I have been attempting to create 3 scripts with 5 main functions in MP editor. I am brand new to scripting (only 3-4 days), and have gotten very close to my goal. However, I am at my last legs for the near future. I need help chiefly with getting the positional coordinates from the map click into a marker used by a mortar section for a fire mission and/or relocation.


Initially using the action menu: 

Set Fire Mission                        -Uses mouse on map to set a marker labelled "Fire Mission".

Relocate Mortar Section         -Uses mouse on map to set a marker labelled "New Position"

Unpack/Pack Mortars              -Uses if, then, else to minimise action menu options

Commence Fire Mission          -Uses Fire mission marker. Initially limited to 2 round salvos but as I learned more and went on i intend to make a menu with different sheafs, etc.


Script 1:

Function 1:

Use the map to create a marker labelled "Fire Mission" with hints. To be used for the fire mission.


Script 2:

Function 2:

Fire on the position.


Script 3:

Function 3:

Mortar section gets in a Stryker, travels to a selected point "Relocation" on the map.

Function 4:

Unpacks their mortars and is ready for tasking

Function 5:

Packs mortars and awaits a relocation tasking.


So far I have achieved function 2. 3 I can get partially there with a moving marker on the Stryker and scripted orders to mount up. 4 and 5 I have not properly attempted yet due to function 1's stone wall.

I don't know much so any help would be appreciated.


My scripts so far: 



Function 1: 

createfiremission.sqf: (Shortended version)

openmap true,
  hint "Mark Fire Mission";

  _pos = []

  _firemissionlocation = _pos // as far as i figured this cleared previous marks
  addMissionEventHandler ["MapSingleClick", {params ["_units", "_pos", "_alt", "_shift"]}];  //don't really know what this is doing tbh, I figured it was grabbing the data and If I used "_result = _array select 1;" it would select the positional data.

  _firemissionlocation = "createMarker [firemissionlocation, _pos]"; //where things appear to go wrong. No matter what combination I can not get this to work. I did at one point momentarily have it working (no errors) but the marker would not appear.

  _firemissionlocation setMarkerType "hd_destroy";
  _firemissionlocation setMarkerText "Fire Mission";



Function 2:

I can't find my scripting for this at the moment.



Function 3:

player addAction ["Mortar Reposition", {                 //contains my initial attempt at getting marker pos

    params ["","_pos","",""];

    openmap [true,false];

    ["click", "onMapSingleClick", {

    titleText["Select Map Position", "PLAIN"];

   _wp1 = badger addWaypoint [_pos [getmarkerPos mother_1],0];

   _wp1 setWaypointType "getin";

   deleteMarker "customObjective";

   _mk = createMarker ["customObjective",_pos];

   _mk setMarkerText "Go here";

   _mk setMarkertype "hd_objective";

   openmap [false,false];

  onMapSingleClick "";


  }] call BIS_fnc_addStackedEventHandler;




Function 4:                

private _wp1 = _group addWaypoint [_pos getmarkerPos "MortarPit", 10];             //Not at all mine but I was to attempt to adapt it once i figured out the markers.

_wp1 setWaypointType "MOVE";

_wp1 setWaypointStatements ["true", "

            group this allowFleeing 0;

            [group this, 'StaticWeaponUnpacked', {

                        _this spawn


                                    sleep 7;

                                    [_this select 0] call BIS_fnc_packStaticWeapon;


            }] call BIS_fnc_addScriptedEventHandler;




                        this getPos [1000, random 360],

                        this getPos [10, 0]

            ] call BIS_fnc_unpackStaticWeapon;



Funtion 5:

Nothing done yet.

Edited by cli0003_geoff
Edited for easier reading.

Share this post

Link to post
Share on other sites

I left out I had set up an init.sqf file with simply:


Player_1 (through 4) addaction................ (all four actions)


and a few objects setup with vehicle spawning lines:

eg: heli_spawner_1 addAction ["Spawn AH64 Sim", {createVehicle ["BSNAG_AH64D_Sim", (getMarkerPos "heli_spawn_1"), [], 0, "NONE"];}];

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