Jump to content
Mattmad1234

Switch players side from a trigger

Recommended Posts

Hi all! 

I am working on a small missions for some friends and I would like to setup a trigger system. Basically when a player enters a specific trigger on the map, their side changes from CIV, to either OPFOR or BLUFOR, depending on which trigger they enter. Then when the trigger deactivates they are set back to CIV. Is something like this possible?? If so I would appreciate any help I could get!!

 

Thanks!

Share this post


Link to post
Share on other sites

Check out this topic from the other day, Change player side with AddAction, it's basically the same thing but you want a trigger instead of an action.

So we understand,
1) Player chooses side by entering trigger zone
2) When leaving same trigger zone player returns to civilian

Is this correct?

Share this post


Link to post
Share on other sites

That is correct! Ill take a look as the post u sent as well!

Thanks for the reply

Share this post


Link to post
Share on other sites

Use the trigger (or marker) for its area only (it's simpler).

Say trigWEST or "markerWest", trigEAST....

 

0 = [] spawn {
  while {true} do {
    {
      call {
        if (_x inArea trigWEST) exitWith {
          if (side (_x getVariable ["actualGrp",grpNull]) != WEST) then {_x setVariable ["actualGrp", createGroup WEST]};
        };
        if (_x inArea trigEAST) exitWith {
          if (side (_x getVariable ["actualGrp",grpNull]) != EAST) then {_x setVariable ["actualGrp", createGroup EAST]};
        };
        if (side (_x getVariable ["actualGrp",grpNull]) != CIVILIAN) exitWith {
          _x setVariable ["actualGrp", createGroup CIVILIAN];
        };
      };
      if (side _x != side (_x getVariable "actualGrp")) then {
        _oldGrp = group _x;
        [_x] joinSilent (_x getVariable "actualGrp");
        if (count units _oldgrp == 0) then {deleteGroup _oldGrp};
      };
    } forEach allPlayers;
    sleep 2;
  };
};

 

  • Like 1

Share this post


Link to post
Share on other sites

Wow that actually worked perfectly!! Thank you so much for the help!

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

×