OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: shadow99 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.
-
_leader = leader (group player)
_units = units (group _leader)
_units join grpnull
_units = _units - [player]
_group = group player
_units join _group
exit
Not guaranteed :P .
-
Being a n00b, what bits to I fill in? Just (player) and (group_leader)?
-
No editing should be necessary. Just try executing the script.
-
No dice. The leader says
"All follow 1!" (Himself)
"1, Ready!"
-
Bump
-
Have you tried playing with the brackets?
-
Nowhere in the script is the original leader removed from _units
Try
_units = _units - [_leader,player]
instead of
_units = _units - [player]
-
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 [ ].
-
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
-
Uh... so what's the full script?
:-\
Sorry, but I'm terrible with all this. Thanks for the help, though.
-
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
-
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.
-
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.
-
An update: To change the leader to anyone you wish in the group, save the following as ChangeLeader.sqs
_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.