Home   Help Search Login Register  

Author Topic: Stopping the player from becoming "1"  (Read 2592 times)

0 Members and 1 Guest are viewing this topic.

Offline Zipper5

  • BIS Team
  • ****
Stopping the player from becoming "1"
« on: 05 May 2009, 09:29:12 »
Hey guys. I've got a question for you.

I'm currently making a mission where you meet up with a small 3 man squad. By default, when you join the player to that group, he remains as the number "1", and the leader, who actually becomes the player's leader, becomes "2". Since there are 3 guys in the squad you join, is it possible to make it so that the player becomes number "4" in the group when he is joined to it?

Thanks.

Offline schuler

  • Contributing Member
  • **
Re: Stopping the player from becoming "1"
« Reply #1 on: 05 May 2009, 09:56:25 »
i dont know if it works but did you try lowerint in the rank of the player?
Semper Fi

Offline Zipper5

  • BIS Team
  • ****
Re: Stopping the player from becoming "1"
« Reply #2 on: 05 May 2009, 10:15:47 »
Nah, it's the same thing. Even when he's a private he still becomes "1". But he's not the leader of the group.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Stopping the player from becoming "1"
« Reply #3 on: 05 May 2009, 11:21:33 »
Old problem. I remember THobson sort of got around this in Abandoned Armies by letting the player reorganize his group whenever he wanted (e.g. change the positions of the group members). If I remember correctly he did this by simply un-joining everyone (units grp1) join GrpNull and then re-joining them in the appropriate order [unit1, unit2, unit3] join Unit0.

That -should- work, as far as I can tell :) A little messy, but it should fix it. You can easily use the ArmA command joinSilent for this to avoid the radio chatter too.

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Zipper5

  • BIS Team
  • ****
Re: Stopping the player from becoming "1"
« Reply #4 on: 05 May 2009, 11:42:45 »
I tried that Wolfrug and, unfortunately, that puts the leader of the 3 man team the player is to join as the leader of "grpNull" so when the player, "aP", joins the leader, "s1", the player still remains number "1".

Offline Trexian

  • Members
  • *
Re: Stopping the player from becoming "1"
« Reply #5 on: 05 May 2009, 14:18:34 »
Would something with selectLeader work?

create array of the player's group
remove player from array
randomly pick unit, or use the unit you know you want to be the leader (may have to sort by rank)?
then group selectLeader unit?
Sic semper tyrannosauro.

Offline Zipper5

  • BIS Team
  • ****
Re: Stopping the player from becoming "1"
« Reply #6 on: 05 May 2009, 16:01:46 »
Just tried that, Trexian and, unfortunately, it just gives the same result. I wonder if you actually can stop this from happening.

Offline Trexian

  • Members
  • *
Re: Stopping the player from becoming "1"
« Reply #7 on: 05 May 2009, 16:11:37 »
Hmmm... could you post the code you're using?  I have some teamswitchable stuff in one of my missions and can switch to a player that is not the leader.

Maybe selectPlayer to change the unit of the player, and selectLeader one of the other units?

Here's another idea.  A quick, untested script.  Put the addaction in the init line of the group, and I think it'll work.  Did I mention this is untested? :)

Code: [Select]
/*

_playerFollower = player addAction ["Switcharoo", "playerFollower.sqf","",10,false,false,""];

*/

_grp = group player;
_units = units _grp;

{
selectPlayer _x;
hint format ["player = %1", _x];
sleep 5;

} forEach _units;
« Last Edit: 05 May 2009, 16:30:04 by Trexian »
Sic semper tyrannosauro.

Offline Zipper5

  • BIS Team
  • ****
Re: Stopping the player from becoming "1"
« Reply #8 on: 05 May 2009, 17:48:04 »
Code: [Select]
aPGrp setLeader s1
~0.5
[aP] join s1
aPGrp being what I called the player's group. It still left with the leader not being "1". I'll try out your code there.

Offline Trexian

  • Members
  • *
Re: Stopping the player from becoming "1"
« Reply #9 on: 05 May 2009, 19:04:10 »
Ah.. couple things going on, I think.

First, you have "setLeader" and the command is "selectLeader." :)  And s1 is the variable that contains the unit that you want to be the leader?  Try aPGrp selectLeader s1 instead.

Second, the "join" command, I believe, needs the unit in the array, which I believe you have as the player aP, then the group - not the leader.  So, I think the correct syntax would be [aP] join aPGrp.  :)

Oh, the stuff I posted should cycle the "player" through all the units in the player group.

Edit:
In re-looking at it, does the player start off in the group, or on his own?  Or is this all spawned?
« Last Edit: 05 May 2009, 19:05:48 by Trexian »
Sic semper tyrannosauro.

Offline Zipper5

  • BIS Team
  • ****
Re: Stopping the player from becoming "1"
« Reply #10 on: 05 May 2009, 19:59:21 »
The player starts the mission on his own and later joins up with the 3 man team to go complete another objective.

And yes, I meant "selectLeader" not "setLeader", sorry. Typo on my part.

Offline Trexian

  • Members
  • *
Re: Stopping the player from becoming "1"
« Reply #11 on: 05 May 2009, 20:23:44 »
Ok, if the name of the 3 man group is 3grp, I think you want to do something more like this

Code: [Select]
[aP] join 3Grp

And, if he's still the leader after that, then "3Grp selectLeader s1" after that (where s1 is the unit you want to be the leader of 3Grp).  From what you posted, you may have been trying to set s1 as the leader of player's group before s1 was actually in the group?

Also, out of curiosity, are you using a trigger for this?
Sic semper tyrannosauro.

Offline Zipper5

  • BIS Team
  • ****
Re: Stopping the player from becoming "1"
« Reply #12 on: 05 May 2009, 20:33:34 »
Well, you get an action to tell the leader when you're ready after rearming, and then that action activates a script which joins the player to the squad. It's a sqs script too, not a sqf.

I'll try out what you've suggested. Thanks again.

Offline Trexian

  • Members
  • *
Re: Stopping the player from becoming "1"
« Reply #13 on: 06 May 2009, 01:15:48 »
Ah - right.

The sqf stuff that I posted will just cycle through each member of the group.  At least that way, though, you may be able to work out what the issue is.   :good:
Sic semper tyrannosauro.