Jump to content
Sign in to follow this  
Sarge

weird behaviour switching sides for players

Recommended Posts

Hi all,

am stuck on an issue that took some time already, hope for some help here.

let me explain the situation:

full MP environment, dedicated server.

- I got a trigger defined, that fires whenever a player enters or leaves the trigger. Works like a charm.

- I figure out which player leaves or enters by comparing the triggerlist with a variable that i store on the trigger that holds all players. -> works like a charm as well.

What i try to do now is that IF a player enters the trigger, i (based on certain conditions) try to switch his side.

The way i do that is:

                _trig_grp = createGroup resistance;
               sleep 1;

               {
                   [_x] joinSilent grpNull;
                   sleep 1;
                   diag_log format["XXXXXXX ----- joined nullGrp -----------: %1",_x];    
                   [_x] joinSilent _trig_grp;
                   diag_log format["XXXXXXX ----- joined %2 -----------: %1",_x,_trig_grp];                        
                   sleep 1;
               } foreach _trig_unitlist;

In this special example, _trig_unitlist only holds one unit (checked before), so this is only executed on one player.

if i check the players side after the above with:

                diag_log format["|||||||||||||||||| player joined group, side of player set to: %1",side _player_joined]; 
               sleep 1;
               diag_log format["|||||||||||||||||| player joined group, side of player set to: %1",side _player_joined]; 
               sleep 1;
               diag_log format["|||||||||||||||||| player joined group, side of player set to: %1",side (_trig_unitlist select 0)];
               sleep 1;
               diag_log format["|||||||||||||||||| player joined group, side of player set to: %1",side _trig_grp];

i do get weird results. _player_joined holds the player object that joined the trigger, _trig_unitlist select 0 is the same, and side _trig_grp shows the side of the defined group.

What IS weird is, if i reduce / adjust the sleeps, i get different results. In theory, all 4 diags should show the same value. In reality, it looks like this:

21:26:41 "XXXXXXX ----- joined nullGrp -----------: B 1-1-A:1 (Sarge) REMOTE"
21:26:41 "XXXXXXX ----- joined R 1-1-A -----------: R 1-1-A:1 (Sarge) REMOTE"
21:26:42 "|||||||||||||||||| player joined group, side of player set to: WEST"
21:26:43 "|||||||||||||||||| player joined group, side of player set to: WEST"
21:26:44 "|||||||||||||||||| player joined group, side of player set to: GUER"
21:26:45 "|||||||||||||||||| player joined group, side of player set to: GUER"

These results are NOT consistent, sometimes it works sometimes it doesnt.

Questions:

- is there any delay when creating a group and joining a unit before that unit switches it's side to the one of the group?

- is there a known bug with creategroup / joinsilent ?

I am looking for a simple way to switch sides for a player, only found the soultion via groups.

Any help is highly appreciated, if BI reads this, i would welcome a hint.

cheers

Sarge

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  

×