Theassassinzz 7 Posted March 29, 2017 (edited) Hi all, so I am writing a script to randomly spawn 50 Quad-bikes across the map. So far I have gotten them to spawn randomly but I can't get it to stop after 50 have spawned, It will keep running infinitely, Vehiclespawn.sqf while {true} do { _vehNear = getMarkerPos "center" nearObjects ["B_Quadbike_01_F", 20000]; _vehCount = count _vehNear; // searches whole map _sheds = getMarkerPos "center" nearObjects ["Land_Metal_Shed_F",20000]; _shed = _sheds select 0; _position = _shed buildingPos 1; if (_vehCount < 50) then { { _shed = _X; for "_n" do { _position = _shed buildingPos _n; if (str _position != "[0,0,0]") then { if (50 > random 442) then { _positionSafe = _position findEmptyPosition [0,5,"B_Quadbike_01_F"]; _quad = "B_Quadbike_01_F" createVehicle _positionSafe; }; }; }; sleep 0.5; }forEach _sheds; } }; I call for that through the init wit []execVM "Vehiclespawn.sqf"; Thanks ahead for the help! Edited March 30, 2017 by Theassassinzz Added findEmptyPosition to stop vehicles from blowing up on spawn Share this post Link to post Share on other sites
Theassassinzz 7 Posted March 30, 2017 I tried adding . . . . }; sleep 300; exitWith {hint format ["%1 Vehicles Spawned",_vehCount];} But no matter what I do with the semi-colons I always get an error saying I'm missing a ; Share this post Link to post Share on other sites
Theassassinzz 7 Posted March 30, 2017 Solved it myself haha 1 1 Share this post Link to post Share on other sites
Sld. Alexx Alvarez 0 Posted August 29, 2020 Which was the problem? I'm interesting of this script Share this post Link to post Share on other sites
Joe98 92 Posted August 30, 2020 On 8/29/2020 at 11:22 PM, Sld. Alexx Alvarez said: Which was the problem? I'm interesting of this script The other way to do this, is to place 50 bikes on the map. Place them along a road in an out of the way place. Then, when a trigger fires, one bike is moved to a random position - bike01 setpos getpos stone1 - and ensure the stone starts at a place at random. Do this with 50 triggers, 50 bikes and 50 stones. . Share this post Link to post Share on other sites
Sld. Alexx Alvarez 0 Posted September 5, 2020 On 8/31/2020 at 1:42 AM, Joe98 said: The other way to do this, is to place 50 bikes on the map. Place them along a road in an out of the way place. Then, when a trigger fires, one bike is moved to a random position - bike01 setpos getpos stone1 - and ensure the stone starts at a place at random. Do this with 50 triggers, 50 bikes and 50 stones. . Thanks You!! Share this post Link to post Share on other sites