Home   Help Search Login Register  

Author Topic: Group in UH60  (Read 4629 times)

0 Members and 1 Guest are viewing this topic.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Group in UH60
« on: 08 Jun 2007, 19:03:54 »
Ok, I want some code which will check if my entire group is in a UH60.

I tried,
Code: [Select]
(mygrp in uh60)
but it didn't work. What syntax should I use?

Right now the check is done in a trigger but I can easily write a script if needs be.

P.S. my group is called mygrp and the blackhawk is called UH60.
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Group in UH60
« Reply #1 on: 08 Jun 2007, 20:32:43 »
Code: [Select]
({_x in myHeli} count units myGrp) >= ({ alive _x} count units myGrp)
« Last Edit: 08 Jun 2007, 23:56:41 by Mr.Peanut »
urp!

Offline DucusSumus

  • Members
  • *
  • I'm a llama!
Re: Group in UH60
« Reply #2 on: 08 Jun 2007, 21:51:09 »
You don't want to use crew.  That will return an array with only the driver and first gunner.  Other than that, Mr. Peanut's code should work.

Alternatively, you could just use this function: http://www.ofpec.com/ed_depot/the_files/OFPResources/functions/groupInVehicle.sqf
« Last Edit: 08 Jun 2007, 21:54:28 by DucusSumus »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Group in UH60
« Reply #3 on: 08 Jun 2007, 23:58:09 »
Ack. Thanks for the catch ducus. Have fixed above and shame on me for not knowing about that function!
urp!

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: Group in UH60
« Reply #4 on: 09 Jun 2007, 01:27:59 »
How do I call this and what bits do I need in my .sqf for just the specific vehicle part?
« Last Edit: 09 Jun 2007, 01:47:13 by The-Architect »
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Group in UH60
« Reply #5 on: 09 Jun 2007, 02:03:03 »
My snippet should work....

If you want to use the function then in your init.sqf:
Code: [Select]
groupInVehicle = compile preprocessFile "groupInVehicle.sqf";
To call the function for a group and vehicle:
Code: [Select]
[myGroup, myVehicle] call groupInVehicle
If you do not specify a vehicle the function checks to see if all units are in any vehicles:
Code: [Select]
[myGroup] call groupInVehicle
The function returns true or false, so you can simply put that snippet in the Condition for a trigger.
« Last Edit: 09 Jun 2007, 02:04:39 by Mr.Peanut »
urp!

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: Group in UH60
« Reply #6 on: 09 Jun 2007, 02:39:09 »
Nope, I can't get my head around it.

Is it possible that you or somebody could do a small sample mission where a Helo picks up a group of guys?
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Group in UH60
« Reply #7 on: 09 Jun 2007, 03:37:10 »
urp
urp!

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Group in UH60
« Reply #8 on: 09 Jun 2007, 08:31:10 »
You don't want to use crew.  That will return an array with only the driver and first gunner.
Nope, not entirely true.
Crew will return everybody inside the vehicle, it returns them in order of [commander(if available),diriver,gunner(if available),cargo1,cargo2,...cargoN]..

If you think I'm wrong, test it ;)


@Archy, it's quite simple actually..

Put up a trigger, size 0/0
Condition: call {{_x in uh60} forEach (units mygrp)}

Just tested that myself and it works just fine..

No need for scripts nor functions (didn't check Mr.Peanut's sample)...
« Last Edit: 09 Jun 2007, 08:43:41 by h- »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline DucusSumus

  • Members
  • *
  • I'm a llama!
Re: Group in UH60
« Reply #9 on: 09 Jun 2007, 09:51:00 »
I believe you, h-.  Biki must have had it wrong then.  Either way, in by itself will work. 

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Group in UH60
« Reply #10 on: 09 Jun 2007, 09:59:53 »
There's a slight 'feature' in the crew command though, the 2nd 'door gunner' seems to be returned as cargo..

This is what the crew 'prints' with a ungrouped UH60
Quote
[uh60d,uh60g,WEST 1-1-A:3]
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: Group in UH60
« Reply #11 on: 09 Jun 2007, 17:01:42 »
Ok, the small script line worked. The Helo jumped up and landed about 50m away after I ordered my guys to get in but I'll accept that. Much as it pains me.

I'm just glad they are almost doing as they're told now. Cheers fellas.

I'll lave this open in case someone figures out a way to stop the chopper taking off and landing again after the getin order.
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Group in UH60
« Reply #12 on: 09 Jun 2007, 19:37:02 »
I tested crew last night, and it did not return the units in cargo. It may have in OFP, but not in ArmA. The units were in their own group. Someone is welcome to prove me wrong. Post your mission demo that does so.

I guess the second door gunner would also not be returned by the gunner command. Someone put in a request for a gunner2 command.
« Last Edit: 09 Jun 2007, 19:39:04 by Mr.Peanut »
urp!

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Group in UH60
« Reply #13 on: 09 Jun 2007, 20:05:15 »
Quote
it did not return the units in cargo
That's strange because when I tested this just before I made my post the hint output was mile long.
And still is.. Unless the chopper had 9 additional gunners that must be the cargo listed there.. ::)

Even the line unitName in (crew chopper) returns true after the group has boarded the chopper as cargo.

I have now tested this 80 times and it has worked each time so it must be your tests that were faulty.. :dunno:

Quote
The units were in their own group
So? ???


My test mission attached.
Radio 0-0-1: displays hint format ["%1",crew chopper],set to repeatedly
Radio 0-0-2: Teleports the group into the chopper (moveInCargo)
Radio 0-0-3: Makes the chopper pick up the group (with the amazing OFP/ArmA style)

And in each case every single soldier is returned in the hint output.
when the leader is in the crew (as cargo) of the vehicle a global chat is displayed.
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Group in UH60
« Reply #14 on: 09 Jun 2007, 22:51:11 »
No problem. It's funny cause on BIS forums I placed code using crew and was told I was stewpid, so I did a quick test and thought I was. Now I know I was not stewpid then, just when I tried my test. Ahhhh. wait a sec.

I used unit inits to move into cargo i.e. in leader's field {_x moveInCargo myHeli} forEach units group this
and put the hint display in the player's init.  Maybe the hint processed first?

In any event, I much prefer being stewpid here than on BIS forums; I am happy to know some other dumb love there was wrong when calling me wrong when I was right. Right?
urp!