OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Zipper5 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.
-
i dont know if it works but did you try lowerint in the rank of the player?
-
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.
-
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.
-
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".
-
Would something with selectLeader (http://www.ofpec.com/COMREF/index.php?action=details&id=700) 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?
-
Just tried that, Trexian and, unfortunately, it just gives the same result. I wonder if you actually can stop this from happening.
-
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 (http://www.ofpec.com/COMREF/index.php?action=details&id=701) 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? :)
/*
_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;
-
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.
-
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?
-
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.
-
Ok, if the name of the 3 man group is 3grp, I think you want to do something more like this
[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?
-
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.
-
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: