Jump to content
gc8

AI shoot own on dedicated

Recommended Posts

Hi

I ran to this problem where AIs of my side shoot me on dedicated server.

The problem has something to do with the fact that I'm creating the AIs with createunit command and because the config side of those units is different from what I want them to be, I'm using the trick described in wiki to change the AIs side to what I want.

 

So I have this:

 

createUnitBase =
{
 params ["_group","_objType","_pos",["_spes","NONE"]];
 
 private _unit = _group createUnit [_objType, _pos, [], 0, _spes];
 
[_unit] joinSilent _group;

_unit
};

 

It works in SP but in dedicated server the AI shoots me (same side)

 

Any one know how to fix?

 

thx!

 

Share this post


Link to post
Share on other sites

I'm also using a similar method in a mission that runs on a dedicated server and what I've observed is that it takes a few seconds to a minute or so before the AI actually changes side.  In that time the AI still thinks it's of the opposite side and will engage the other units of its group.  I don't have a fix for it as it doesn't really matter for me.

Share this post


Link to post
Share on other sites

I guess you have to ensure that the _unit is created on the same machine as the group is local to before you join the group.

Share this post


Link to post
Share on other sites

Oh I'm doing all of that on server so locality shouldn't be the issue. 

Share this post


Link to post
Share on other sites
2 minutes ago, stanhope said:

Oh I'm doing all of that on server so locality shouldn't be the issue. 

did u try revealing in any form to solve it?

Share this post


Link to post
Share on other sites

It seems that I was able to fix it with using joinsilent on client:

 

 [player] joinSilent (group player);

 

Don't know why that is needed on client, maybe because I'm also recreating the player and using selectPlayer.

But anyway it works now

Share this post


Link to post
Share on other sites

Now they are shooting my group members.

 

tried this but is has no effect (At least AI side is west, like it should be):

 

[_unit] joinSilent _group;

if(isplayer (leader _group)) then
{
  [_unit,_group] remoteExecCall ["joinSilent", leader _group];
};

 

maybe it has something to do with AI being in vehicle

Share this post


Link to post
Share on other sites

Here you solved it by player joining players group

37 minutes ago, gc8 said:

[player] joinSilent (group player);

maybe you could solve it by let all AI of the group join their group again.

 

but for me it looks all like a wonky workaround. maybe you should try to reveal in any form to update all needed information for the whole group...

Share this post


Link to post
Share on other sites

It seems I cant make the players group member AIs the right side no matter how I try

Share this post


Link to post
Share on other sites

Nevermind I got it working now.

 

It was this line that did not work:

 

 

 [_unit,_group] remoteExecCall ["joinSilent", leader _group];

 

Don't know why.

 

using new code now and all seems to be good

 

(So it seems you have to call joinSilent on client for client units to make this work)

Share this post


Link to post
Share on other sites
2 minutes ago, gc8 said:

using new code now and all seems to be good

what about sharing? ;-)

Share this post


Link to post
Share on other sites
5 minutes ago, sarogahtyp said:

what about sharing? 😉

 

Sure, it's just another way of doing joinSilent

 

Client:

changeAISide =
{
 params ["_unit","_group"];
 

 [_unit] joinSilent _group;
};

 

Server:

 

createUnitBase =
{
 params ["_group","_objType","_pos",["_spes","NONE"]];
 
 private _unit = _group createUnit [_objType, _pos, [], 0, _spes];
 
[_unit] joinSilent _group;

if(isPlayer (leader _group)) then
{

[_unit,_group] remoteExecCall ["changeAISide", (leader _group)];

// [_unit,_group] remoteExecCall ["joinSilent", _plrs select 0];
};

_unit
};

 

 

There's basically two calls to joinSilent when group leader is player but I don't yet know if that's necessary

  • Like 1

Share this post


Link to post
Share on other sites

I neved had to remoteExec a joinSilent... and it's a arguments_global.gifeffects_global.gif  command.

 

I'm using that  like you did previously, with no problem:

-  createUnit / joinSilent  on dedicated server... but my script is for server only. So???

- That works fine for infantry. For vehicles, you need to use createVehicleCrew (before joinSilent on each crew).

 

PS: on dedi, group player has no sense. So check your group, create a temporary one if you want but don't remoteExec this kind of command.

Share this post


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

I neved had to remoteExec a joinSilent... and it's a arguments_global.gifeffects_global.gif  command.

 

That's what I was thinking too but the only way I got it working for player AIs was to call joinSilent first on server and then on client as well. And I tested removing the server joinSilent but it caused the problem.

 

I think that the behavior with AI led groups is different from player led groups and the joinSilent (client) is needed for player's AIs

 

 

 

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

×