Jump to content

Recommended Posts

Hey guys,

 

I am working on a modification of a script. Right now I want players to have the choice to be able to join each others their group. Currently when you join someone his group it works all fine. The problem right now is when you leave the group it should move you back to you're old groupID. Currently it is not doing that and I know it makes sense because you're ment to save your GroupID before you join someone his group and with that information you can set the groupID back to the old GroupID. I am just confused with the bit how do I save someone his GroupID once in a variable to use in a command, an example:

_YourOldGroup = groupId (group player);

[player] joinSilent _YourOldGroup;

I think this way it would work but the problem is obviously _YourOldGroup will change because you are joining someone else his group, because of that it will set your group ID to your current group and not your old group...

 

I hope I made a bit sense...

 

Thank you for your time!

Share this post


Link to post
Share on other sites

Why don't you just store your old group in a global var before joining a new group.

My_Old_Group = groupId (group player);
Then you check if group still exists, if it does re-join it.
  • Like 1

Share this post


Link to post
Share on other sites

Why don't you just store your old group in a global var before joining a new group.

 

My_Old_Group = groupId (group player);
Then you check if group still exists, if it does re-join it.

 

 

I guess not a bad idea! There is only one problem... Will the group still exist even without someone in it? I am using a mission that is dependent on players to be in a certain groupID. 

Share this post


Link to post
Share on other sites

If 100% of the players/units leave the group then yeah it will be lost. What relies on the groupID? cos you could probably do it other ways.

Why not just save the leader of the old group and then rejoin on whatever group he is in now.

Share this post


Link to post
Share on other sites

1. Attach old group id on the player (player setvariable ["oldGroup",group player];

2. When you want to make him join his last group check : if((player getVariable "oldGroup") in allGroups)

3. _oldGrp = player getVariable "oldGroup"; player setvariable ["oldGroup",group player];[player] joinSilent _oldGrp;

  • Like 1

Share this post


Link to post
Share on other sites

1. Attach old group id on the player (player setvariable ["oldGroup",group player];

2. When you want to make him join his last group check : if((player getVariable "oldGroup") in allGroups)

3. _oldGrp = player getVariable "oldGroup"; player setvariable ["oldGroup",group player];[player] joinSilent _oldGrp;

 

Dude you're my hero!

  • Like 2

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

×