OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 456820 on 21 Dec 2005, 21:38:32

Title: all squads + soldiers in chopper
Post by: 456820 on 21 Dec 2005, 21:38:32
how do i check when all squads named (grpalpha, grpbravo and grpcharlie) are in their choppers named (uh601, uh602 and uh603) grpalpha has uh601, grpbravo has uh602 and you should work out which one grpcharlie has

anyway how do i check when all the soldiers of those 3 squads are in their designated chopper then set a variable to true ? (i can do the variable bit but not the first bit)

something like
_x in uh601 foreach units grpalpha
i havent tried it but i dont think its right so i dont see a point of trying

thanks
Title: Re:all squads + soldiers in chopper
Post by: Pilot on 21 Dec 2005, 22:19:46
I think you're on the right track.  Something like this should work:
Condition field of trigger:
Code: [Select]
"_x in uh601" foreach units grpalpha and "_x in uh602" foreach units grpbravo and "_x in uh603" foreach units grpcharlie
On Activation:
Code: [Select]
Variable=true
-Pilot
Title: Re:all squads + soldiers in chopper
Post by: 456820 on 21 Dec 2005, 22:22:31
hey thanks alot ill try that ASAP cheers

edit - just tried and i copied it into my trigger's condition field and got this error
"and: Type Nothing, Expected Bool"

any readon for that ?

i myself cant see anything wrong with the syntax
Title: Re:all squads + soldiers in chopper
Post by: The-Architect on 21 Dec 2005, 22:34:16
I think you're going to have to write a script.


EDIT: Maybe they need brackets like,

Not (me1 in Uh60)

I don't know, just a thought.
Title: Re:all squads + soldiers in chopper
Post by: 456820 on 21 Dec 2005, 22:40:38
cheers Architect ill have a go sometime cant now though but shall tomorow cheers
Title: Re:all squads + soldiers in chopper
Post by: Pilot on 21 Dec 2005, 23:22:37
...I just tested my code and it didn't work...strange.  I did find something that I know works, though.  In the On Activation field for the Get In waypoint for grpAlpha, enter:
GrpAlphaIn=true

Do this for the other groups in their Get In waypoints:
GrpBravoIn=true
GrpCharlieIn=true

Then, in a trigger, put the following in the Condition field:
GrpAlphaIn and GrpBravoIn and GrpCharlieIn

On Activation:
Variable=true

-Pilot
Title: Re:all squads + soldiers in chopper
Post by: macguba on 22 Dec 2005, 00:20:03
Count, dear boy, count.   What you need is count not forEach

"alive _x" count units grp1 == "_x in chopper1" count units grp1

or something along those lines.
Title: Re:all squads + soldiers in chopper
Post by: Pilot on 22 Dec 2005, 01:14:39
*casts a sullen look down at feet*
Yes, sir.

 ;D

Thanks for that, Macguba.  I had completely forgotten about count.  What would we poor editors do without you?

-Pilot
Title: Re:all squads + soldiers in chopper
Post by: 456820 on 22 Dec 2005, 09:20:40
ha ha indeed thanks alot for that Macguba ill try that out before solving the thread
cheers
Title: Re:all squads + soldiers in chopper
Post by: Baddo on 22 Dec 2005, 17:55:45
There is also a little helper for this kind of situations in the function library:

groupInVehicle (http://www.ofpec.com/editors/funcref.php?filter_func=73)

Title: Re:all squads + soldiers in chopper
Post by: 456820 on 22 Dec 2005, 19:11:36
cool thanks alot i dont really need it now but it could still come in handy
thanks everyone

topic solved