Jump to content
Sign in to follow this  
naizarak

AI Group locality issues in vehicles

Recommended Posts

Hi, I have a problem I've been trying to figure out for a while but have given up on. Maybe someone here can explain it to me.

I have a simple script where AI units will automatically join the driver's group when entering a vehicle. As such players can "pass-off" AI units between each other.

However there appears to be a locality issue with group ownership in multiplayer. The server and players recognize the driver's group as the group of the AI. However, the driver still sees the AI as belonging to their old group before ownership transfer. This doesn't make sense to me as all executed commands have global effect, and everyone but the driver correctly recognize the AI's new group. Effectively the AI is stuck in limbo as the driver thinks it belongs to its old group, whereas everyone else thinks it belongs to the driver.

Sample mission demonstrating the problem: here

Vehicle Init:

if (isServer) then { this addEventHandler ["GetIn", { _this call fnc_civIn; }]; };

fnc_civIn:

[(_this select 2)] joinSilent (group driver (_this select 0));

For reference, fnc_civIn is compiled in a preInit file on the server only.

Share this post


Link to post
Share on other sites

well for anyone interested, i was able to fix the problem by spawning the function and preceding the "join" command with a 3 sec sleep. apparently there's some internal process that conflicts with the join command, so you just have to wait for it to end first. this isn't ideal as execution times vary between computers, but a 3 sec wait should be more than enough

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  

×