OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Pr0ph3t on 23 Jul 2010, 09:11:23
-
Hi everyone,
I forgot that foreach loop to create groups.. ie foreach unit in group unit belong to group <groupname>
and also how to assign a unit as leader of the group.
I know I can just create a group with F2 or add soldiers and group them. But I need them to belong to a groupname so I can use it in scripts rather than single out every unit get it?
Its been a long while.. I can't find this anywhere on google I'm probably not using the proper keywords.
I wouldn't be surprised if its somewhere in the OFP section.. I think I remember asking this question like 10 million years ago
EDIT
~~~
lol I keep answering my own questions you guys are gonna think I'm schitzo... anyway atleast others will benefit from this..
So deep within the bowels of the internet I found the command :
This is how:
*********
In init: groupname = group this; //I know its in the comref but its not clear because it uses player/player as an example heh
Now how would I go about making this into a foreach loop for every unit in the group?
in my script...
So let's assume the leader of the group is called groupleader and the group's name is groupname
{_x group groupname} forEach units groupleader
is that it?
-
groupname = group this placed in the units init puts him and all units grouped to him in the group.
to use that group it would be
{_x setdamage 1} foreach units group groupname that would kill the group.
{_x allowdamage false } foreach units group groupname would make them invincible
It's up to you to decide what you do with them.