OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: The-Architect 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,
(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.
-
({_x in myHeli} count units myGrp) >= ({ alive _x} count units myGrp)
-
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
-
Ack. Thanks for the catch ducus. Have fixed above and shame on me for not knowing about that function!
-
How do I call this and what bits do I need in my .sqf for just the specific vehicle part?
-
My snippet should work....
If you want to use the function then in your init.sqf:
groupInVehicle = compile preprocessFile "groupInVehicle.sqf";
To call the function for a group and vehicle:
[myGroup, myVehicle] call groupInVehicle
If you do not specify a vehicle the function checks to see if all units are in any vehicles:
[myGroup] call groupInVehicle
The function returns true or false, so you can simply put that snippet in the Condition for a trigger.
-
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?
-
urp
-
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)...
-
I believe you, h-. Biki must have had it wrong then. Either way, in by itself will work.
-
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
[uh60d,uh60g,WEST 1-1-A:3]
-
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.
-
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.
-
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:
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.
-
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?
-
Maybe the hint processed first?
That might be possible..
I am happy to know some other dumb love there was wrong when calling me wrong when I was right. Right?
Quaranteed satisfaction :D
I was just a bit bafled about what you said because I just saw it working..
I already started to think whether the command was fixed in the fixed 1.07 beta version or something.. :P
-
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.
u cud remove da chopers fuel... nd add it after deyre in
LCD OUT
-
I'm having trouble again.
I got to the end of my mission and called for extraction and the helo took twice as long to arrive this time, and when it did, it landed 500m away and the crew jumped out. Then they got back in, flew to me and then just sat there doing nothing. Grr.
-
Maybe you should have taken a bath
-
Peanut, even if you're in the staff that doesn't mean you're allowed to spam :cop:
@Architect
Does that happen every single time?
Does it happen with the latest version of the game (1.08)?
-
dunno about 1.08, will check on the morrow.
-
Nope, still being a pain. This time it went off to target bad guys even though it was set to careless.
-
archie, even if you're in the staff that doesn't mean you're allowed to double post :cop:
tsk tsk...
-
Ah. I always thought a double post was when you somehow had two posts the same one after the other. Like you see now and again in forums. I didn't know, that ::) was one too. Soz.
Anyway. I decided to forget trying trial and error and have been having a go at updating SnYpir's extraction scripts. Really all I've had to do so far is edit the mission.sqm so that ArmA recognises the demo mission. I'll post the updated demo mission later so others can use it for ArmA.