Jump to content
pcc

Rejoin rogue AI units back to their original group

Recommended Posts

My mission spawns vehicles with crew and cargo in a while loop into the same group each side.  However, occasionally somehow the cargo AI units will end up in their own separate group despite being created originally with the group they are supposed to be in.

Is there a way to get all the groups of one side, and if units are not in either the original or player's group, then rejoin those units into their original group?

[] spawn {
while {true} do { 
	if(count (allGroups select {side _x isEqualTo west}) > 2) then 
	{
		{
		//all groups except _group and group player joinSilent _Group; 
		}foreach (allGroups select {side _x isEqualTo west});
	};
	sleep 30;
};

 

Share this post


Link to post
Share on other sites

Not sure you're looking at the right direction. If you spawn units you're able to make them join the group you want.

Two reasons if that fails:

- you're using createUnit and you didn't follow the recommendations/remarks of BIKI;

- you're in a very long spawned script which fails to be completed in due time by engine's scheduler, or even you're attempting to remoteExec something too heavy.

 

Share this post


Link to post
Share on other sites
23 minutes ago, pierremgi said:

Not sure you're looking at the right direction. If you spawn units you're able to make them join the group you want.

Two reasons if that fails:

- you're using createUnit and you didn't follow the recommendations/remarks of BIKI;

- you're in a very long spawned script which fails to be completed in due time by engine's scheduler, or even you're attempting to remoteExec something too heavy.

 

I'm using this createunit syntax to fill vehicle cargo.

_c = 1;
for "_c" from 1 to (_vehicle emptyPositions "cargo") do {
_cargo = _originalGroup createUnit [selectRandom _soldiersarray, position _vehicle, [], 0, "NONE"];
_cargo moveInCargo _vehicle;
};

Most of the time the vehicle crew and cargo crew joins into _originalGroup no problem.  But sometimes in spectate, I see extra groups that I did not create, with 1 AI unit by itself. 

How do I get them to rejoin _originalGroup?  I have another separate patrol group and my own group I don't want joining with _originalGroup, just the new groups that I didn't create.

Share this post


Link to post
Share on other sites

_c = 1;  // totally useless

if (_vehicle emptyPositions "cargo" isEqualTo []) then {

   for "_c" from 0 to (_vehicle emptyPositions "cargo") -1 do {

     _cargo = _originalGroup createUnit [selectRandom _soldiersarray, position _vehicle, [], 0, "NONE"];

    [_cargo] joinSilent _originalGroup;

    _cargo moveInCargo _vehicle;

  };

};

 

  • Like 1

Share this post


Link to post
Share on other sites
17 hours ago, pierremgi said:

_c = 1;  // totally useless

if (_vehicle emptyPositions "cargo" isEqualTo []) then {

   for "_c" from 0 to (_vehicle emptyPositions "cargo") -1 do {

     _cargo = _originalGroup createUnit [selectRandom _soldiersarray, position _vehicle, [], 0, "NONE"];

    [_cargo] joinSilent _originalGroup;

    _cargo moveInCargo _vehicle;

  };

};

 

Some vehicles are now not getting their cargo crew when they had before.  Tempest transport for example.

Also, the units were created to be in _originalGroup by createUnit, why did they need be joined to _originalGroup?

Share this post


Link to post
Share on other sites
4 hours ago, pcc said:

Some vehicles are now not getting their cargo crew when they had before.  Tempest transport for example.

Also, the units were created to be in _originalGroup by createUnit, why did they need be joined to _originalGroup?

 

I don't know what is your _originalGroup, so I let's say that if the leader (sometimes SL and TL) can't jump into a truck, some subordinates will not embark.

I "join" the unit to make it sure this unit belongs to the right side. And that doesn't hurt.

You can also use "CARGO" instead of "NONE" in createUnit if you want (not tested).

For createUnit (as for any question about any command),  read BIKI from top to bottom.

Share this post


Link to post
Share on other sites

I'm still getting cargo units that randomly form their own group.

I'm trying to delete all units of all groups except 3 groups.

{
	if((groupId _x != "Blue") && (groupId _x != "Green") && (groupId _x != groupId(group player))) then 
	{
		{
			deleteVehicle _x 
		}
		forEach units (group _x);
	};
}
forEach allGroups;

But I'm getting  Error group: Type Group, expected Object.

Share this post


Link to post
Share on other sites

So apparently the issue is due to game bug where some AI cargo units creating their own rogue group after disembarking.   When an infantry AI unit is becoming rogue, there will be a new rogue group that appears with no units in the spectator entities list.   The rogue AI at this point is still listed in their original group, but they act like they're in the new rogue group with no waypoints.  When the rogue AI is the only survivor of it's original group, their name will be moved to the new rogue group.

This leaves stranded infantry AI units with no waypoints as their new rogue group doesn't have the waypoints from their original group.  The problem gets worse in waves of spawning AI vehicles groups.  You also can't give waypoints to this new rogue group until rogue AI infantry officially moves to the new rogue group.

Spoiler

rogue_group_alpha_3-6_.jpg

Spoiler

original_group_alpha_3-2.jpg

The rogue AI Majeed Gailani is originally in group Alpha 3-2, but also created it's own rogue Alpha 3-6 group.  At this point it no longer follows it's original group.

Share this post


Link to post
Share on other sites

I'm trying to spread awareness and hope that gets the game bug fixed by BIS. 

But if somehow the bug is caused by mission script code, I just don't see it.

 

Test mission:

https://feedback.bistudio.com/T162211

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×