Jump to content
Sign in to follow this  
tryteyker

Eject Script

Recommended Posts

Hi,

I'm currently working on a mission where I have to insert a SpecOps team. When I approach the landing zone, they should eject. I am not inside the group, nor am I the leader of it. They are on their own, they have their waypoints. Everything works fine except the eject part.

I've been doing it step by step after Rommel's Eject tutorial.

My Eject.sqf:

_group = _this select 0;

_vehicle = _this select 1;

if ( (typename _group != "grpAlpha") or (typename _vehicle != "UAZ") ) exitwith {

hintSilent "Invalid Parameters parsed";

};

sleep 1;

{

unassignvehicle _x;

_x action ["EJECT", _vehicle];

sleep 0.5;

} foreach units _group;

SpecOps leader init line:

unit1 moveincargo UAZ; grpAlpha = group this;

The team got 4 units, each unit got a moveInCargo command in their init line.

The eject command is linked to a trigger, which activates when I approach the landing zone marked with smoke.

_xhandle = [grpAlpha,UAZ] execvm "Eject.sqf";

The group has a "Get out" waypoint, however, linking the eject command to that waypoint won't work.

So, what am I doing wrong? I really have no clue.

Share this post


Link to post
Share on other sites

My Eject.sqf:

_group = _this select 0;

_vehicle = _this select 1;

if ( (typename _group != "grpAlpha") or (typename _vehicle != "UAZ") ) exitwith {

hintSilent "Invalid Parameters parsed";

};

sleep 1;

{

unassignvehicle _x;

_x action ["EJECT", _vehicle];

sleep 0.5;

} foreach units _group;

So, what am I doing wrong? I really have no clue.

Remove RED operators and quotes (blue)

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

if ( ([s][color="Red"]typename[/color][/s] _group != [color="Blue"]grpAlpha[/color]) or ([s][color="Red"]typename[/color][/s] _vehicle != [color="Blue"]UAZ[/color]) ) exitwith {
hintSilent "Invalid Parameters parsed";
};

sleep 1;

{
unassignvehicle _x;
_x action ["EJECT", _vehicle];
sleep 0.5;
} foreach units _group;

Share this post


Link to post
Share on other sites

if ( (_group != "grpAlpha") or (_vehicle != "UAZ") ) exitwith {
hintSilent "Invalid Parameters parsed";
};

Like this?

Share this post


Link to post
Share on other sites
I would just get rid of that part.

Well it's actually a little training mission for me, so I can train quick insertion / extration as pilot.

So I can't really get rid of that part.

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

if ( ([s][color="Red"]typename[/color][/s] _group != [color="Blue"]grpAlpha[/color]) or ([s][color="Red"]typename[/color][/s] _vehicle != [color="Blue"]UAZ[/color]) ) exitwith {
hintSilent "Invalid Parameters parsed";
};

sleep 1;

{
unassignvehicle _x;
_x action ["EJECT", _vehicle];
sleep 0.5;
} foreach units _group;

I have done this now, however, it isn't working.

Edited by tryteyker

Share this post


Link to post
Share on other sites

Well it looks to me like your comparing grpalpha to grpalpha and uaz to uaz all the time because your passing the group through the call _xhandle = [grpAlpha,UAZ] execvm "Eject.sqf";

perhaps something like this

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

if ( (player in _vehicle) and (group player  != _group)  ) exitwith {	

hintsilent "Invalid Parameters parsed";
};


sleep 1;

{
unassignvehicle _x;
_x action ["EJECT", _vehicle];
sleep 0.5;
} foreach units _group;

I haven't test it , so it may not work or be what your after.

Share this post


Link to post
Share on other sites

Yeah, that's a lot of extra work for something that should be simple. F2k Sel's code is basically the "classic" version of this. Here's what I use to eject a group from whatever vehicle they are in.

Share this post


Link to post
Share on other sites

Actually I may have miss read his post and just the eject is failing, if that was the case then the problem lies with the trigger as it ejects fine for me.

Share this post


Link to post
Share on other sites

I've tried both scripts, the first script from F2k Sel, however no luck.

I still used the old init line for the "Get out" Waypoint (_xhandle = [grpAlpha,UAZ] execvm "Eject.sqf";).

After that, I tried kylania's script, but still nothing.

Basically, I got an invisible Helipad with white smoke as landing zone. I am the pilot, inserting that team. The teamleader got a "Get out" waypoint placed ontop of the Helipad, in the "On Act." field is this:

nul = [groupName] execVM "groupEject.sqf";

groupName is obviously grpAlpha.

Still, the group is not ejecting, and there's nothing coming from the teamleader.

When I join his team and give him a waypoint, it works fine, he says "Disembark" over the radio.

However, I cannot use it because I am planning to have a Co-Pilot that is under my command, and ArmA automatically ejects me when I am on the ground, together with the team.

Share this post


Link to post
Share on other sites

Are they actually landing? If so, you don't need a script for that or anything really. These eject scripts are used for paradrops usually.

Can you post the mission you have so far? Maybe something else isn't working here that's causing problems.

Share this post


Link to post
Share on other sites

place in the "ejecting" wp on act or in a trigger wich detects the precense of your vehicle.

it will eject all inside vehicle that is not in the same group as the pilot.

Its basically kylanias code, but altered to use only vehicle as parameter given, no need to name group for this, but ofc you need to name the vehicle and change the vehicleName for the one you use, also it will not work properly if you have multiple groups(not counting pilot group) inside vehicle and only one of them should paradrop in.

_null = vehicleName spawn {
if (isServer) then {
	_vehicle = _this;
	_grp = group (driver _vehicle);
	sleep (random 3);
	{
		if (!(_x in (units _grp))) then {
			unassignVehicle (_x);
			(_x) action ["EJECT", vehicle _x];
			sleep 0.4;
		};
	} foreach crew _vehicle;
};
};

Share this post


Link to post
Share on other sites

To answer kylania's question, yes, I'm landing on the ground, exactly on the waypoint, however they're not exiting the vehicle.

Demonized, I added the script, however, I got no clue what to add to the "On Act" of the WP.

this exec "Eject.sqf"

The example above isn't working, really.

Share this post


Link to post
Share on other sites

Demonized, I added the script, however, I got no clue what to add to the "On Act" of the WP.

this exec "Eject.sqf"

The example above isn't working, really.

first off, dont use exec for .sqf scripts, it has its limitations wich you need to be aware off, i do not know them all.

use execVM unless the poster specifically tells you to use exec.

as i said, i intended for you to name your vehicle and use that instead of vehicleName and paste the entire code into the on act field.

but since youre landing you dont need it, just use a transport unload wp, and make sure to use this if you start them off in the heli.

this assignAsCargo heliname; this moveInCargo heliname;

you can also use this to force them off from a on act field on a move wp:

{if (!(_x in (units (group driver)))) then {unassignVehicle _x}} foreach crew (vehicle this);

Edited by Demonized
spelling error in assignascargo fixed.

Share this post


Link to post
Share on other sites

You really should just have to give the group a GET OUT waypoint synchronized with the helo's TRANSPORT UNLOAD waypoint. I'm not sure why you need to script this and seeing the mission would help a lot more than code snippets and assumptions.

Share this post


Link to post
Share on other sites

I'm not sure if you are, but if your using ACE then the eject command will not work, I ran into this before scripting for a pilot check to fly heli's.

If your using ACE you need to call the ace eject script in place of the bis eject action. I'm on my phone or I would give you a link, but its in the ace documentation.

Edit: see post below for documentation. Thanks kylania :)

Edited by Riouken

Share this post


Link to post
Share on other sites

ACE stuff from Eject & HALO System:

Force a unit to eject, perhaps for a cutscene:

[_vehicle, _unit] execVM "x\ace\addons\sys_eject\eject.sqf";

Force a unit to use the Jump Out action - useful for starting a paradrop, for instance:

[_vehicle, _unit] execVM "x\ace\addons\sys_eject\jumpout.sqf";

Give the unit a parachute, move them up 800 meters, and start the skydive script with "Open Chute" action-menu option:

_unit addweapon "ACE_ParachutePack" or "ACE_ParachuteRoundPack";
_unit setPos [(position _unit select 0), (position _unit select 1), 800];
_unit execVM "x\ace\addons\sys_eject\jumpout_cord.sqf";

Share this post


Link to post
Share on other sites

Well, I'm sorry I did not mention I was using ACE.

I am trying to get the "Jump Out" command to work, however, it seems like if I either try this:

[Heli1, unit1] execVM "x\ace\addons\sys_eject\jumpout.sqf";

this:

[_Heli1, _unit1] execVM "x\ace\addons\sys_eject\jumpout.sqf";

or this:

Heli1, unit1 execVM "x\ace\addons\sys_eject\jumpout.sqf";

It says

Loca Variable in global Space

or,

Type script, expected Nothing.

Yeah, I should probably be ashamed of myself for not getting it to work, but I just started scripting.

I hope you can help me.

Share this post


Link to post
Share on other sites

It says

Loca Variable in global Space

or,

Type script, expected Nothing.

Yeah, I should probably be ashamed of myself for not getting it to work, but I just started scripting.

I hope you can help me.

I take it your doing this in a trigger.

You can not use local variables in trigger or object init fields in the editor.

The reason it is not working with your gloable variables either is you need to make sure you use a script handle in triggers or object inits as well.

example:

[color="Red"]myscrpthandle1 =[/color] [Heli1, unit1] execVM "x\ace\addons\sys_eject\jumpout.sqf";

Edited by Riouken

Share this post


Link to post
Share on other sites

I am using the [Heli1, unit1] execVM "x\ace\addons\sys_eject\jumpout.sqf";

in the "On act" field of the "Get out" waypoint of the team.

Share this post


Link to post
Share on other sites

yeah, forget all the scripts and ACE and all of that. You just need this:

{unassignVehicle _x;} forEach units Gruppe1; commandGetOut units Gruppe1;

I changed your mission for you to do it this way. Removed all the GET IN and GET OUT stuff. There's just a trigger that's 1000m radius that checks for the vehicle of the player. Once there it kicks off the smoke grenade (which was burning out by the time I got there before) tells the player to look for the smoke and tells the team to get out. Once you land and stop they'll hop out and move to their first MOVE waypoint.

Share this post


Link to post
Share on other sites

It works fine now, thanks to kylania.

Now I need to work on the extraction part.

I guess this can be locked.

//Edit:

Another question.

If I want a helicopter to get "shot" and go down, what should I do?

unit setDamage 0.5; unit setFuel 0;

The code above isn't realistic enough, as the rotorwill slowly stop working, just if I'd cut the engine.

I want it to go down quickly, but it shouldn't explode.

Edited by tryteyker

Share this post


Link to post
Share on other sites

If you need to actually watch it crash, you could combine a tail rotor failure with fuel leak like this:

unit setHit ["mala vrtule", 1]; unit setFuel 0;

It might still crash and explode though.

To make it not explode you'd need to prevent damage till it's stopped or something really. Or do a lot of smoke and fire tricks. ;) It all really depends on how much the player will actually see, or needs to see, of the crash.

Share this post


Link to post
Share on other sites

Are you flying it? BAF starts out with that kind of thing. Unfortunately I deleted the PM from the dev that explained how they did it and the PBOs are still encrypted so we can't pull them apart. :(

Basically they fired a missile at the helo, simulated some damage, stopped anymore damage, landed the helo via AI autorotation, then blacked the screen out and replaced it all with a different helo already on the ground damaged.

If you're actually the pilot during this all though, it gets more complicated. :) You could probably prevent crash damage after the hit, maybe.

Share this post


Link to post
Share on other sites

Yeah, I am the pilot, and basically the rotor should "fall off", or atleast stop working.

Nothing else.

Then, a squad would come and safe me and the attack goes on.

setFuel takes way too much time, and setDamage 1 is way too much.

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
Sign in to follow this  

×