hectrol 4 Posted April 15 Hello dear comrades, I was wondering if there is a scripted draw method similar to the one I propose, BUT that does not repeat the options. //nul = [] execVM "loops\Sorteo_Civilian_Namuvaka_1.sqf"; systemchat "Hostage placed"; _script = (floor random 9) + 1; switch (_script) do { case 1 : { leader CIV_REHEN_NAMUVAKA_1 setPos getPos Pos_Reh_Namuvaka_1; }; case 2 : { leader CIV_REHEN_NAMUVAKA_1 setPos getPos Pos_Reh_Namuvaka_2; }; case 3 : { leader CIV_REHEN_NAMUVAKA_1 setPos getPos Pos_Reh_Namuvaka_3; }; case 4 : { leader CIV_REHEN_NAMUVAKA_1 setPos getPos Pos_Reh_Namuvaka_4; }; case 5 : { leader CIV_REHEN_NAMUVAKA_1 setPos getPos Pos_Reh_Namuvaka_5; }; case 6 : { leader CIV_REHEN_NAMUVAKA_1 setPos getPos Pos_Reh_Namuvaka_6; }; case 7 : { leader CIV_REHEN_NAMUVAKA_1 setPos getPos Pos_Reh_Namuvaka_7; }; case 8 : { leader CIV_REHEN_NAMUVAKA_1 setPos getPos Pos_Reh_Namuvaka_8; }; case 9 : { leader CIV_REHEN_NAMUVAKA_1 setPos getPos Pos_Reh_Namuvaka_9; }; }; although it would be to choose between scripts like.. nul = [] execVM "missions\Mission_1.sqf"; nul = [] execVM "missions\Mission_2.sqf"; nul = [] execVM "missions\Mission_3.sqf"; etc Share this post Link to post Share on other sites
Schatten 286 Posted April 15 I didn't quite understand what you want, but this is simplified version of your code: _varName = format ["Pos_Reh_Namuvaka_%1", (floor (random 9)) + 1]; (leader CIV_REHEN_NAMUVAKA_1) setPos (getPos (missionNamespace getVariable _varName)); Share this post Link to post Share on other sites
soldierXXXX 107 Posted April 15 Hi, if i understand correctly, you want to have randomized mission selection that won't repeat when the script is executed again correct ? There is multiple solutions to this. Depends how you wish the script to behave. I prepared two scripts. The first one will randomize the missions and then proceed them in order they have been randomized. //random unique, with fixed order (order is given by randomizing initial array and then the script proceed the array in this order - meaning, you know which mission is selected next) private _availableMissions = missionNamespace getVariable ["soldierXXXX_Available_Missions",(["Mission_1","Mission_2","Mission_3","Mission_4","Mission_5","Mission_6"] call BIS_fnc_arrayShuffle)]; if (_availableMissions isEqualTo []) exitWith {systemChat "No other missions available";}; private _selectedMission = _availableMissions select 0; _availableMissions deleteAt 0; missionNamespace setVariable ["soldierXXXX_Available_Missions",_availableMissions]; systemChat ("Selected mission: " + _selectedMission); systemChat ("Path of the selected mission: " + ("missions\" + _selectedMission + ".sqf")); systemChat ("Remaining missions: " + str _availableMissions); //execVM ("missions\" + _selectedMission + ".sqf"); The second one will always select random mission no matter what, so you don't know what's next. //completely randomized and unique (no one knows what's next) private _availableMissions = missionNamespace getVariable ["soldierXXXX_Available_Missions",["Mission_1","Mission_2","Mission_3","Mission_4","Mission_5","Mission_6"]]; if (_availableMissions isEqualTo []) exitWith {systemChat "No other missions available";}; private _selectedMission = selectRandom _availableMissions; private _index = _availableMissions find _selectedMission; _availableMissions deleteAt _index; missionNamespace setVariable ["soldierXXXX_Available_Missions",_availableMissions]; systemChat ("Selected mission: " + _selectedMission); systemChat ("Path of the selected mission: " + ("missions\" + _selectedMission + ".sqf")); systemChat ("Remaining missions: " + str _availableMissions); //execVM ("missions\" + _selectedMission + ".sqf"); I hope this will help you 🙂. Share this post Link to post Share on other sites
Larrow 2820 Posted April 16 20 hours ago, soldierXXXX said: private _selectedMission = selectRandom _availableMissions; private _index = _availableMissions find _selectedMission; _availableMissions deleteAt _index; Is just... private _selectedMission = _availableMissions deleteAt floor( random count _availableMissions ); Share this post Link to post Share on other sites
mrcurry 496 Posted April 16 1 hour ago, Larrow said: private _selectedMission = _availableMissions deleteAt floor( random count _availableMissions ); How to turn any array into a shuffled deck in 1 line. Nice. The brackets shouldn't even be necessary since floor random and count are all unary commands. Share this post Link to post Share on other sites
soldierXXXX 107 Posted April 16 @Larrow Sure, could be also done like that. Nice solution. Share this post Link to post Share on other sites
hectrol 4 Posted April 17 @Larrow @mrcurry @soldierXXXX @Schatten Thank you very much for your effort and for your knowledge. At the moment I have two missions, soon there will be more:Mission_Namuvaka.sqf GSM_Mission.sqf Can you help me organize it please? For you they are known concepts but for me they are new, thank you all very much. The scenario: Hectrol Series ARMA 3 & 4 Scenarios : https://www.facebook.com/61558391754366/ WAR Series - ARMA 3 & 4 Scenarios : https://www.facebook.com/61557058640716/ Stealth Mode On Series: https://www.facebook.com/61556099381253/ Assault Series: https://www.facebook.com/61558606737053/ Share this post Link to post Share on other sites