Jump to content
Ulfgaar

Eject/GetOut codes and scripts - For paradrops and insertions over water.

Recommended Posts

Greetings everyone!

This is my attempt at making life somewhat easier. I am by no means a professional scripter, but after searching the web whide and far, i have come across quite a few things that works and stuff i've tweaked to my satisfaction.

The reason for why im making this, when there obviously are many other posts dealing with this, is because - none of them, had all i needed, in one post.

I was making a multiplayer mission which involved a group being paradropped from an C130J at 2000m, and a diver team that were to be inserted by a helicopter, hovering over water and dropping them out.

For the paradrop, i ended up using a script i found, which i will show you guys later. I can't take credit for making it, as i didn't, but i've tweaked it to my satisfaction. I cant remember where exactly i found it. If the owner of it finds this, please do mention your name and i'll give you credit for it.

For the divers drop into the sea, i've had to do ALOT of testing and searching till i findally came up with something that worked. Many of you would probably say that "Transport Unload" waypoint would do the trick, which it does to some point, but not completely.

For the paratrooper drop, this is what i've done.

I used the

functions to manually fly the airplane through the desied route. This is because at the current time, AI's will follow the contour of the landscape at any hight, which means that even on 2000m it will wobble around as it flies "over hills and valleys" below. You can use the <Plane/Chopper name> flyinheight <Desired Height> in the activation field of each waypoint, but that will still make the plane/helicopter act quite weirdly in my opinion. And again, the whole "following-the-contour" behaviour which all in all makes for bad immersion. What i learned from this is that the UnitCapture/UnitPlay functions is mainly a singleplayer thing. Its smooth running there. In multiplayer, it still works - but the plane acts like its having some really big desync problems. It still works, just not pretty. Sitting in first-person in the plane is recomended as you wont notice it too badly then.

Anyways, down to business. I used the codes for assigning group names to said groups i was using.

<GROUP> being the desired name for said group - this is placed in the group leaders init box.

<GROUP> = group this;

This places said <GROUP> into said <VEHICLE>. <VEHICLE> then being the name of the vehicle (your own choise). This is also placed in the group leaders init box.

{_x moveInCargo <VEHICLE>} foreach units <GROUP>;

Make an Eject.sqf file, and put this in - Place the file in your missions folder.

_group = _this select 0;
_vehicle = _this select 1;

if ( (typename _group != "GROUP") or (typename _vehicle != "OBJECT") ) exitwith {
hintSilent "Invalid Parameters parsed";
};

sleep 1;

{
       _x allowDamage false;
unassignvehicle _x;
_x action ["EJECT", _vehicle];
sleep 0.8;
       _X allowDamage true;
} foreach units _group;

Make a trigger where you want this script to be activated. Put this in the activation box.

This works very well for ejecting paratroopers (AI or Players alike) in a line after the plane (this ofc refering to the Eject.sqf file above).

_xhandle = [<GROUP>,<VEHICLE>] execvm "Eject.sqf";

For the divers team, i struggled alot. I made an invisible helipad on the location, 5 meters above the surface. I then set the helicopter with an "Transport Unload" waypoint onto/near the helipad. This would be enough i thought, but it didnt, because the "Transport Unload" waypoint would only eject the whole squad if it was purely AI's. If the group leader was a player, the player would get dropped, but the AI's would stay in till you gave the order of disembarking. If all slots were players with no other AI's - the chopper would just chuck out the leader, and immediately rise to such an altitude where the other players would get hurt when ejecting into the water.

This is the solution i ended up with:

At the same place as as the "Transport Unload" waypoint, with just 2-3 meters radius, i placed a trigger with this:

{_x action ["GetOut",<VEHICLE>]} foreach units <GROUP>; unassignVehicle <GROUP>;

This will chuck every AI/Player out at said location, no matter what, with no needs to give "disembark" orders.

Some extra info on these codes:

{_x action ["GetOut",<VEHICLE>]} foreach units <GROUP>; unassignVehicle <GROUP>;

{_x action ["Eject",<VEHICLE>]} foreach units <GROUP>; unassignVehicle <GROUP>;

The "GetOut" version, will throw out AI/Players of that group - no matter what, at any hight, not caring if they have parachutes or not. Therefor ideal for the task i needed done when it came to my divers.

The "Eject" version, will only throw out AI/Players IF they have parachutes. If they dont, it wont eject them.

I've not tested this very closely, but i think its because the "GetOut" command just throws them out no matter what, but they will not open parachutes, even if they have them (i think).

The "Eject" order will only work with parachutes, because its probably an actuall order to eject and open the parachute, which is why its probably better used if you want to chuck alot of AI's out of a moving plane at speed and have them open their parachutes. I might be wrong, but thats my theory.

Anyways, i hope this post helps anyone who's looking to do these spesific things.

And again, im not trying to step on anyones toes or take credit for other peoples work, i just try to place it all in one post directed at these two spesific ways of insertions.

Kind regards,

- Ulfgaar

Edited by Ulfgaar

Share this post


Link to post
Share on other sites

I am creating a mission with my brother. We both have our own squads. But we're stuck. Basically, I want to fly him to a point, and have him and his men jump out with a parachute. Now we can do that. He has to go to each of his men and change their inventory. Removes their backpack and adds a parachute. But when they all jump out, it's almost as if his men go wherever they want... How do we make them steer to a specific point and land there?

Share this post


Link to post
Share on other sites

Hey mlamp89!

Using the eject script should throw the squad out of the plane more or less in a line. The default AI opens the parachute at a given heigh automaticly and they fall fairly straight down to my knowledge (with some movement ofc). In my tests the AI seem to find you as a leader by themselves in time. So once on the ground, they will try to form up with you again (which any kind of paratroopers would do, as they wont be landing togther at the same spot as such).

You can possibly try giving them a waypoint command during flight, which they then "hopefully" will move to once they reach the ground - or possibly steer towards in their parachutes. I dont know this for certain, but its something i'd try if nothing else. My best advice here is to do some testing and see what happens.

Conserning that you and your brother need to manually "jump" into each AI in your squad to equip them with parachutes, i'd highly advice using preset loadouts which you can make in the "Arsenal". Equip the soldier with all the gear you want him to have, export the loadout (which will save it as code to your clipboard) and the paste it in the "init" box of the units in question. Once you save the mission then, the AI troops will spawn with the saved gear equiped. Its a nice way to save yourself alot of trouble with having to manually change between each AI soldier and manually equip the gear.

I am no professional scripter, but who knows - someone more competent than me might answer you here as well :)

Best of luck!

- Ulfgaar

Share this post


Link to post
Share on other sites
_xhandle = [<GROUP>,<VEHICLE>] execvm "Eject.sqf";
On 05/04/2015 at 0:59 AM, Ulfgaar said:

Greetings everyone!

This is my attempt at making life somewhat easier. I am by no means a professional scripter, but after searching the web whide and far, i have come across quite a few things that works and stuff i've tweaked to my satisfaction.

The reason for why im making this, when there obviously are many other posts dealing with this, is because - none of them, had all i needed, in one post.

I was making a multiplayer mission which involved a group being paradropped from an C130J at 2000m, and a diver team that were to be inserted by a helicopter, hovering over water and dropping them out.

For the paradrop, i ended up using a script i found, which i will show you guys later. I can't take credit for making it, as i didn't, but i've tweaked it to my satisfaction. I cant remember where exactly i found it. If the owner of it finds this, please do mention your name and i'll give you credit for it.

For the divers drop into the sea, i've had to do ALOT of testing and searching till i findally came up with something that worked. Many of you would probably say that "Transport Unload" waypoint would do the trick, which it does to some point, but not completely.

For the paratrooper drop, this is what i've done.

I used the

functions to manually fly the airplane through the desied route. This is because at the current time, AI's will follow the contour of the landscape at any hight, which means that even on 2000m it will wobble around as it flies "over hills and valleys" below. You can use the <Plane/Chopper name> flyinheight <Desired Height> in the activation field of each waypoint, but that will still make the plane/helicopter act quite weirdly in my opinion. And again, the whole "following-the-contour" behaviour which all in all makes for bad immersion. What i learned from this is that the UnitCapture/UnitPlay functions is mainly a singleplayer thing. Its smooth running there. In multiplayer, it still works - but the plane acts like its having some really big desync problems. It still works, just not pretty. Sitting in first-person in the plane is recomended as you wont notice it too badly then.

Anyways, down to business. I used the codes for assigning group names to said groups i was using.

<GROUP> being the desired name for said group - this is placed in the group leaders init box.

 


<GROUP> = group this;
 

 

This places said <GROUP> into said <VEHICLE>. <VEHICLE> then being the name of the vehicle (your own choise). This is also placed in the group leaders init box.

 


{_x moveInCargo <VEHICLE>} foreach units <GROUP>;
 

 

Make an Eject.sqf file, and put this in - Place the file in your missions folder.

 


_group = _this select 0;
_vehicle = _this select 1;

if ( (typename _group != "GROUP") or (typename _vehicle != "OBJECT") ) exitwith {
hintSilent "Invalid Parameters parsed";
};

sleep 1;

{
       _x allowDamage false;
unassignvehicle _x;
_x action ["EJECT", _vehicle];
sleep 0.8;
       _X allowDamage true;
} foreach units _group;
 

 

Make a trigger where you want this script to be activated. Put this in the activation box.

This works very well for ejecting paratroopers (AI or Players alike) in a line after the plane (this ofc refering to the Eject.sqf file above).

 


_xhandle = [<GROUP>,<VEHICLE>] execvm "Eject.sqf";
 

 

For the divers team, i struggled alot. I made an invisible helipad on the location, 5 meters above the surface. I then set the helicopter with an "Transport Unload" waypoint onto/near the helipad. This would be enough i thought, but it didnt, because the "Transport Unload" waypoint would only eject the whole squad if it was purely AI's. If the group leader was a player, the player would get dropped, but the AI's would stay in till you gave the order of disembarking. If all slots were players with no other AI's - the chopper would just chuck out the leader, and immediately rise to such an altitude where the other players would get hurt when ejecting into the water.

This is the solution i ended up with:

At the same place as as the "Transport Unload" waypoint, with just 2-3 meters radius, i placed a trigger with this:

 


{_x action ["GetOut",<VEHICLE>]} foreach units <GROUP>; unassignVehicle <GROUP>;
 

 

This will chuck every AI/Player out at said location, no matter what, with no needs to give "disembark" orders.

Some extra info on these codes:

{_x action ["GetOut",<VEHICLE>]} foreach units <GROUP>; unassignVehicle <GROUP>;

{_x action ["Eject",<VEHICLE>]} foreach units <GROUP>; unassignVehicle <GROUP>;

The "GetOut" version, will throw out AI/Players of that group - no matter what, at any hight, not caring if they have parachutes or not. Therefor ideal for the task i needed done when it came to my divers.

The "Eject" version, will only throw out AI/Players IF they have parachutes. If they dont, it wont eject them.

I've not tested this very closely, but i think its because the "GetOut" command just throws them out no matter what, but they will not open parachutes, even if they have them (i think).

The "Eject" order will only work with parachutes, because its probably an actuall order to eject and open the parachute, which is why its probably better used if you want to chuck alot of AI's out of a moving plane at speed and have them open their parachutes. I might be wrong, but thats my theory.

Anyways, i hope this post helps anyone who's looking to do these spesific things.

And again, im not trying to step on anyones toes or take credit for other peoples work, i just try to place it all in one post directed at these two spesific ways of insertions.

Kind regards,

- Ulfgaar

 

 

 

What is "_xhandle"?

I'm poor in scripting but started learning 3 days ago, Yey!

Share this post


Link to post
Share on other sites
6 hours ago, avengerarts said:

[code]_xhandle = [<GROUP>,<VEHICLE>] execvm "Eject.sqf";[/code]

What is "_xhandle"?

I'm poor in scripting but started learning 3 days ago, Yey!

Within the confines of this script it is the name the author uses to call the "Eject.sqf" script and parse  to it [<GROUP>,<VEHICLE>].

He could have called it _jimmy or _letsgo or _CallEjectScript. It's just a name. Note: having the "_" bit denotes it is for use inside this script only.

 

While it's a little more complex, see also my Simple ParaDrop script mentioned below. In it I comment a lot of lines telling you what they actually do. My script has also been extensively tested.

 

See also this thread for further scripting help.

 

Enjoy your new found programming skills.

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×