pappagoat 6 Posted December 30, 2018 I'm looking for help. I am trying to create random date BUT with only certain months depending on which year is selected. So far I cannot get the last part to work: Basic Random Date (WORKS): _year = selectrandom [1970]; _month = selectrandom [01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12]; _day = selectrandom [01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]; setDate [_year, _month, _day, 15, 45]; Attempting month range depending on year (struggling): _year = selectrandom [1967, 1968]; if (_year == 1967) then {_month = selectrandom [04, 05, 06, 07, 08, 09, 10, 11, 12];}; if (_year == 1968) then {_month = selectrandom [01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12];}; _day = selectrandom [01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]; setDate [_year, _month, _day, 15, 45]; Any ideas? Share this post Link to post Share on other sites
Lucullus 71 Posted December 31, 2018 private your variable _month first. Share this post Link to post Share on other sites
M1ke_SK 230 Posted December 31, 2018 _year = selectrandom [1967, 1968]; _month = selectRandom ( if (_year == 1967) then { [04, 05, 06, 07, 08, 09, 10, 11, 12] } else { [01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12] } ); _day = selectrandom [01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]; setDate [_year, _month, _day, 15, 45]; 1 Share this post Link to post Share on other sites
pappagoat 6 Posted January 2, 2019 On 12/31/2018 at 9:36 AM, M1ke_SK said: _year = selectrandom [1967, 1968]; _month = selectRandom ( if (_year == 1967) then { [04, 05, 06, 07, 08, 09, 10, 11, 12] } else { [01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12] } ); _day = selectrandom [01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]; setDate [_year, _month, _day, 15, 45]; Works perfectly, thank you! Share this post Link to post Share on other sites
Schatten 289 Posted January 2, 2019 @pappagoat, _year = selectRandom [1967, 1968]; _months = if (_year == 1967) then {[4, 12]} else {[1, 12]}; setDate [ _year, _months call BIS_fnc_randomInt, [1, 28] call BIS_fnc_randomInt, 15, 45 ]; 1 Share this post Link to post Share on other sites
pappagoat 6 Posted January 2, 2019 I've used month selection for a couple things but having errors with this, not sure why: if (_month == [04, 05, 06, 07, 08, 09]) then {{deletevehicle _x} forEach (crew slick4)+[slick4];}; Share this post Link to post Share on other sites
Schatten 289 Posted January 2, 2019 @pappagoat, you can't use equality operator to check if value is in array. You can use in command. Share this post Link to post Share on other sites
johnnyboy 3797 Posted January 2, 2019 34 minutes ago, pappagoat said: if (_month == [04, 05, 06, 07, 08, 09]) then {{deletevehicle _x} forEach (crew slick4)+[slick4];}; change "==" to "in". if (_month in [04, 05, 06, 07, 08, 09]) then {{deletevehicle _x} forEach (crew slick4)+[slick4];}; 1 Share this post Link to post Share on other sites