Robustcolor 30 Posted October 19, 2019 Hi, i'm using this code at the moment to try to get a 50% chance of activating the fnc when a player is near a specific marker. Problem is, it seems to always activate the fnc. How can i improve this code? private _ambush = (0 + round (random 1)); for "_x" from 0 to _ambush do { Just a ai spawn script here. }; Share this post Link to post Share on other sites
Mr H. 400 Posted October 19, 2019 private _seed = [1,101] call BIS_fnc_randomInt; if (_seed >50) exitWith {false}; // rest of your code here 1 Share this post Link to post Share on other sites
Robustcolor 30 Posted October 20, 2019 Thanks @Mr H. Share this post Link to post Share on other sites
pierremgi 4739 Posted October 20, 2019 if (selectRandom [TRUE,FALSE]) then {<spawn function here>}; 2 Share this post Link to post Share on other sites
killzone_kid 1326 Posted October 21, 2019 On 10/19/2019 at 8:17 PM, Robustcolor said: Problem is, it seems to always activate the fnc. How can i improve this code? The problem is your loop, it will always run, 50% it will run 1 time and 50% it will run 2 times. Make `from` 1 instead of 0 Share this post Link to post Share on other sites