Jump to content
Sign in to follow this  
majorexperimental

AI-group member bots gets stuck

Recommended Posts

Sometimes, to often, group member bots gets stuck and stop to follow orders. Quite often they are stuck at corners at houses; just standing there "guarding" or what the heck they are doing... In rare occasions it can work to give them many different orders as "go there", "relax", "go prone", "stand up" etc but usually nothing works; if they respawn (multiplayer bots) nothing gets better either. The game seems to totally abandon them....

What can be done to solve that? Something that "restarts" them?

Share this post


Link to post
Share on other sites

Try to ungroup and regroup them, or change their position with getPos setPos. Last but not least you could simply replace them.

Edited by R3vo

Share this post


Link to post
Share on other sites

If you're setposing them to a better place, something like this might work:

_stuckUnit setPos (getPos _stuckUnit [url="https://community.bistudio.com/wiki/findEmptyPosition"]findEmptyPosition [/url][0,5,"SoldierWB"])

Although, you'll have to handle a situation where the findemptyposition can't find a good one.

Share this post


Link to post
Share on other sites
Try to ungroup and regroup them, or change their position with getPos setPos. Last but not least you could simply replace them.

You mean team assign "in game" when the incident happens? Without mods I know no in-game-ways to change the members in a group. Or perhaps I have missed things?

---------- Post added at 09:50 ---------- Previous post was at 09:44 ----------

If you're setposing them to a better place, something like this might work:

_stuckUnit setPos (getPos _stuckUnit [url="https://community.bistudio.com/wiki/findEmptyPosition"]findEmptyPosition [/url][0,5,"SoldierWB"])

Although, you'll have to handle a situation where the findemptyposition can't find a good one.

You mean some kind of teleporting? Or? How do I use the code?

Edited by MajorExperiMental

Share this post


Link to post
Share on other sites
You mean team assign "in game" when the incident happens? Without mods I know no in-game-ways to change the members in a group. Or perhaps I have missed things?

---------- Post added at 09:50 ---------- Previous post was at 09:44 ----------

You mean some kind of teleporting? Or? How do I use the code?

I thought maybe joining the soldier into an other group would help.

_soldier1 join _group1;

Afterwards join him back to your group:

_soldier1 join _groupOld;

However, it's just an idea, no clue if will actually help in your case.

Share this post


Link to post
Share on other sites
I thought maybe joining the soldier into an other group would help.

_soldier1 join _group1;

Afterwards join him back to your group:

_soldier1 join _groupOld;

However, it's just an idea, no clue if will actually help in your case.

Thanks for trying! ;-) How do I use code that way when playing and not are in editing mode?

Share this post


Link to post
Share on other sites
Thanks for trying! ;-) How do I use code that way when playing and not are in editing mode?

Quick and dirty example:

unstuckGroup.sqf

[color="#FF8040"][color="#006400"][i]/*
Author: Revo

Description:
Tries to unstuck player's group members by teleporting them to the player's position and rejoining his group.

Player's initialisation:
this addAction ["Unstuck group members","unstuckGroup.sqf"];
Parameter(s):
	-

Returns:
-
*/[/i][/color]

[color="#006400"][i]//_unit = param [0,player]; development branch only[/i][/color]

[color="#1874CD"]_unit[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_groupArray[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]

[color="#8B3E2F"][b]{[/b][/color][color="#000000"]_x[/color] [color="#191970"][b]setPos[/b][/color] [color="#191970"][b]getPos[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]forEach[/b][/color] [color="#191970"][b]units[/b][/color] [color="#191970"][b]group[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b];[/b][/color]
[color="#8B3E2F"][b]([/b][/color][color="#191970"][b]units[/b][/color] [color="#191970"][b]group[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]joinSilent[/b][/color] [color="#000000"]grpNull[/color][color="#8B3E2F"][b];[/b][/color]

[color="#191970"][b]for[/b][/color] [color="#7A7A7A"]"_i"[/color] [color="#191970"][b]from[/b][/color] [color="#FF0000"]1[/color] [color="#191970"][b]to[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]units[/b][/color] [color="#191970"][b]group[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b])[/b][/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]do[/b][/color]
[color="#8B3E2F"][b]{[/b][/color]
[color="#1874CD"]_groupArray[/color] [color="#191970"][b]pushBack[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]units[/b][/color] [color="#191970"][b]group[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]select[/b][/color] [color="#1874CD"]_i[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]

[color="#191970"][b]sleep[/b][/color] [color="#FF0000"]0.1[/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_groupArray[/color] [color="#191970"][b]joinSilent[/b][/color] [color="#000000"]grpNull[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]sleep[/b][/color] [color="#FF0000"]0.1[/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_groupArray[/color] [color="#191970"][b]joinSilent[/b][/color] [color="#191970"][b]group[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b];[/b][/color][/color]

Made with KK's SQF to BBCode Converter

Have not tested if it can unstuck a unit,though, it's a try worth.

Edit:

For a less obstrusive way to unstuck the AI replace

{_x setPos getPos _unit} forEach units group _unit;
(units group _unit) joinSilent grpNull;

with

for "_i" from 1 to (count (units group _unit) - 1) do
{
_offset = [-1,1] call BIS_fnc_selectRandom;
_pos = getPos ((units group _unit) select _i); 
((units group _unit) select _i) setPos [((_pos select 0) + _offset),((_pos select 1) + _offset),_pos select 2];
};

Edited by R3vo

Share this post


Link to post
Share on other sites
Quick and dirty example:

unstuckGroup.sqf

...

Actually I'd prefer to just despawn and spawn a new unit if possible. I find the unit's AI is just "broken" a lot of the time. Even if I move them with MCC they remain "broken" I've noticed.

Any code for that ?

Share this post


Link to post
Share on other sites

I think everyone has missed the OPs point, maybe he posted in the wrong thread but I think he means while you are in any mission and not necessarily his own to edit with AI subordinates and every now and then one will get stuck on an object, I see it often, they get stuck and either freeze or walk around in a tight circle, I think it happens on stable and dev... Like him I've tried everything and usually end up just shooting him if the mission is throw away.

Very frustrating when it happens... Especially if a mission is going well and this sort of thing breaks it.

Edited by Altis

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
Sign in to follow this  

×