OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: bardosy on 31 Aug 2005, 08:15:36
-
Sorry for newby-question, but I can't find answer in my downloaded documentations.
How can I know, if a whole group is in a vehicle?
I have a trigger and I want put an expression in the Condition field, like
group(player) in heli1
or
units group(player) in heli1
^these doesn't work, just I want explain what is my question.
Finally I use: (u1 in heli1)and(u2 in heli1)and... where u1,u2,u3... are the names of group member.
It's works, but I feel there is some better solution.
-
count ({_x in vehicle_name} count units group group_name) == count units group group_name
syntax not guaranteed ::)
-
Thank you!!! I'll try it!!!
-
I thnk bedges meant:
{_x in vehicle_name} count units group_name) == count units group_name
That will work if you know the name of the vehicle. If you don't or if the group may be spread across different vehicles try:
{_x != vehicle _x} count units groupname
will return the number that are in any vehicle. So the test would then be:
{_x != vehicle _x} count units groupname == count units groupname
So many ways to do the same thing
-
There is now a function in the function library to do this checking. It can check if all group members are in any vehicle (not necessarily in the same vehicle), or it can check if all group members are in one specific vehicle.
Follow this link:
groupInVehicle (http://www.ofpec.com/editors/funcref.php?letter=G#groupInVehicle)
-
I thnk bedges meant:
{_x in vehicle_name} count units group_name) == count units group_name
Carefull now, don't wanna get a missing "(" error, you best close those parentheses ;)
-
True enough - sloppy cut and paste on my part. :-[ I got rid of 'count (' but neglected to get rid of the closing ')'. It should of course be:
{_x in vehicle_name} count units group_name == count units group_name
-
i should also put my hands up and admit my responsibility - they were after all my parentheses to begin with... :-[
-
yet again a correction, not exactly necessary, but possibly vital depending on the situation....:
{_x in vehicle_name} count units group_name == {alive _x} count units group_name
because if someone in the group dies, it might not register (and remove them from the group) until long after, but the whether they are alive (or dead) is always known
like i said, not absolutely necessary, but very good to have
-
Good catch. :thumbsup: It's missing things like this that causes those strange bugs we all struggle over.
EDIT:
On further thought should it be:
{(_x in vehicle_name) and (alive _x)} count units group_name == {alive _x} count units group_name
Just in case a dead loon in the vehicle gets counted?
-
didn't think of that, althought the chances of something like that are incredibly slim, but, better safe than sorry :P
-
Thanks for the correct answer guys!