OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: mcnorth on 14 Mar 2007, 19:50:07

Title: Pass group name to script then getpos of the leader
Post by: mcnorth on 14 Mar 2007, 19:50:07
Can anyone tell me how to get the leader from a group after the group name has been passed to a script?

I'm trying to determine the distance between the player and an enemy group leader for spawning purposes. I want to work with the group name rather than the enemy leader name so that if the leader is killed the script will then work with the new leader.

Any tips are appreciated.

Thanks
Title: Re: Pass group name to script then getpos of the leader
Post by: bedges on 14 Mar 2007, 19:52:52
the command leader (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=l#leaderg) is probably what you're after.
Title: Re: Pass group name to script then getpos of the leader
Post by: mcnorth on 15 Mar 2007, 03:04:19
You're right but I get an error when I pass the group name to a variable in the script. It works if I use the group name (global variable) defined in the leader units init field but not with a local variable in the script.

ps - It looks like I unintentionally duplicated this post. I guess the first try, when everything froze up, went through after all. sorry about that.
Title: Re: Pass group name to script then getpos of the leader
Post by: h- on 15 Mar 2007, 08:08:48
Doppelganger.

Locking this one..