ducdragger99 0 Posted March 8, 2022 Hi all, I'm not new to ARMA, but I am new to scripting. I was wanting to do the following: Create an area or "training range" for my players to practice mine defusal. I would like mines to spawn in on placed empty markers (named XYZ) when you select "restart" from a menu placed on a sign. I am using RHS mines as well as ACE. Is this at all possible? example: Private dummy wants to learn EOD. Private dummy goes to the training range. Private dummy selects "restart" at the range sign Mines are placed on the training range Private dummy practices defusal. If private dummy blows himself up, he can respawn, return to the range and pick up where he left off, or select "restart" and the range will be cleared and new mines will spawn in. Any help would be appreciated. Share this post Link to post Share on other sites
7erra 629 Posted March 8, 2022 For the restart action you can use an addAction or the more modern BIS_fnc_holdActionAdd. Inside of that you can run code to create any missing mines. We just need a way to track which mines exploded and which do not need replacement. Instead of using markers you could also use invisible locations as you can use setVariable on them. place all of them in a separate eden layer named "trainingMineLocations". Now for the addAction code: { private _mine = _x getVariable ["mine", objNull]; if (!isNull _mine) then { continue; }; // No mine at location, create a new one private _mine = createMine ["classnameofmine", getPos _x, [], 0]; _x setVariable ["mine", _mine]; } forEach (getMissionLayerEntities "trainingMineLocations" select 0); Untested, not sure if ace mines are different. Share this post Link to post Share on other sites
ducdragger99 0 Posted March 10, 2022 I'm attempting to make this addAction "reset" run a script that will place the mines in a predetermined area. So far I have the folowing: Object placed and in the init: this addAction ["reset", ["eodtrainingsrange1.sqf"]]; In eodtrainingrange1.sqf: _mineArray = [ "rhs_mine_a200_bz", "rhs_mine_a200_dz35", "rhs_mine_glasmine43_bz", "rhs_mine_glasmine43_hz", "rhs_mine_m2a3b_trip", "rhs_mine_m2a3b_press", "rhs_mine_M3_tripwire", "rhs_mine_M3_pressure", "rhs_mine_M7A2", "rhs_mine_Mk2_tripwire", "rhs_mine_Mk2_pressure", "rhs_mine_smine35_trip", "rhs_mine_smine35_press", "rhs_mine_smine44_trip", "rhs_mine_smine44_press", "rhs_mine_stockmine43_2m", "rhs_mine_stockmine43_4m", "rhs_mine_TM43", ]; _minemunition = [ "rhs_mine_a200_bz_mag" "rhs_mine_a200_dz35_mag" "rhs_mine_glasmine43_bz_mag" "rhs_mine_glasmine43_hz_mag" "rhs_mine_m2a3b_trip_mag" "rhs_mine_m2a3b_press_mag" "rhs_mine_M3_tripwire_mag" "rhs_mine_M3_pressure_mag" "rhs_mine_M7A2_mag" "rhs_mine_Mk2_tripwire_mag" "rhs_mine_Mk2_pressure_mag" "rhs_mine_smine35_trip_mag" "rhs_mine_smine35_press_mag" "rhs_mine_smine44_trip_mag" "rhs_mine_smine44_press_mag" "rhs_mine_stockmine43_2m_mag" "rhs_mine_stockmine43_4m_mag" "rhs_mine_TM43_mag" ]; _areaArray = ["trngmine1_1","trngmine1_2","trngmine1_3","trngmine1_4","trngmine1_5","trngmine1_6"] _minMinesCount = _this select 1; _maxMinesCount = _this select 2; _minesCountInArea = [_minMinesCount, _maxMinesCount/2, _maxMinesCount]; _counter = 0; while {_counter < _minesCountInArea } do { for each _minePosition = [gerMarkerPos [_areaArray, true]; createMine [selectRandom _mineArray, _minePosition, [], 0]; _counter = _counter + 1; }; I must be missing a step somewhere, and I apologize in advance, i'm new to scripting. I receive an error of: ERROR TYPE EXPECTED STRING, CODE Share this post Link to post Share on other sites
7erra 629 Posted March 10, 2022 Read the addAction page on the BIKI carefully, you can't use an array (["eodtrainingsrange1.sqf"]) as second parameter. while {_counter < _minesCountInArea } do { for each _minePosition = [gerMarkerPos [_areaArray, true]; this is wrong, for each is not a command/structure, getMarkerPos has a typo and also does not take an array as right hand argument but a string. Have you read the Introduction to arma scripting on the BIKI yet? _this would also contain the arguments from the addAction in the _this variable and not the counts you apparently want Share this post Link to post Share on other sites
pierremgi 4890 Posted March 11, 2022 and _minesCountInArea = [_minMinesCount, _maxMinesCount/2, _maxMinesCount]; is an array not a number. Try selectRandomWeighted instead Share this post Link to post Share on other sites
ducdragger99 0 Posted March 11, 2022 pierremgi, thanks, but i'm admitting defeat as I think i'm in way over my head, Time to give up and start smaller. Share this post Link to post Share on other sites