Cryptdik 5 Posted May 29, 2017 So I'm trying to set it up so that the corpses that get cleaned up consist of only the players (respawning units) and the enemy forces minus vehicles for a defense mission. I'd like to keep the corpses of any friendlies that are in the defensive area for the sake of immersion. If in my description.ext I have corpseManagerMode = 2 so it cleans up player units, how can I also make it clean up any units of a specific side (preferably without removing vehicles, again for immersion)? Would I be able to use a pre-made script? And if so, what would be a good one to accomplish this task? Or else is there a way to make the built in corpse manager work this way? Share this post Link to post Share on other sites
pierremgi 4892 Posted May 29, 2017 You can use the garbage collector (in editor Same as description.ext and this command family. Share this post Link to post Share on other sites
Cryptdik 5 Posted May 29, 2017 Is there a way to make this so that it works on all units of a specific side? Since I'm using a random spawning script it would be much easier to make it simply remove the enemies that continuously spawn. Share this post Link to post Share on other sites
pierremgi 4892 Posted May 29, 2017 _grp = bla bla bis_fnc_spawnGroup; // or equivalent if (side _grp == EAST) then {removeFromRemainsCollector units _grp}; Share this post Link to post Share on other sites
Cryptdik 5 Posted May 30, 2017 So I'm still having trouble making this work. Trying to make it so I can simply add a spawned group to the collector. I've been looking at this: https://community.bistudio.com/wiki/addToRemainsCollector But how can I substitute the unit array with a group name? Something like addToRemainsCollector group "groupname" (I didn't test this) or something like that, so this way it will just add the groups I want to be cleaned without affecting anyone else? Also, In my description.ext I have corpseManagerMode = 2; Could that be affecting this? Share this post Link to post Share on other sites
pierremgi 4892 Posted May 30, 2017 I wrote for_grp . I thought it was clear that _grp is already a group. So you just have to test with your group... Don't confuse a group and an array of units. You need an array for the foreach loop. The reason why the "units" command is added to pass from a group to an array of units. corpseManagerMode =2 = None_But_Respawned - Only units that can respawn are managed by the manager. So these units are usually the playable units. (If you want to respawn some of other AIs, IMHO, you need a script like this one.) So far, you just have to add in the collector, the AIs of the side you want to be cleaned, as written above. The collector will not see your other side(s) spawned units. 1 Share this post Link to post Share on other sites
Cryptdik 5 Posted May 30, 2017 Mmkay I see, I think I've got it working. Thanks a bunch!! Share this post Link to post Share on other sites
Cryptdik 5 Posted June 1, 2017 I've got one more issue with using this. I've been trying to figure out where to put the lines to add the created groups in a script I'm using to the collector. Here's the script that I use to spawn waves of infantry. My issue is that I've placed the addtoremainscollector under several spots throughout the script and cannot find a way to make it work. How can I make this script add the spawned units to the garbage collector? private ["_min_groups", "_max_groups", "_min_group_size", "_max_group_size", "_number_groups", "_man_type"]; private ["_this_speed","_speed","_this_formation","_formation","_formation_count","_this_group","_this_man_odds","_skill_odds","_skill_index"]; _group0 = Creategroup WEST; _group1 = Creategroup WEST; _group2 = Creategroup WEST; _group3 = Creategroup WEST; _group4 = Creategroup WEST; _group5 = Creategroup WEST; _group6 = Creategroup WEST; _group7 = Creategroup WEST; addToRemainsCollector units _group1; addToRemainsCollector units _group2; addToRemainsCollector units _group3; addToRemainsCollector units _group4; addToRemainsCollector units _group5; addToRemainsCollector units _group6; addToRemainsCollector units _group7; // ****************************************************************************************************************************************************************************** // SET UP STUFF IN HERE!!!! _min_groups = 3; // The mimimum number of groups that will be created _max_groups = 4; // The maximum number of groups that will be created. This number CANNOT exceed 8 _min_group_size = 5; // The minimum number of people a group can contain _max_group_size = 7; // The maximum number of people a group can contain. _start_distance = 200; // This is the minimum spawn distance for a group from the trigger point _max_distance = 400; // This is the maximum spawn distance for a group from the trigger point _max_enemy_distance = 100; // This is the maximum distance a group can be from the player as the group follows the player around // ****************************************************************************************************************************************************************************** // // This array contains the type of enemy soldiers that a group can contain. _man_type=["LIB_GER_Soldier2_base","LIB_GER_stggunner","LIB_GER_smgunner","LIB_GER_stggunner","LIB_GER_unterofficer"]; // The man odds give the chances of what type of soldiers the enemy group will contain. 100 is 100% // // For example, if _man_odds_group1=[100,70,60,10,5]; it means that the chances of O_Soldier_F being created are 100 - 70, which is 30%, for // O_officer_F, the chances are 70 - 60 which is 10% chance. And so on. Each group can have different odds. _man_odds_group0=[100,90,60,20,10]; _man_odds_group1=[100,70,60,10,5]; _man_odds_group2=[100,50,40,10,5]; _man_odds_group3=[100,95,40,30,25]; _man_odds_group4=[100,80,20,15,5]; _man_odds_group5=[100,50,40,10,5]; _man_odds_group6=[100,50,40,10,5]; _man_odds_group7=[100,50,40,10,5]; // ****************************************************************************************************************************************************************************** // // These numbers represent the time BEFORE each group will be spawned in. Times are in seconds. // // _group_spawn_delay_min=[0,0,0,0,0,0]; // _group_spawn_delay_max=[0,0,0,0,0,0]; // // The initial delay before any groups are spawned will be 30 seconds + random time of (40 - 30), so 30 seconds + random of 10 seconds. // The next group will spawn at 45 seconds + random time of (60 - 45), so 45 seconds + random of 15 seconds, and so on. _group_spawn_delay_min=[0,0,0,0,0,0,0,0,0]; _group_spawn_delay_max=[0,0,0,0,0,0,0,0,0]; _sleep_delay = 20; // This MUST be at least two times less than any of the _group_spawn_delay numbers // ****************************************************************************************************************************************************************************** // // The _speed_type array contains the various types of speed the group can operate at. _speed_type=["LIMITED","NORMAL","FULL"]; // The _speed_odds array uses the same chance principles as the man odds. // For example, _speed_odds = [100,60,30]; will give 100 - 60, which is 40% chance that the group will have LIMITED speed, and so on. _speed_odds = [100,60,30]; // The _formation_type array contains all the types of formations that each group can move to a waypoint with. _formation_type=["NO CHANGE","COLUMN","STAG COLUMN","WEDGE","ECH LEFT","ECH RIGHT","VEE","LINE","FILE","DIAMOND"]; // The _formation_odds array uses the same chance principles as the man odds. _formation_odds = [100,90,80,70,60,50,40,30,20,10]; // ****************************************************************************************************************************************************************************** _group_skill=[0.2, 0.3, 0.4 ,0.5, 0.6, 0.7, 0.8, 0.9]; _group_skill_level=["Novice","Rookie","Rookie","Recruit","Recruit","Veteran","Veteran","Expert"]; _skill_odds=[100, 95, 85, 70, 50, 30, 15, 5]; // Must contain the same number of entries as _group_skill // ****************************************************************************************************************************************************************************** _all_groups = [_group0, _group1, _group2, _group3, _group4, _group5, _group6, _group7]; _all_man_odds = [_man_odds_group0, _man_odds_group1, _man_odds_group2, _man_odds_group3, _man_odds_group4, _man_odds_group5]; _number_groups = floor(random (_max_groups - _min_groups)) + _min_groups; //hint format ["Groups %1", _number_groups]; _man_number = count _man_type; _formation_count = count _formation_type; private ["_i", "_j", "_k", "_odds", "_table_odds", "_this_man", "_skill_level"]; //hint format ["Position %1, %2",_spawn_position, _number_groups]; _skill_count = (count _group_skill) - 1; // ****************************************************************************************************************************************************************************** _group_counter = 0; _wait_time = 0; _delay_min = _group_spawn_delay_min select _group_counter; _delay_max = _group_spawn_delay_max select _group_counter; _delay_time = (random (_delay_max - _delay_min)) + _delay_min; _wait_time = _wait_time + _delay_time; _skill_index = 0; // hint format ["Initial Delay: %1", _delay_time]; while {alive player} do { if ( time > _wait_time) then { if ( _group_counter < _number_groups) then { _this_group = _all_groups select _group_counter; _this_man_odds = _all_man_odds select _group_counter; _group_size = floor(random (_max_group_size - _min_group_size)) + _min_group_size; _spawn_position = position player; _xpos = _spawn_position select 0; _ypos = _spawn_position select 1; _zpos = _spawn_position select 2; _distance = _start_distance + random (_max_distance - _start_distance); _angle = random 360; _xxpos = (_distance * cos _angle); _yypos = (_distance * sin _angle); _xpos = _xpos + _xxpos; _ypos = _ypos + _yypos; _spawn_position set [0, _xpos]; _spawn_position set [1, _ypos]; _spawn_position set [2, _zpos]; _odds = random (100); for "_i" from 0 to _skill_count do { _table_odds = _skill_odds select _i; if (_odds < _table_odds) then { _skill_index = _i; }; }; // hint format ["_skill_index %1, _skill_count %2", _skill_index, _skill_count]; _skill_level = _group_skill select _skill_index; _skill_level_name = _group_skill_level select _skill_index; for "_i" from 0 to (_group_size - 1) do { _odds = random (100); for "_j" from 0 to (_man_number - 1) do { _table_odds = _this_man_odds select _j; if (_odds < _table_odds) then { _this_man = _j; }; }; _man = _man_type select _this_man; _man createUnit [_spawn_position, _this_group,"this allowFleeing 0", _skill_level, "Private"]; }; // hint format ["ENEMY SPAWNED: Group size %1, Skill: %2", _group_size,_skill_level_name]; _formation = _formation_type select floor random count _formation_type; _wp1 = _this_group addWaypoint [position player, _max_enemy_distance]; _wp2 = _this_group addWaypoint [position player, _max_enemy_distance]; _wp3 = _this_group addWaypoint [position player, _max_enemy_distance]; _wp1 setWaypointBehaviour "AWARE"; _wp1 setwaypointtype "MOVE"; _wp1 setWaypointFormation _formation; _wp1 setWaypointSpeed "Normal"; _wp1 setwaypointstatements ["True", ""]; _wp2 setwaypointtype "MOVE"; _wp3 setWaypointType "Cycle"; _group_counter = _group_counter + 1; _delay_min = _group_spawn_delay_min select _group_counter; _delay_max = _group_spawn_delay_max select _group_counter; _delay_time = (random (_delay_max - _delay_min)) + _delay_min; _wait_time = _wait_time + _delay_time; // hint format ["Initial Delay: %1", _delay_time]; }; }; for "_i" from 0 to (_group_counter - 1) do { _this_group = _all_groups select _i; _odds = random (100); for "_j" from 0 to ((count _speed_odds) - 1) do { _table_odds = _speed_odds select _j; if (_odds < _table_odds) then { _this_speed = _j; }; }; _odds = random (100); for [ {_j=0}, { _j < _formation_count}, { _j =_j+1 } ] do { _table_odds = _formation_odds select _j; if (_odds < _table_odds) then { _this_formation = _j; }; }; _speed = _speed_type select _this_speed; _formation = _formation_type select _this_formation; // hint format ["Speed: %1, Formation: %2", _speed, _formation]; [_this_group, 1] setWaypointSpeed _speed; [_this_group, 1] setWaypointFormation _formation; [_this_group, 1] setWaypointPosition [ getPosATL player, random (_max_enemy_distance) ]; [_this_group, 2] setWaypointPosition [ getPosATL player, random (_max_enemy_distance) ]; }; sleep _sleep_delay; }; Share this post Link to post Share on other sites
Cryptdik 5 Posted June 1, 2017 Or simpler, I have a trigger set up to detect BLUFOR units in the area and add them to the garbage collector, but I have a problem with this too. Repeatable BLUFOR PRESENT Cond:this && isNil "garbvar" OnAct: addToRemainsCollector this; garbvar = true; Deact: 0 = [] spawn {sleep 10; garbvar = nil} Problem is I know that addToRemainsCollector this; won't work because it's not referencing the group. How do I make it select the unit/group that activated it to add to the collector? Share this post Link to post Share on other sites
pierremgi 4892 Posted June 1, 2017 As I told you, not a group, a units array: You have to choose between units yourgrp and [unit1,unit2,...] For your trigger, it's simple as: addToRemainscollector thislist; For your script, as you're creating empty groups, even if using units (good point) you catch an empty array, not updated. So, use the command after spawning units. Share this post Link to post Share on other sites
Cryptdik 5 Posted June 1, 2017 11 minutes ago, pierremgi said: As I told you, not a group, a units array: You have to choose between units yourgrp and [unit1,unit2,...] For your trigger, it's simple as: addToRemainscollector thislist; For your script, as you're creating empty groups, even if using units (good point) you catch an empty array, not updated. So, use the command after spawning units. Sorry I'm a bit slow to pick up some of the syntax shtuff. So from my understanding would I be able to put addToRemainscollector thislist; outside the last }; of the script so that it plays afterwards? Or do I put it in the part that says "SET UP STUFF HERE"? I get the group vs units array part now, but I'm still unsure how to piece this together. Where do I put addToRemainscollector thislist; so that thislist refers to the created groups? EDIT: Wait I realized that you were referring to the trigger set up. I'm going to test it now with addToRemainsCollector thislist; instead of addToRemainsCollector this; Share this post Link to post Share on other sites
pierremgi 4892 Posted June 1, 2017 thisList has sense in trigger only. Share this post Link to post Share on other sites