OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: greg147 on 29 Mar 2005, 10:36:50

Title: Leader leave group.
Post by: greg147 on 29 Mar 2005, 10:36:50
Hi all,

Bit of an easy question here. I have a group of soldiers, one of which is the player. When they enter a trigger, I want the leader to leave the group and follow his waypoints, and the player take over command of the group and follow different waypoints.

Can this be done  ???

Exactly like BIS did on the second Red Hammer campaign mission, where you have to capture the towns and airport. In the second town, your leader runs off and you become leader  ;)

I tried De-PBOing the mission, but I couldn't make any sense of what I found. :P
Title: Re:Leader leave group.
Post by: Blanco on 29 Mar 2005, 10:57:27
BIS did it probably with a join and lead waypoint.
Title: Re:Leader leave group.
Post by: 456820 on 29 Mar 2005, 11:01:51
im not sure but try this

leader_name join null

that should make the leader leave but im not sure if he will follow his waypoints
then for the leader take over there is a script in the beta test part
here it is

http://www.ofpec.com/yabbse/index.php?board=27;action=display;threadid=22167
made by blanco
Title: Re:Leader leave group.
Post by: THobson on 29 Mar 2005, 11:19:03
This is the final version

http://www.ofpec.com/editors/resource_view.php?id=770 (http://www.ofpec.com/editors/resource_view.php?id=770)

Blanco kindly gave me credit for some code I had that avoided a problem with the original.

To get the old leader to follow waypoints he will need to join another exisiting group.  If that is not possible give him some doMove instructions instead.
Title: Re:Leader leave group.
Post by: greg147 on 29 Mar 2005, 14:04:26
The scripts works fine, but when I try to get the leader to leave the group by using 'leader join null',  I get an error in game. Is there any other way to do it?
If I give the group a join and lead waypoint, will that just make the leader join the group and his old group continue without him?  ???
Title: Re:Leader leave group.
Post by: THobson on 29 Mar 2005, 14:15:07
It should be

unitname join grpNull

or

leader groupname join grpNull

leader is a reserved word that returns a value but you have to tell it leader of what.  Also it is grpNull not Null
Title: Re:Leader leave group.
Post by: macguba on 29 Mar 2005, 14:26:33
[leader groupname] join grpNull
Title: Re:Leader leave group.
Post by: THobson on 29 Mar 2005, 15:22:25
I am always forgetting those damn square brakets!!
Title: Re:Leader leave group.
Post by: greg147 on 29 Mar 2005, 19:45:45
OK, thanks  ;D

When I said 'leader', that was the units name  ;)
I should have said that before to avoid confussion.

Thanks for the help.
Title: Re:Leader leave group.
Post by: macguba on 29 Mar 2005, 21:14:20
Don't name anything with a word that appears in the game as a command or a variable.    So don't use "leader" for the name of a unit.     OFP will crash, burning the wires in your computer, which will explode the local electricity substation and burn down your house.  
Title: Re:Leader leave group.
Post by: macguba on 29 Mar 2005, 21:16:47
Probably.
Title: Re:Leader leave group.
Post by: Blanco on 29 Mar 2005, 21:17:44
 ;D