dematti 10 Posted June 15, 2010 (edited) Hi, I reached the group limit in my mission. So let me explain this: ingame you can see the groups callsigns going from 1-1-A,.... (I am going to refer to the callsigns, because its easier to show wether this is a new group or a previously existing group wich was dead) Now, when a new group respawns, apparently it doesn't use the same callsign (therefore I can say this is a NEW group beeing created), it uses the next one available (for ex: if 2-1-B is the latest group beeing on the map, 2-1-C will be created and respawned, even if it used to be 1-1-a) this means a NEW group is created INSTEAD of a previous existing group wich is empty (dead) anyway. This I find very strange because the command deletegroup _group is right there in the script. So normally if 1-1-A dies COMPLETELY, it should be able to be reused later ingame. This doesn't happen here, therefore I guess the deletegroup command is in the wrong place or something, wich is triggering the group limit. its norrins respawn script: // AI_respawn.sqf // © JULY 2009 - norrin if (!isServer) exitWith {}; _unit = _this select 0; _lives = _this select 1; _delay = _this select 2; _respawn_point = _this select 3; _move_script = _this select 4; _group = _this select 5; _side = _this select 6; _AI_unitArray = _this select 7; _AI_magArray = _this select 8; _AI_wepArray = _this select 9; _unitsGroup = units (group _unit); while {(count _unitsGroup) > 0} do { _remainingUnits = []; {if (alive _x) then {_remainingUnits = _remainingUnits + [_x]}} forEach _unitsGroup; _unitsGroup = _remainingUnits; sleep 1; }; [color="Red"]deleteGroup _group[/color]; if (_lives == 0) exitWith {}; _lives = _lives - 1; _wait = Time + _delay; waitUntil {Time > _wait}; _group = createGroup _side; {_x createUnit [(getMarkerPos _respawn_point), _group];} forEach _AI_unitArray; sleep 2; hint "AI respawn"; _unitsGroup = units _group; {_x disableAI "MOVE"} forEach _unitsGroup; for [{ _loop = 0 },{ _loop < count _unitsGroup},{ _loop = _loop + 1}] do { _guy = _unitsGroup select _loop; removeAllWeapons _guy; {_guy removeMagazine _x} forEach magazines _guy; removeAllItems _guy; {_guy addMagazine _x} forEach (_AI_magArray select _loop); {_guy addWeapon _x} forEach (_AI_wepArray select _loop); _guy selectWeapon (primaryWeapon _guy); _guy setSkill (_AI_skillArray select _loop); sleep 0.1; }; {_x enableAI "MOVE"} forEach _unitsGroup; _leader = leader _group; [_leader, _lives, _delay, _respawn_point, _move_script, _group, _side, _AI_unitArray,_AI_magArray, _AI_wepArray] execVM "AI_respawn\AI_respawn.sqf"; [_leader] execVM _move_script; if (true) exitWith {}; As in the script, the empty dead group (so also the callsign) should be deleted. then why am I getting the limit? And why are there only NEW groups beeing created, instead of old empty ones beeing reused? I've seen, in a lot of other posts, it is possible to bypass the group limit using scripts (or respawns) and it always works. and they all use deletegroup note: there are only 15 groups on each side to be respawned, so no more then 15 groups per side are constantly on the map (the limit is not beeing reached at once, it is reached only because of the respawns , therefore I know the problem is the script) So if every group dies approx 9 to 10times I will reach the group limit (15groups*10=150groups created= limit reached ) I do get hint message: "AI group respawned", but it's a null group. this null group respawns over and over, because it is "empty" and therefore dead. So the script works, only the limit has been reached. How can I delete dead groups? So that a new alive group (= with the same callsign) can be respawned again? Need help! related : http://www.ofpec.com/forum/index.php?topic=28808.0 Edited June 15, 2010 by dematti Share this post Link to post Share on other sites
Big Dawg KS 6 Posted June 15, 2010 Why do you even delete the group just to create a new one? Wouldn't it just be easier to use the same (empty) group for the newly spawned units? This would allow them to keep the same name & waypoints too. Share this post Link to post Share on other sites
dematti 10 Posted June 15, 2010 (edited) that is indeed what i've been trying to figure out for a while now. problem is I cannot find much info about this. I heard you have to use deletegroup in order to bypass the group limit. Thats why I tried that, but it's all good as long as I solve this problem. you know im not a scripting genius yet:) edit: here are the scripts again If you can help me putting the right lines in the right place, that would be great. init respawn (only used once): // AI_respawn_init.sqf // © JULY 2009 - norrin (norrin@iinet.net.au) if (!isServer) exitWith {}; _unit = _this select 0; _lives = _this select 1; _delay = _this select 2; _respawn_point = _this select 3; _move_script = _this select 4; _unitsGroup = units (group _unit); _side = side _unit; sleep 2; _AI_unitArray = []; _AI_magArray = []; _AI_wepArray = []; _AI_skillArray = []; {_AI_unitArray = _AI_unitArray + [typeOf _x]; _AI_magArray = _AI_magArray + [(magazines _x)]; _AI_wepArray = _AI_wepArray + [(weapons _x)]; _AI_skillArray = _AI_skillArray + [skill _x]}forEach _unitsGroup; [_unit, _lives, _delay, _respawn_point, _move_script, _group, _side, _AI_unitArray,_AI_magArray, _AI_wepArray,_AI_skillArray] execVM "AI_respawnEast.sqf"; [_unit] execVM _move_script; if (true)exitWith {}; respawn: // AI_respawn.sqf // © JULY 2009 - norrin if (!isServer) exitWith {}; _unit = _this select 0; _lives = _this select 1; _delay = _this select 2; _respawn_point = _this select 3; _move_script = _this select 4; _group = _this select 5; _side = _this select 6; _AI_unitArray = _this select 7; _AI_magArray = _this select 8; _AI_wepArray = _this select 9; _unitsGroup = units (group _unit); while {(count _unitsGroup) > 0} do { _remainingUnits = []; {if (alive _x) then {_remainingUnits = _remainingUnits + [_x]}} forEach _unitsGroup; _unitsGroup = _remainingUnits; sleep 1; }; deleteGroup _group; if (_lives == 0) exitWith {}; _lives = _lives - 1; _wait = Time + _delay; waitUntil {Time > _wait}; _group = createGroup _side; {_x createUnit [(getMarkerPos _respawn_point), _group];} forEach _AI_unitArray; sleep 2; hint "EAST group respawned"; _unitsGroup = units _group; {_x disableAI "MOVE"} forEach _unitsGroup; for [{ _loop = 0 },{ _loop < count _unitsGroup},{ _loop = _loop + 1}] do { _guy = _unitsGroup select _loop; removeAllWeapons _guy; {_guy removeMagazine _x} forEach magazines _guy; removeAllItems _guy; {_guy addMagazine _x} forEach (_AI_magArray select _loop); {_guy addWeapon _x} forEach (_AI_wepArray select _loop); _guy selectWeapon (primaryWeapon _guy); _guy setSkill (_AI_skillArray select _loop); _guy setVehicleInit "this addEventHandler ['killed',{[_this select 1,'East'] execvm 'Score.sqf'}];this setbehaviour 'safe';this addEventHandler ['killed', {_this select 0 execVM 'deleteBody.sqf'}]"; processInitCommands; sleep 0.1; }; {_x enableAI "MOVE"} forEach _unitsGroup; _leader = leader _group; [_leader, _lives, _delay, _respawn_point, _move_script, _group, _side, _AI_unitArray,_AI_magArray, _AI_wepArray] execVM "AI_respawnEast.sqf"; [_leader] execVM _move_script; if (true) exitWith {}; Edited June 15, 2010 by dematti Share this post Link to post Share on other sites
Big Dawg KS 6 Posted June 15, 2010 I heard you have to use deletegroup in order to bypass the group limit. But you won't be running into the group limit if you just keep the same groups. You only have to worry about the group limit if you keep creating new ones. Try deleting the lines in red: // AI_respawn.sqf // © JULY 2009 - norrin if (!isServer) exitWith {}; _unit = _this select 0; _lives = _this select 1; _delay = _this select 2; _respawn_point = _this select 3; _move_script = _this select 4; _group = _this select 5; _side = _this select 6; _AI_unitArray = _this select 7; _AI_magArray = _this select 8; _AI_wepArray = _this select 9; _unitsGroup = units (group _unit); while {(count _unitsGroup) > 0} do { _remainingUnits = []; {if (alive _x) then {_remainingUnits = _remainingUnits + [_x]}} forEach _unitsGroup; _unitsGroup = _remainingUnits; sleep 1; }; [color="Red"]deleteGroup _group;[/color] if (_lives == 0) exitWith {}; _lives = _lives - 1; _wait = Time + _delay; waitUntil {Time > _wait}; [color="red"]_group = createGroup _side; [/color] {_x createUnit [(getMarkerPos _respawn_point), _group];} forEach _AI_unitArray; sleep 2; hint "EAST group respawned"; _unitsGroup = units _group; {_x disableAI "MOVE"} forEach _unitsGroup; for [{ _loop = 0 },{ _loop < count _unitsGroup},{ _loop = _loop + 1}] do { _guy = _unitsGroup select _loop; removeAllWeapons _guy; {_guy removeMagazine _x} forEach magazines _guy; removeAllItems _guy; {_guy addMagazine _x} forEach (_AI_magArray select _loop); {_guy addWeapon _x} forEach (_AI_wepArray select _loop); _guy selectWeapon (primaryWeapon _guy); _guy setSkill (_AI_skillArray select _loop); _guy setVehicleInit "this addEventHandler ['killed',{[_this select 1,'East'] execvm 'Score.sqf'}];this setbehaviour 'safe';this addEventHandler ['killed', {_this select 0 execVM 'deleteBody.sqf'}]"; processInitCommands; sleep 0.1; }; {_x enableAI "MOVE"} forEach _unitsGroup; _leader = leader _group; [_leader, _lives, _delay, _respawn_point, _move_script, _group, _side, _AI_unitArray,_AI_magArray, _AI_wepArray] execVM "AI_respawnEast.sqf"; [_leader] execVM _move_script; if (true) exitWith {}; Share this post Link to post Share on other sites
dematti 10 Posted June 16, 2010 (edited) Ok, I'll try that tonight. Done a few tests yesterday (using script in post#3), I noticed something weird: I create 143 groups, kill 1 group, so 1group respawns. then I kill another (not the respawned group), they dont respawn. Then killed some more with same result. But when I kill the respawned group, they do respawn and keep respawning! :confused: Then I tried this with 100 groups, all works fine. I'm starting to think maybe it's not the group limit. maybe a savegame bug? (I am working on a very long lasting mission, the first few days everything worked perfectly even after saving and loading, but after 4,5 days of testing, I get hint messages: AI group respawned, while there was no groups actually respawning, this created a loop, the groups that respawned (but didn't) kept respawning over and over until they had no more respawns left(but I never saw them actually respawn) Strange thing is, on my side, everything went normal, It was only East having these "empty respawns". Having such a long mission doesn't make the testing easier, I have to restart and wait over and over... (off course I kill a few once in a while :)) Something wrong with the init.sqf? Maybe array doesn't load right? And on the other hand check the last post here:http://forums.bistudio.com/showthread.php?t=100323 Edited June 16, 2010 by dematti Share this post Link to post Share on other sites
dematti 10 Posted June 16, 2010 Try deleting the lines in red: Negative, I do get "AI respawned" hint message, but no units are created on the map. Share this post Link to post Share on other sites
dematti 10 Posted June 23, 2010 (edited) This still doesn't work Seems that after 144 groups have been on the island "empty" groups are respawned. And i'm totally sure of this because: the callsign of the 144th group always is 3-4-M. And ingame, after that last squad has been respawned I start getting nothing but empty respawns. The deletegroup command is there though, and if I delete the command the groups dont spawn at all. Really guys, who has a solution for this??? Edited June 23, 2010 by dematti Share this post Link to post Share on other sites
dematti 10 Posted June 25, 2010 (edited) Am I talking to air here? 170 views and no-one knows?? If so I can just aswell unrigister and throw this game down the street. No offense but, why are the specialists rarely doing an effort to help out the newer guys? That's very good, if you want to lose 70%of the community.... Edited June 25, 2010 by dematti Share this post Link to post Share on other sites
DenVdmj 0 Posted June 25, 2010 Groups are created and deleted properly, the command deleteGroup works correctly: _allGroup = allGroups - [group player]; _count = count _allGroup min 10; _offset = floor random (count _allGroup - _count); for "_i" from 0 to _count - 1 do { _group = _allGroup select (_i + _offset); { deleteVehicle _x } foreach units _group; deleteGroup _group; }; for "_i" from 0 to 1000 do { _group = createGroup createCenter side player; if(isNull _group) exitwith { _j = 0; { if(count units _x < 1) then { _j = _j + 1; }; } foreach allGroups; hint format [ "Created %1 groups\nDeleted %2 groups, [%3 .. %4]\nTotal void groups: %5", _i, _count, _offset, _count + _offset, _j ]; }; for "_i" from 0 to 5 do { _group createUnit [typeof player, getpos player, [], 1000, "none"]; }; }; Could you post the minimal code that demonstrates your problem? Share this post Link to post Share on other sites
dematti 10 Posted June 25, 2010 (edited) thx Denvdmj, But what is a minimal code? Only thing I have is the 2 scripts in post #3 And after 144 groups are respawned I get empty respawns. Dont know how this happens or wich code can be fault. I tried tweaking this script for couple of weeks now, always ending up in groups not respawning anymore or script not working at all. I tried to put empty groups in an array, to delete the deletegroup command, set new callsigns to groups,.... There must be something wrong with where I put wich lines... What also is a possibility is : the dead units get deleted after 30mins, maybe the deletegroup command doesnt work as long as there are dead units from that group? Even then the group should be deleted after units are deleted... I dont know anymore, and its driving me crazy, this is one of the last issues I have to deal with, before finally finishing this mission Edited June 25, 2010 by dematti Share this post Link to post Share on other sites
DenVdmj 0 Posted June 25, 2010 (edited) Test (non-working example): _g = group _someUnit; { _x setDammage 1 } foreach units _g; hint str count units _g; deleteGroup _g; if( !isNull _g ) then { hint "Error!" }; the working example: _g = group _someUnit; { deleteVehicle _x } foreach units _g; hint str count units _g; deleteGroup _g; if( isNull _g ) then { hint "Ok" }; The group can't be deleted if it still contains the units. Whether alive or dead. In your case _unitsGroup not contains the dead soldiers. Insert this test before code "deleteGroup _group;" (AI_respawn.sqf): if( count units _group > 0 ) exitwith { "Error!" call { diag_log _this; hint _this; }; }; Another test: _g = group _unit; { _x setDammage 1 } foreach units _g; hint str count units _g; deleteGroup _g; player sideChat str _g; units _g joinsilent player; deleteGroup _g; player sideChat str _g; So, the solution may be as follows: // init code missionNamespace setVariable ["/YourModPrefix/SpecialGroupForDeadUnits", createGroup createCenter sideLogic]; // in AI_respawn.sqf units _group joinSilent (missionNamespace getVariable "/YourModPrefix/SpecialGroupForDeadUnits"); deleteGroup _group; // Or the best way: { _x addEventHandler ["killed", { _group = group (_this select 0); if( { alive _x } count units _group == 0 ) then { units _group joinSilent (missionNamespace getVariable "/YourModPrefix/SpecialGroupForDeadUnits"); deleteGroup _group; execVM "spawnNewGroup.sqf"; }; }]; } foreach units _group; Edited June 25, 2010 by DenVdmj Share this post Link to post Share on other sites
DenVdmj 0 Posted June 30, 2010 What’s going down? Maybe something like this would be more stably: // init code _logic = createGroup createCenter sideLogic createUnit ["logic", [0,0,0], [], 0, "none"]; missionNamespace setVariable ["/YourModPrefix/SpecialGroupForDeadUnits", group _logic]; Share this post Link to post Share on other sites