Jump to content

Recommended Posts

What does this script do?

This script creates a minefield with a random number of mines and IED, positioning them in a random way inside the given area.

Does not include APERSTripMine (mines with cable)

 

Does it work in multiplayer?

Yes, it works in MultiPlayer and SinglePlayer

 

Parameters

_area → Marker → Set a marker area with the size you like in editor

_minMinesCount → int → Minimum number of mines you want in the area

_maxMinesCount → int → Maximum number of mines you want in the area

 

How do I call the script?

Just get into your init.sqf and place it like this, has to be server only.

If you have multiple minefields you have to add multiple lines with each marker and number of mines.

if (isServer) { ["MarkerName", 10, 30] execVM "randomMinefield.sqf"; };

 

Next improvements

- Will use marker position and specified range manually instead of marker size which is not very handy.

 

randomMinefield.sqf

//Uncomment following if used as function
//params["_area", "_minMinesCount", "_maxMinesCount"];
//Uncomment following if used as script
_area = _this select 0;
_minMinesCount = _this select 1; 
_maxMinesCount = _this select 2;

_minesArray = ["ATMine","APERSBoundingMine","APERSMine","IEDLandBig_F","IEDUrbanBig_F","IEDUrbanSmall_F","IEDLandSmall_F"];
_minesCountInArea = random[_minMinesCount, _maxMinesCount/2, _maxMinesCount];
_areaDimensions = getMarkerSize _area;
_minesPositionRange = _areaDimensions select 0;
_counter = 0;
while { _counter < _minesCountInArea } do
{
  _randomPosition = [[[getMarkerPos [_area, true], _minesPositionRange]],[]] call BIS_fnc_randomPos;
  createMine[selectRandom _minesArray, _randomPosition, [], 0];
  _counter = _counter + 1;
};

 

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

×