OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: MI_Fred on 11 Sep 2002, 14:50:48

Title: Control current leader
Post by: MI_Fred on 11 Sep 2002, 14:50:48
Controlling the current leader... doesn't that sound easy!
But after struggling at it for a day and searching the faq another half it isn't.

Here's the prob. I have scripted waypoints for a squad. The squad moves alright into designated positions until 1 of the following happens:
1) Enemy is sighted and the squadleader sh*ts in his pants
2) Enemy kills the squadleader and the new squadleader does no.1) and DOES NOT MOVE!
;D

They seize movement completely. This only seems to happen when scipting waypoints with Move or doMove commands.
I've used this neat method:
[para1,dwp1,dwp2,dwp3] exec "infwps.sqs"
and then call (the squadleder) para1: _grp
and waypoints: dwp's   _wp's
and make him move like this:

_grp move getpos _wp2
_grp setformation "ECH RIGHT"

@ unitready _grp
_grp setcombatmode "BLUE"
_grp setbehaviour "COMBAT"
_grp sideChat "Ok Echo holds fire until we can take them with 1 shot. over"
_grp setdir 330

@ _grp distance su1 <= 170
_grp setcombatmode "YELLOW"

@ supg
_lgrp = leader _grp
_lgrp domove getpos _wp3
_lgrp setbehaviour "AWARE"

By the time the variable "supg" is true, the squads original leader is usually dead. So now the 1 who's taken command should be "leader _grp". Doesn't work. The new leader cannot be called in a script with the same name?

So, how do I command the current leader?

Walker, way off :-\. But so am I. this should be on another board...
Title: Re:Control current leader
Post by: walker on 11 Sep 2002, 17:32:38
Hi MI_Fred

For control of multiple squads you need Command Engine 2

As to control of the leaders of those squads how much do you want to micro-manage them?

You may want to look here
http://www.thechainofcommand.com/graphic/ (http://www.thechainofcommand.com/graphic/)

and the forum

http://www.forum.thechainofcommand.net/ (http://www.forum.thechainofcommand.net/)

If you aske your question there it may be possible to answere dome of it

Kind regards Walker
Title: Re:Control current leader
Post by: Sui on 12 Sep 2002, 10:28:10
To get the current leader, use: (leader group).

Don't make it a variable, as then it will choose the leader at the time the variable is selected. So instead of:

_lgrp domove getpos _wp3

You would want to use:

(leader _grp) domove getpos _wp3

However that will only move one unit... to move the whole group try:

_grp move getpos _wp3

Failing that use walker's excellent command engine ;D
Title: Re:Control current leader
Post by: MI_Fred on 12 Sep 2002, 21:07:08

Don't make it a variable, as then it will choose the leader at the time the variable is selected. So instead of:

_lgrp domove getpos _wp3

now I'm using

(leader _grp) move getpos _wp3
and _grp is [[group para1,ewp1,ewp2,ewp3] exec "infwps.sqs"

and I wonder if even that is wise if u say the commands I issue will only affect the guy who was the leader then!  ;D

So should I write this every time:
(leader group para1) move getpos _wp3

:o

eehh :-\, it doesn't work even that way. I'm missing something here. Seriously, how can u ever script wp's if this doesn't work.

Title: Re:Control current leader
Post by: MI_Fred on 13 Sep 2002, 02:37:25
Let's start theoretisizing here...

If I used a script with a loop:

#loop1
ECHO1 = leader group para1

? endmiss : goto "end"
~1
goto "loop1"

#end
exit


wouldn't that take the variable at 1 second intervals so I can use ECHO1 in the above scripts or just repeat to the game that the guy who was the current leader when this script was executed called ECHO1?

Title: Re:Control current leader
Post by: Sui on 13 Sep 2002, 07:53:55
The syntax is:

group move position

So you could probably forget about the (leader... ) thing and just put _grp or para in ;)

As far as I know, the leader command will return the current leader of the group. Just use:

leader para1

rather than putting leader group para1...
See if that puts you any closer to being where you want to be ;D
Title: Re:Control current leader
Post by: MI_Fred on 15 Sep 2002, 02:07:55
Duud, u left out 1 vital bit:
charlie = group this
in the init... ;D

Now it works. It actually was in the faq. Thx Artak for pointing it out. All I needed was to type in 'a' and search in 'basic enhancements'....man! too close, jeez.

Thanks for the help!