Home   Help Search Login Register  

Author Topic: Changing Group Leaders  (Read 1330 times)

0 Members and 2 Guests are viewing this topic.

shadow99

  • Guest
Changing Group Leaders
« on: 13 Jul 2004, 05:52:26 »
Okay, I'm building a mission where you ambush a convoy of BMPs, but your leader temporarily turns over the mission to you whilst this is happening because it's your specialty as an explosives expert.

So, I need the group leader to turn to you, temporarily.

Don't worry about if the group's still all alive, the leader has 'setCaptive' attached to him.

m21man

  • Guest
Re:Changing Group Leaders
« Reply #1 on: 13 Jul 2004, 06:48:25 »
Code: [Select]
_leader = leader (group player)
_units = units (group _leader)

_units join grpnull
_units = _units - [player]
_group = group player
_units join _group
exit

Not guaranteed :P .
« Last Edit: 13 Jul 2004, 06:48:40 by m21man »

shadow99

  • Guest
Re:Changing Group Leaders
« Reply #2 on: 13 Jul 2004, 09:00:54 »
Being a n00b, what bits to I fill in? Just (player) and (group_leader)?

m21man

  • Guest
Re:Changing Group Leaders
« Reply #3 on: 13 Jul 2004, 15:10:23 »
No editing should be necessary. Just try executing the script.

shadow99

  • Guest
Re:Changing Group Leaders
« Reply #4 on: 14 Jul 2004, 07:10:23 »
No dice. The leader says
"All follow 1!" (Himself)
"1, Ready!"

shadow99

  • Guest
Re:Changing Group Leaders
« Reply #5 on: 15 Jul 2004, 04:36:27 »
Bump

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Changing Group Leaders
« Reply #6 on: 15 Jul 2004, 12:16:50 »
Have you tried playing with the brackets?
Plenty of reviewed ArmA missions for you to play

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Changing Group Leaders
« Reply #7 on: 15 Jul 2004, 16:25:14 »
Nowhere in the script is the original leader removed from _units

Try

_units = _units - [_leader,player]

instead of

_units = _units - [player]


Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Changing Group Leaders
« Reply #8 on: 15 Jul 2004, 17:05:28 »
Well that will mean that the original leader does not rejoin the group as an ordinary member.    

_units join grpNull

effectively means that the original group ceases to exist, which might create a waypoint problem.    

My theory is that it doesn't work because there aren't enough square brackets [ ].
Plenty of reviewed ArmA missions for you to play

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Changing Group Leaders
« Reply #9 on: 15 Jul 2004, 19:23:10 »
Sorry.  I misunderstood.  I thought the intention was for the origional leader to not be in the goup until after the action.

Would the waypoint problem be solved if:

_units = _units - [player]

came before

_units join grpnull
 
and not after

shadow99

  • Guest
Re:Changing Group Leaders
« Reply #10 on: 16 Jul 2004, 13:53:45 »
Uh... so what's the full script?

 :-\

Sorry, but I'm terrible with all this. Thanks for the help, though.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Changing Group Leaders
« Reply #11 on: 16 Jul 2004, 14:23:59 »
I have not tested it but try M21man's script except put the line:

_units = _units - [player]


before

_units join grpnull


I might get chance to look at this tonight

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Changing Group Leaders
« Reply #12 on: 16 Jul 2004, 14:46:13 »
If that doesn't work try:

_leader = leader (group player)
_units = units (group _leader)

_units = _units - [player]
_units join grpnull
_units join player
exit

Again - not tested.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Changing Group Leaders
« Reply #13 on: 16 Jul 2004, 19:22:45 »
OK.  I have tested the code in my post above and it seems to work.

Thanks to M21Man.  I just made a minor tweak to his code.
« Last Edit: 16 Jul 2004, 19:24:07 by THobson »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Changing Group Leaders
« Reply #14 on: 16 Jul 2004, 19:32:31 »
An update:  To change the leader to anyone you wish in the group, save the following as ChangeLeader.sqs


Code: [Select]
_newleader = _this select 0

_leader = leader (group _newleader)
_units = units (group _leader)

_units = _units - [_newleader]
_units join grpnull
_units join _newleader
exit

And then call:

[unitname] exec"ChangeLeader.sqs"

and this will change the leader to unitname.  It doesn't have to be you and it doesn't screw up the waypoints.  Though you will have to be careful of the waypoints if you become the leader.
« Last Edit: 18 Jul 2004, 07:54:32 by THobson »