Mokey II 5 Posted May 16, 2018 Hi all! So I'm trying to do a 'floor random [x,y,z];` for a mission I'm working on. However I can't seem to get it to work properly and return a whole number or any number at that. The portion I'm having an issue with. There's no documentation for selecting through a nested array with `random` that I can see. I need it to be random rather than selectRandom because I want the players to have a median rather than an extremely random number. I'm trying to call the money values. _moneyAmount = floor (random _moneyShipment [select 1, select 2, select 3]); I have also tried: _moneyAmount = floor (random [select 1, _moneyShipment select 2, _moneyShipment select 3]); and various other face smashing ways :) Can any1 assist me with this? The code: Spoiler _setupVars = { _MoneyShipment = selectRandom [ [ "Small Smuggler Shipment", 60000, 80000, 100000, // Money //2, //crates [ [ // NATO convoy ["B_MRAP_01_hmg_F", "B_MRAP_01_gmg_F", "O_T_LSV_02_armed_F"], ["B_MRAP_01_hmg_F", "B_MRAP_01_gmg_F", "O_T_LSV_02_armed_F"] ], [ // CSAT convoy ["O_MRAP_02_hmg_F", "O_MRAP_02_gmg_F", "B_T_LSV_01_armed_F"], ["O_MRAP_02_hmg_F", "O_MRAP_02_gmg_F", "B_T_LSV_01_armed_F"] ], [ // AAF convoy ["I_MRAP_03_hmg_F", "I_MRAP_03_gmg_F", "I_LT_01_cannon_F"], ["I_MRAP_03_hmg_F", "I_MRAP_03_gmg_F", "I_LT_01_AT_F"] ] ] ], [ "Medium Smuggler Shipment", 100000, 120000, 140000, // Money //3, //crates [ [ // NATO convoy ["B_MRAP_01_hmg_F", "B_MRAP_01_gmg_F"], ["B_APC_Wheeled_01_cannon_F", "B_APC_Tracked_01_rcws_F", "B_APC_Tracked_01_AA_F"], ["B_MRAP_01_hmg_F", "B_MRAP_01_gmg_F"] ], [ // CSAT convoy ["O_MRAP_02_hmg_F", "O_MRAP_02_gmg_F"], ["O_APC_Wheeled_02_rcws_v2_F", "O_APC_Tracked_02_cannon_F", "O_APC_Tracked_02_AA_F"], ["O_MRAP_02_hmg_F", "O_MRAP_02_gmg_F"] ], [ // AAF convoy ["I_MRAP_03_hmg_F", "I_MRAP_03_gmg_F", "I_LT_01_cannon_F"], ["I_APC_Wheeled_03_cannon_F", "I_APC_tracked_03_cannon_F"], ["I_MRAP_03_hmg_F", "I_MRAP_03_gmg_F", "I_LT_01_AT_F"] ] ] ], [ "Large Smuggler Shipment", 140000, 160000, 180000, // Money [ [ // NATO convoy ["B_APC_Wheeled_01_cannon_F", "B_APC_Tracked_01_rcws_F", "B_APC_Tracked_01_AA_F", "B_AFV_Wheeled_01_up_cannon_F"], ["B_MBT_01_cannon_F", "B_MBT_01_TUSK_F"], // Veh 2 ["B_APC_Wheeled_01_cannon_F", "B_APC_Tracked_01_rcws_F", "B_APC_Tracked_01_AA_F"] ], [ // CSAT convoy ["O_APC_Wheeled_02_rcws_v2_F", "O_APC_Tracked_02_cannon_F", "O_APC_Tracked_02_AA_F"], ["O_MBT_02_cannon_F", "O_MBT_04_cannon_F"], // Veh 2 ["O_APC_Wheeled_02_rcws_v2_F", "O_APC_Tracked_02_cannon_F", "O_APC_Tracked_02_AA_F"] ], [ // AAF convoy ["I_APC_Wheeled_03_cannon_F", "I_APC_tracked_03_cannon_F"], ["I_MBT_03_cannon_F"], // Veh 2 ["I_APC_Wheeled_03_cannon_F", "I_APC_tracked_03_cannon_F"] ] ] ], // Extreme [ "Heavy Smugglers Shipment", 180000, 200000, 220000,// Money [ [ // NATO convoy ["B_APC_Wheeled_01_cannon_F", "B_APC_Tracked_01_rcws_F", "B_APC_Tracked_01_AA_F", "B_MBT_01_cannon_F", "B_MBT_01_TUSK_F"], // Veh 1 ["B_APC_Tracked_01_AA_F", "B_MBT_01_cannon_F", "B_MBT_01_TUSK_F"], // Veh 2 ["B_APC_Wheeled_01_cannon_F", "B_APC_Tracked_01_rcws_F", "B_APC_Tracked_01_AA_F", "B_MBT_01_cannon_F", "B_MBT_01_TUSK_F"], // Veh 3 ["B_APC_Wheeled_01_cannon_F", "B_APC_Tracked_01_rcws_F", "B_APC_Tracked_01_AA_F", "B_MBT_01_cannon_F", "B_MBT_01_TUSK_F"] // Veh 4 ], [ // CSAT convoy ["O_APC_Wheeled_02_rcws_v2_F", "O_APC_Tracked_02_cannon_F", "O_APC_Tracked_02_AA_F", "O_MBT_02_cannon_F"], // Veh 1 ["O_APC_Tracked_02_AA_F", "O_MBT_02_cannon_F", "O_MBT_04_command_F"], // Veh 2 ["O_APC_Wheeled_02_rcws_v2_F", "O_APC_Tracked_02_cannon_F", "O_APC_Tracked_02_AA_F", "O_MBT_02_cannon_F"], // Veh 3 ["O_APC_Wheeled_02_rcws_v2_F", "O_APC_Tracked_02_cannon_F", "O_APC_Tracked_02_AA_F", "O_MBT_02_cannon_F"] // Veh 4 ], [ // AAF convoy ["I_APC_Wheeled_03_cannon_F", "I_APC_tracked_03_cannon_F", "I_MBT_03_cannon_F"], // Veh 1 ["I_APC_tracked_03_cannon_F", "I_MBT_03_cannon_F"], // Veh 2 ["I_APC_Wheeled_03_cannon_F", "I_APC_tracked_03_cannon_F", "I_MBT_03_cannon_F"], // Veh 3 ["I_APC_Wheeled_03_cannon_F", "I_APC_tracked_03_cannon_F", "I_MBT_03_cannon_F"] // Veh 4 ] ] ] ]; _missionType = _MoneyShipment select 0; _moneyAmount = floor (random _moneyShipment [select 1, select 2, select 3]); _convoys = _MoneyShipment select 4; _vehChoices = selectRandom _convoys; _moneyText = format ["$%1", [_moneyAmount] call fn_numbersText]; }; _missionMoneyTotal = _moneyAmount; UPDATE: I was able to get _moneyAmount to return within the scope. but cannot outside of the scope. Share this post Link to post Share on other sites
gokitty1199 225 Posted May 16, 2018 howabow dis? _moneyAmount = floor random [_moneyShipment select 1, _moneyShipment select 2, _moneyShipment select 3]; Share this post Link to post Share on other sites
Mokey II 5 Posted May 16, 2018 @GOKITTY199 It was actually working. Now if I can get the variable to pass outside of the function Share this post Link to post Share on other sites
gokitty1199 225 Posted May 16, 2018 15 minutes ago, Mokey II said: @GOKITTY199 It was actually working. Now if I can get the variable to pass outside of the function have you thought about having a global function inside the same script and having it return the value that _moneyAmount holds? that way you should just be able to call the function and use its return value whenever you need it Share this post Link to post Share on other sites
Mokey II 5 Posted May 17, 2018 @gokitty1199 Yes, but I can't seem to get it past the function's scope. Share this post Link to post Share on other sites
Mokey II 5 Posted May 17, 2018 Got it _missionParseSetupVars = call _setupVars; 1 Share this post Link to post Share on other sites