Jump to content
JB47394

Adding AI to player group in multiplayer game

Recommended Posts

I can't seem to get this to work reliably.  I have an EAST or CIV faction AI, sometimes grouped, sometimes not, which is joined to the player's group.  The join takes place on the server with AI that are controlled by the server.

 

When run in an editor server session, I can reliably get this to work even when I'm using multiple clients.  It is when the scripts hit the public, dedicated server that I see problems.

 

Sometimes the AI enter the player group correctly.

 

Sometimes they don't, but the players can transfer player group leadership to another player already in the group and the AI will show up.

 

Sometimes they don't, and the leadership transfer workaround doesn't workaround.

 

Is this likely some kind of AI ownership problem?  A timing problem?  I haven't been experimenting much with changing things around because I can't duplicate the problem locally.  I was hoping that somebody else had already gone through this.

 

Thanks for any help or insights.

Share this post


Link to post
Share on other sites

Can you pastebin the code that is used to create the group?

Share this post


Link to post
Share on other sites

It's just a straight join.  No magic.

 

It worked out that the problem was that groups, like vehicles, are owned by various machines.  So I had to remoteExec the join on the groupOwner's machine - which is a client.  Limited testing suggests that it works just fine.

 

[_unit] join _group

 

became*

 

[[_unit], _group] remoteExec ["join", groupOwner _group]

 

Note that if you're working with groups of AI on the server, there's no need to worry about this because the server owns all those groups.  Everything is local to the server, and no remoting is necessary.

 

*Not verified for accuracy.  I remoteExec a short script instead of the join directly.

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

×