Easelm 10 Posted May 12, 2011 Well, I had this working before, but I was waiting on my best bud to get back from his 2 day work at an Air Force Base, but it seems I have forgotten what I did to make the units spawn continuously. Here is the grp1: grp1 = [getPos hpad1, EAST, 3] call BIS_fnc_spawnGroup; Here is what I had: // Respawns units for "_k" from 0 to ((count units grp1)-1) do { sleep 2; }; Help would be greatly appreciated. Share this post Link to post Share on other sites
rexehuk 16 Posted May 12, 2011 while {myVariable} do { spawncode waitUntil all spawns are dead } Is how I would do it :) Share this post Link to post Share on other sites
Easelm 10 Posted May 12, 2011 rexehuk said: while {myVariable} do{ spawncode waitUntil all spawns are dead } Is how I would do it :) Hmm, didn't work; unless I did something wrong. Could you put more specific detail in that, please? Share this post Link to post Share on other sites
sxp2high 23 Posted May 14, 2011 (edited) Hi there... what rexehuk suggested is this: SpawnEnemies = true; [color="SeaGreen"]// start spawning[/color] while {SpawnEnemies} do { _Grp = [getPos hpad1, EAST, 3] call BIS_fnc_spawnGroup; sleep 30 + (random 30); [color="SeaGreen"]// sleep 30 - 60 sec before next group[/color] }; SpawnEnemies = false; [color="SeaGreen"]// stop/pause spawning [/color] SpawnEnemies = true; [color="SeaGreen"]// continue spawning[/color] Oh sorry now i get what you're trying to accomplish... SpawnEnemies = true; [color="SeaGreen"]// start spawning[/color] while {SpawnEnemies} do { _Grp = [getPos hpad1, EAST, 3] call BIS_fnc_spawnGroup; waitUntil {{alive _x} count (units _Grp) == 0};[color="SeaGreen"] // wait until all units dead and spawn next group[/color] }; Edited May 14, 2011 by sxp2high Share this post Link to post Share on other sites
Easelm 10 Posted May 14, 2011 Thanks buddy. I actually got it working, but I'm going to try your method. ---------- Post added at 01:02 AM ---------- Previous post was at 12:31 AM ---------- Hey, everything works, thanks for that, but it isn't calling "Bombers.sqf" when the enemies hit the trigger. Bombers.sqf contains: _bomb = "Bo_GBU12_LGB" createVehicle getPos leader _Grp; _bomb1 = "Bo_GBU12_LGB" createVehicle getPos leader _Grp1; _bomb2 = "Bo_GBU12_LGB" createVehicle getPos leader _Grp2; _bomb3 = "Bo_GBU12_LGB" createVehicle getPos leader _Grp3; _bomb4 = "Bo_GBU12_LGB" createVehicle getPos leader _Grp4; SpawnEnemies.sqf contains: //grp1 = [getPos hpad5, EAST, 3] call BIS_fnc_spawnGroup; SpawnEnemies = true; // start spawning while {SpawnEnemies} do { _Grp = [getPos hpad1, EAST, 2] call BIS_fnc_spawnGroup; _Grp1 = [getPos hpad2, EAST, 2] call BIS_fnc_spawnGroup; _Grp2 = [getPos hpad3, EAST, 2] call BIS_fnc_spawnGroup; _Grp3 = [getPos hpad4, EAST, 2] call BIS_fnc_spawnGroup; _Grp4 = [getPos hpad5, EAST, 2] call BIS_fnc_spawnGroup; _wp = _Grp addWaypoint [getPos hpad6, 10]; _wp1 = _Grp1 addWaypoint [getPos hpad6, 10]; _wp2 = _Grp2 addWaypoint [getPos hpad6, 10]; _wp3 = _Grp3 addWaypoint [getPos hpad6, 10]; _wp4 = _Grp4 addWaypoint [getPos hpad6, 10]; sleep 10 + (random 10); // sleep 30 - 60 sec before next group }; When I put a test "Bomber" code in the loop, it will make them explode, but it doesn't work outside of the loop for some reason. Share this post Link to post Share on other sites
sxp2high 23 Posted May 14, 2011 It's because the "_Grp" variable is local (it has the _ in front of it) that means the _Grp variable is only usable inside the SpawnEnemies.sqf. So... just try deleting the _'s in front of the Grp's. This makes them global variables and they are usable by other scripts as well. For example: Turn _Grp2 into Grp2. Share this post Link to post Share on other sites
Easelm 10 Posted May 14, 2011 Oh yeah, that was mentioned before, thanks. Share this post Link to post Share on other sites
bigshotking 11 Posted May 14, 2011 Hello all! I was wondering if this is the correct way of making this script work for a mission I'm making: SpawnEnemies.sqf SpawnEnemies = true; // start spawning while {SpawnEnemies} do { _Grp = [getPos hpad1, EAST, 3] call BIS_fnc_spawnGroup; waitUntil {{alive _x} count (units _Grp) == 0}; // wait until all units dead and spawn next group }; Making it Start or Stop using this in a trigger on ACT. SpawnEnemies = false; // stop/pause spawning SpawnEnemies = true; // continue spawning I understand most of this script but there are a few things im confused about: _Grp = [getPos hpad1, EAST, 3] call BIS_fnc_spawnGroup; The above line is broken down into this if im not mistaken! getpos hpad1 <--- This is the marker where the group spawns EAST <--- This is the SIDE of group that is spawned 3 <----- What does this value mean? Is it the type of group? Because I wan to use this script to spawn Takistani Militia, i suppose there is a numberfor that! Thanks in advance for any input that is given! -Bigshot Share this post Link to post Share on other sites
Lucky44 13 Posted May 14, 2011 If you look up BIS_fnc_SpawnGroup in the BIS wiki, you'll find this entry. The number 3 in that example (above) is the number of units that will be (randomly) spawned. Share this post Link to post Share on other sites