Jump to content
Sign in to follow this  
euly

Trouble with groups on a dedicated server

Recommended Posts

Hello.

In the editor, I have a group with team1 = group this in the leader's init field. I have also tried team1 = group this in every group member's init field as well as team1 = group player in the init.sqf (all players will be part of team1).

I have a helicopter with {alive _x && _x in Helo1} count units team1 == {alive _x} count units team1 in the condition of its first waypoint (which is on top of the chopper), basically saying "when everyone from team1 is in the chopper, take off."

This works perfectly in single player (and probably hosted multiplayer), but when I throw the mission on a dedicated server, the chopper will immediately take off, indicating that it does not recognize team1.

Any help will be appreciated.

Share this post


Link to post
Share on other sites

If all player units are in one team anyway try this (i use it in my helicopter insertion script):

_units = [] call BIS_fnc_listPlayers;
_n = 0;

for "_i" from 0 to (count _units - 1) do
{
_unit = (_units select _i);
_unit moveInCargo [_heli,_n];
_unit  assignAsCargo _heli;
_n = _n + 1;
};

I had a similar problem and i think its because the units init field is executed to late.

Share this post


Link to post
Share on other sites

In an mp environment it can take up to 2 seconds for the group variable to properly synchronise across the network and be recognised fully.

You can see this by seeing the effect of setgroupID in the init field of the units and then having that unit do a sidechat message at the start of the init.sqf and then after a delay of 2 seconds.

To work around this issue in scripting, waypoints etc add a time condition to your waypoint condition (And best run it on the server only if the helo pilot is in it's own AI group meaning its local to the server))

((IsServer) &&(Time > 4)&&({alive _x && _x in Helo1} count units team1 == {alive _x} count units team1))

You could also just count Isplayer and playableunits if all the players are in the same group

If you have disableai = 1 then you could just check for alive and count of playable units

Share this post


Link to post
Share on other sites
If all player units are in one team anyway try this (i use it in my helicopter insertion script):

_units = [] call BIS_fnc_listPlayers;
_n = 0;

for "_i" from 0 to (count _units - 1) do
{
_unit = (_units select _i);
_unit moveInCargo [_heli,_n];
_unit  assignAsCargo _heli;
_n = _n + 1;
};

I had a similar problem and i think its because the units init field is executed to late.

I'll give that a shot. Thank you Wiggum.

---------- Post added at 01:00 PM ---------- Previous post was at 12:55 PM ----------

In an mp environment it can take up to 2 seconds for the group variable to properly synchronise across the network and be recognised fully.

You can see this by seeing the effect of setgroupID in the init field of the units and then having that unit do a sidechat message at the start of the init.sqf and then after a delay of 2 seconds.

To work around this issue in scripting, waypoints etc add a time condition to your waypoint condition (And best run it on the server only if the helo pilot is in it's own AI group meaning its local to the server))

((IsServer) &&(Time > 4)&&({alive _x && _x in Helo1} count units team1 == {alive _x} count units team1))

You could also just count Isplayer and playableunits if all the players are in the same group

If you have disableai = 1 then you could just check for alive and count of playable units

The timing issue didn't occur to me. Thank you

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  

×