Rommel 2 Posted June 28, 2009 (edited) There have been a tonne of threads, which seem to keep getting posted over and over and over in regards to this issue. So how about we put all the questions in one thread and maybe sticky it so we have a more dynamic range of issues in this forum. Needed VariablesThe <VEHICLE> must be defined in the editor by editing the placed vehicles name. A coding example (if the unit was dynamically made) would be to set the vehicle to a global variable. vehicleAlpha = "UAZ" createvehicle [0,0,0]; The <GROUP> must be defined prior to the script running and can be defined via the following code (can be placed in the group leaders initialization line of the group leader): grpAlpha = group this; Force EmbarkTo force embark a group into a vehicle use this code: {_x moveInCargo <VEHICLE>} foreach units <GROUP>; Force EjectTo force eject a group out of a vehicle use this code: _xhandle = [<GROUP>,<VEHICLE>] execvm "Eject.sqf"; Eject.sqf _group = _this select 0; _vehicle = _this select 1; if ( (typename _group != "GROUP") or (typename _vehicle != "OBJECT") ) exitwith { hintSilent "Invalid Parameters parsed"; }; sleep 1; { unassignvehicle _x; _x action ["EJECT", _vehicle]; sleep 0.5; } foreach units _group; Optional Safety height function (copy and paste after the _vehicle declaration in eject.sqf): _height = (position _vehicle) select 2; if ( _height < 100 ) exitwith {hintsilent format ["%1, the %2 height is below 50m (current height: %3), unsafe to eject.", name player, typeOf _vehicle, _height]}; The <GROUP> and <VEHICLE> must be defined prior for them to be correctly parsed to the function; if your unsure how to do this, either read up or check the BIKI or UTSE. Relevant BIKI's: http://community.bistudio.com/wiki/group http://community.bistudio.com/wiki/vehicle http://community.bistudio.com/wiki/Variables http://community.bistudio.com/wiki/action http://community.bistudio.com/wiki/moveInCargo http://community.bistudio.com/wiki/assignAsCargo Note: Excluded any mention of HALO until some issues are resolved into how it works with AI. Theres enough examples around already for simple player HALO jumps, so just UTSE. Edited June 28, 2009 by Rommel Share this post Link to post Share on other sites
Brute 11 Posted June 28, 2009 I have put the .sqf file in the missions folder, added _xhandle = [s1,UH1YA] execvm "Eject.sqf"; in the get out waypoint however it doesnt see to be working? Share this post Link to post Share on other sites
Rommel 2 Posted June 28, 2009 (edited) Is S1 the name of your group or the name of your unit? Is UH1YA the name of your vehicle? Double check these variables, they are most commonly the error when executing scripts. The new code for eject.sqf (added type checks) will verify if your parsing the correct parameters to the script. Edited June 28, 2009 by Rommel Share this post Link to post Share on other sites
Brute 11 Posted June 28, 2009 (edited) I might not have set the variables correctly, would you mind telling me how to set them so i know if i have done it correctly or not? I did what you said in the first section of your thread "S1 = group this;" etc. I really appreciate your help. Edited June 28, 2009 by Brute Share this post Link to post Share on other sites
Rommel 2 Posted June 28, 2009 (edited) Your mission.sqm seems ok, but maybe try without re-using the variable. {_x moveincargo UH1YA} foreach units S1; GS1 = group this; and _xhandle = [GS1,UH1YA] execvm "Eject.sqf"; Otherwise, if its a GET-OUT waypoint, it won't fire the onactivated until EVERYONE is disembarked, perhaps make it fired via a trigger that checks helicopter height. This could be why you don't see it working. Edited June 28, 2009 by Rommel Share this post Link to post Share on other sites
Brute 11 Posted June 28, 2009 I will give that a try later on today and hope it works :p A couple of other things have been annoying me as well concerning the UH-1Ys, at the start of the mission they arent moving, they all simply hover for 10 seconds and then start going to the waypoint? Also when they drop off infantry some of the UH-1Ys leave extremely quickly after the troops get out however others seem to hover there for 15-20s before leaving? Share this post Link to post Share on other sites
Rommel 2 Posted June 28, 2009 This is just default ArmA/2 way points for you, its generally what they do in their spare time while calculating a flight path. Make sure your way points aren't too far away, if you have the first way point over 2clicks away, they will pause for a small while. In regards to the after troop hover, unless you have a timeout delay, try checking the next way point's distance, otherwise that may not be easily changed. -------- The solution to your mission was to add a move way point, with the condition set to: (position UH1YA select 2) < 5 Then have the group and helicopter execute the code, that way it would only eject them at a suitable height. If you want the helicopter to reach this height, try adding this in a nearby way point and make sure the speed is set to limited in a clear area. UH1YA flyInHeight 4 Relevant BIKI: http://community.bistudio.com/wiki/position http://community.bistudio.com/wiki/flyInHeight http://community.bistudio.com/wiki/Waypoints Share this post Link to post Share on other sites
Tajin 349 Posted June 29, 2009 Please also note "assignAsCargo" in your HowTo so I don't have to mention it a hundred times more. Share this post Link to post Share on other sites
Rommel 2 Posted June 29, 2009 (edited) I already placed it in the relevant BIKI notes, they should have the initiative to read about it. ;) Edited June 29, 2009 by Rommel Share this post Link to post Share on other sites
manzilla 1 Posted June 30, 2009 Great idea for a post. Thanks. It's too bad people won't use the search function before opening a thread just to ask a question that has been asked and answered multiple times. Often times I've seen the existing thread just below a new one. Silly stuff. Anyway thanks again for starting this useful thread. :) Share this post Link to post Share on other sites
saintaw 0 Posted June 30, 2009 (edited) Hiya, Thank you for this, it helped a great lot! I have a problem: Most of the time, when jumping out of a C130, most of my men die or get injured. It isn't a height problem (height is set at 190 meters ATM)...and reading the other thread that mentioned chute collision, I upped the delay in the loop a little (0.5 to 0.9). Death, Injuries are random though. Any idea what this might be caused by? The Mission (zip) Edited June 30, 2009 by saintaw Share this post Link to post Share on other sites
Rommel 2 Posted June 30, 2009 This is currently an ArmA2 bug, the only way to stop it would be to maybe have a damage check before and after (assuming they weren't shot) to reset their damage to 0. Good to see this thread is of use. Share this post Link to post Share on other sites
Lokai 10 Posted July 2, 2009 Hey im trying to put units inside a boat, so I can make a beach assault mission, and im trying to understand what you wrote about the force embark..but were would that go? I am a super noob, so sorry if my lack of modding knowledge is offensive, but is their some editing tool other than just opening up edit unit? I set each unit in the squad to *in cargo* and I named the squad A1, and I named the boat R1 but I need to put that in the initialization box? Anyways, if you could explain it to a second day editor of this game with no experience besides operation flashpoint, and only simple stuff, I would greatly appreciate it. Share this post Link to post Share on other sites
zippers 10 Posted July 3, 2009 Hi, thanks for this it really helped me, i'm still having a problem still though. In the mission i'm doing i've got the player who is the group leader. His intialization is (the heli is called Mi8): groupBeta = group this; {_x moveInCargo Mi8} foreach units groupBeta; groupBeta assignAsCargo Mi8 then Mi8 has a few move waypoints and then the one i want to unload at. I have this waypoint as a move waypoint although i've tried it as unload and transport unload. And i have this intialisation (the Eject.sqf is the same as the one on the first page without the height check, although i tried it with it as well): Mi8 FlyInHeight 335; _xhandle = [groupBeta,Mi8] execvm "Eject.sqf"; and using various combinations of the things above i get can the helicopter to descend and then have my group leader get out or the whole team can parachute out. When i actually want the helicopter to descend to near the ground and the whole team jump a few feet. How can I acheive this? Should the waypoints be set for the team leader? I'd appreciate any help, thanks. PS the helicopter isn't part of the group if that makes a difference? Share this post Link to post Share on other sites
SAS 0 Posted July 5, 2009 Ok I am sure I have done something stupid but I can't see what so hopefully someone can assist. I have used the following code recon1 = group this; {_x moveincargo heli1} foreach units group recon1; however the team are outside the chopper when you start the mission, if I use the code {_x moveincargo heli1} foreach units group recon1; and name the leader as recon1 then it works, however when it comes time to disembark from the landed helo only the leader is kicked out the rest stay put, even when using the eject script. Any thoughts on what I have done wrong? Share this post Link to post Share on other sites
Ghost 40 Posted July 5, 2009 Ok I am sure I have done something stupid but I can't see what so hopefully someone can assist.I have used the following code recon1 = group this; {_x moveincargo heli1} foreach units group recon1; however the team are outside the chopper when you start the mission, if I use the code {_x moveincargo heli1} foreach units group recon1; and name the leader as recon1 then it works, however when it comes time to disembark from the landed helo only the leader is kicked out the rest stay put, even when using the eject script. Any thoughts on what I have done wrong? delete group {_x moveincargo heli1} foreach units recon1 Share this post Link to post Share on other sites
SAS 0 Posted July 5, 2009 thanks, they are now in the chopper but they still do not eject automatically even using the eject script if I change the insertion from a Chopper to a boat, using the same code it works fine. Share this post Link to post Share on other sites
Ghost 40 Posted July 5, 2009 try this got to ajust names and such. Put in unload, or transport unload waypoint... experiment {doGetOut _X} forEach units groupname; {unassignVehicle _x} forEach units groupname; Share this post Link to post Share on other sites
Rommel 2 Posted July 5, 2009 thanks, they are now in the chopper but they still do not eject automatically even using the eject script if I change the insertion from a Chopper to a boat, using the same code it works fine. Whats the waypoint / trigger that sets off the script, the script will work fine, but perhaps your helicopter is never reaching the event. Share this post Link to post Share on other sites
SAS 0 Posted July 5, 2009 I am using a Transport Unload (also tried a Unload one) there is an invisable H which the chopper is landing on but no matter what code I try I am the only one ejected, I have to use command 4-1 to get the team out, once they disembark the chopper takes off again. and flys the rest of its waypoints. Share this post Link to post Share on other sites
KMK24 10 Posted July 6, 2009 (edited) Is there a way to keep AI units from disembarking too early? I'm tryin to make amphibious landing mission where AI tends to eject units to water far from the beach. Edited July 6, 2009 by KMK24 typo Share this post Link to post Share on other sites
wiggum2 31 Posted July 10, 2009 Sorry, i dont get it to work... :( I Have a MP mission. I and another player have the Group Name "Marine1". The Helicopter has the Name "h1". At start the players are allready in the Helicopter. The Helicopter fly to a few wapoints and should then get the 2 Players out and fly to another waypoint. What do i do wrong ? I have the Eject.sqf I have a Waypoint near the dropzone with flyhight 4 and then another movewaypoint with Condition =(position UH1YA select 2) < 5 OnActive =_xhandle = [GS1,UH1YA] execvm "Eject.sqf"; Share this post Link to post Share on other sites
Starlight 10 Posted July 11, 2009 (edited) Sorry, i dont get it to work... :(I Have a MP mission. I and another player have the Group Name "Marine1". The Helicopter has the Name "h1". At start the players are allready in the Helicopter. The Helicopter fly to a few wapoints and should then get the 2 Players out and fly to another waypoint. What do i do wrong ? I have the Eject.sqf I have a Waypoint near the dropzone with flyhight 4 and then another movewaypoint with Condition =(position UH1YA select 2) < 5 OnActive =_xhandle = [GS1,UH1YA] execvm "Eject.sqf"; Should it not read: OnActive =_xhandle = [Marine1,h1] execvm "Eject.sqf"; then it should work I also have a question- I can get the Eject script to work, but not trigger when I want to on my mission. I have a Reinforcements script that creates a Driver for and empty vehicle and a squad to transport, they get in, then the vehicle drives to a "TR UNLOAD" waypoint in the script. I am unable to get the Eject script to then force the Squad out once the vehicle has reached this waypoint :mad: My Reinforcemnt script is shown below _GroupDriver1 = CreateGroup East;_unit = _GroupDriver1 createUnit ["RU_Soldier_Crew", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"]; _unit moveInDriver Trans1; GroupSquad1 = CreateGroup East; _leader = GroupSquad1 createUnit ["RU_Soldier_SL", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"]; _leader moveInCargo [Trans1, 0]; _leader = assignedVehicle Trans1; _unit = GroupSquad1 createUnit ["RU_Soldier_MG", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"]; _unit moveInCargo [Trans1, 0]; _unit = assignedVehicle Trans1; _unit = GroupSquad1 createUnit ["RU_Soldier_AT", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"]; _unit moveInCargo [Trans1, 0]; _unit = assignedVehicle Trans1; _unit = GroupSquad1 createUnit ["RU_Soldier_LAT", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"]; _unit moveInCargo [Trans1, 0]; _unit = assignedVehicle Trans1; _unit = GroupSquad1 createUnit ["RU_Soldier_Marksman", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"]; _unit moveInCargo [Trans1, 0]; _unit = assignedVehicle Trans1; _unit = GroupSquad1 createUnit ["RU_Soldier_MG", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"]; _unit moveInCargo [Trans1, 0]; _unit = assignedVehicle Trans1; _unit = GroupSquad1 createUnit ["RU_Soldier_LAT", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"]; _unit moveInCargo [Trans1, 0]; _unit = assignedVehicle Trans1; _unit = GroupSquad1 createUnit ["RU_Soldier_AR", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"]; _unit moveInCargo [Trans1, 0]; _unit = assignedVehicle Trans1; _unit = GroupSquad1 createUnit ["RU_Soldier_AR", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"]; _unit moveInCargo [Trans1, 0]; _unit = assignedVehicle Trans1; _unit = GroupSquad1 createUnit ["RU_Soldier_GL", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"]; _unit moveInCargo [Trans1, 0]; _unit = assignedVehicle Trans1; _unit = GroupSquad1 createUnit ["RU_Soldier_GL", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"]; _unit moveInCargo [Trans1, 0]; _unit = assignedVehicle Trans1; _unit = GroupSquad1 createUnit ["RU_Soldier_AR", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"]; _unit moveInCargo [Trans1, 0]; _unit = assignedVehicle Trans1; wp1 = _GroupDriver1 addWaypoint [(getmarkerpos "Squad1Out"), 0]; wp1 setWaypointSpeed "NORMAL"; wp1 setWaypointType "TR UNLOAD"; wp1a = GroupSquad1 addWaypoint [(getmarkerpos "Squad1Out"), 0]; wp1a setWaypointSpeed "NORMAL"; wp1a setWaypointType "GETOUT"; _xhandle = [GroupSquad1,Trans1] execvm "Eject.sqf"; _leader = leader GroupSquad1; [_leader,"TaskB1"] execVM "ups.sqf"; Edited July 11, 2009 by Starlight Share this post Link to post Share on other sites
shanawa 10 Posted August 25, 2009 So I have a mission that at the end of it I want to put the squad into a cargo hold. The problem I have is if they are in a current vehicle it wont move them and the other problem is there are many vehicles that they could be in when the trigger is activated. The only thing I can think of is to have each player eject from every single vehicle. Is there an easier way like an eject all or something? Share this post Link to post Share on other sites
shuko 59 Posted August 25, 2009 Just use: _x action ["EJECT", vehicle _x]; Instead of using the name of the vehicle: _x action ["EJECT", _vehicle]; That way you can foreach through all your units without having to worry about which vehicle they are in. Share this post Link to post Share on other sites