Carioca 1 Posted December 25, 2022 I would like to run this script server side. that's basically what it's supposed to do. When the "a1_trig" trigger fires (a trigger placed in the editor) it randomly chooses a value between B1 and B2. then the if loop checks that b1 (or b2) is true and activates a DAC zone or other one. I don't know why but it gives me an error hint and doesn't run the script. Would anyone with a good heart know how to correct this?i'm noob i known😅 null = [] spawn { a1_trig = False; _randomWp = selectRandom [b1,b2]; while {!a1_trig} do { if (_randomWP == b1)then { [["Bravo_1"]] call BIS_fnc_advHint; sleep 1; [z_b1] call DAC_Activate;} else (if(_randomWP == b2)then { [["Bravo_2"]] call BIS_fnc_advHint; sleep 1; [z_b2] call DAC_Activate;}) }; Share this post Link to post Share on other sites
RCA3 593 Posted December 26, 2022 You have a syntax error on else ( instead of { (and double [ ])but if I understand what you're trying to achieve this might be simpler (on Trigger Activation): []spawn{ switch (round (random 1)) do{ case 1:{["Bravo_1"] call BIS_fnc_advHint; sleep 1; [z_b1] call DAC_Activate}; case 2:{["Bravo_2"] call BIS_fnc_advHint; sleep 1; [z_b2] call DAC_Activate}; default{}; }; }; 1 Share this post Link to post Share on other sites
Carioca 1 Posted December 26, 2022 6 hours ago, RCA3 said: You have a syntax error on else ( instead of { (and double [ ])but if I understand what you're trying to achieve this might be simpler (on Trigger Activation): []spawn{ switch (round (random 1)) do{ case 1:{["Bravo_1"] call BIS_fnc_advHint; sleep 1; [z_b1] call DAC_Activate}; case 2:{["Bravo_2"] call BIS_fnc_advHint; sleep 1; [z_b2] call DAC_Activate}; default{}; }; }; i seem to work in the office "complications simple things". thank you 1 Share this post Link to post Share on other sites
Carioca 1 Posted December 26, 2022 ...Oook ...seems that it choose only the case 1. Is there a way to randomize hardly this thing? Share this post Link to post Share on other sites
_foley 192 Posted December 26, 2022 Just an off-by-one error 🙂 This version will have 50% probability of choosing either option. []spawn{ switch (floor (random 2)) do{ case 0:{["Bravo_1"] call BIS_fnc_advHint; sleep 1; [z_b1] call DAC_Activate}; case 1:{["Bravo_2"] call BIS_fnc_advHint; sleep 1; [z_b2] call DAC_Activate}; default{}; }; }; 1 Share this post Link to post Share on other sites
RCA3 593 Posted December 26, 2022 9 hours ago, _foley said: Just an off-by-one error 🙂 Oh, thanks. I should've have gone with case 0, case 1. That would've worked too. Share this post Link to post Share on other sites
Carioca 1 Posted December 26, 2022 thus... if i would like to assign 33% i have to code : Quote []spawn{ switch (floor (random 3)) do{ case 0:{["Bravo_1"] call BIS_fnc_advHint; sleep 1; [z_b1] call DAC_Activate}; case 1:{["Bravo_2"] call BIS_fnc_advHint; sleep 1; [z_b2] call DAC_Activate}; case 2:{["Bravo_2"] call BIS_fnc_advHint; sleep 1; [z_b2] call DAC_Activate}; default{}; }; }; am i right? Share this post Link to post Share on other sites