Jump to content

Photo
- - - - -

Eject Script


  • Please log in to reply
27 replies to this topic
Thread Starter
CER10TY
CER10TY

    Master Gunnery Sergeant

  • Members
  • 1084 posts

  • Joined: 20-November 2010

Posted 30 June 2011 - 09:09 #1

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.

dap
dap

    Gunnery Sergeant

  • Members
  • 520 posts

  • Joined: 18-September 2010

Posted 30 June 2011 - 09:16 #2

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;


Thread Starter
CER10TY
CER10TY

    Master Gunnery Sergeant

  • Members
  • 1084 posts

  • Joined: 20-November 2010

Posted 30 June 2011 - 10:41 #3

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

Like this?

2nd Ranger
2nd Ranger

    Sergeant Major

  • Members
  • 1509 posts

  • Joined: 14-June 2005

Posted 30 June 2011 - 10:48 #4

I would just get rid of that part.

empty all your clips at their locations

Vote!
http://feedback.arma...ew.php?id=24134 - Hunter MRAPs sometimes won't move to waypoints
http://feedback.arma...iew.php?id=9341 - Random placement of units and waypoints does not work near buildings
http://feedback.arma...ew.php?id=17665 - Backpacks can't be placed accurately in editor


Thread Starter
CER10TY
CER10TY

    Master Gunnery Sergeant

  • Members
  • 1084 posts

  • Joined: 20-November 2010

Posted 30 June 2011 - 10:54 #5

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, 30 June 2011 - 12:08.


f2k sel
f2k sel

    Chief Warrant Officer

  • Members
  • 3947 posts

  • Joined: 02-June 2009

Posted 30 June 2011 - 13:11 #6

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.

kylania
kylania

    Lieutenant Colonel

  • Members
  • 8281 posts

  • Joined: 20-May 2009

Posted 30 June 2011 - 13:24 #7

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.

f2k sel
f2k sel

    Chief Warrant Officer

  • Members
  • 3947 posts

  • Joined: 02-June 2009

Posted 30 June 2011 - 13:27 #8

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.

Thread Starter
CER10TY
CER10TY

    Master Gunnery Sergeant

  • Members
  • 1084 posts

  • Joined: 20-November 2010

Posted 30 June 2011 - 15:43 #9

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.

kylania
kylania

    Lieutenant Colonel

  • Members
  • 8281 posts

  • Joined: 20-May 2009

Posted 30 June 2011 - 15:52 #10

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.

Demonized
Demonized

    Warrant Officer

  • Members
  • 2653 posts

  • Joined: 16-November 2010

Posted 30 June 2011 - 16:20 #11

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;
	};
};

My scripts:



Any new mission editor or scripter in Arma2 should have read Mr Murrays Editing Guide Deluxe at least once, it still applies for A2 even though it was made for Armed Assault.

Thread Starter
CER10TY
CER10TY

    Master Gunnery Sergeant

  • Members
  • 1084 posts

  • Joined: 20-November 2010

Posted 30 June 2011 - 16:50 #12

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.

Demonized
Demonized

    Warrant Officer

  • Members
  • 2653 posts

  • Joined: 16-November 2010

Posted 30 June 2011 - 17:00 #13

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, 30 June 2011 - 17:04.
spelling error in assignascargo fixed.

My scripts:



Any new mission editor or scripter in Arma2 should have read Mr Murrays Editing Guide Deluxe at least once, it still applies for A2 even though it was made for Armed Assault.

kylania
kylania

    Lieutenant Colonel

  • Members
  • 8281 posts

  • Joined: 20-May 2009

Posted 30 June 2011 - 17:11 #14

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.

Riouken
Riouken

    Gunnery Sergeant

  • Members
  • 570 posts

  • Joined: 15-December 2009

Posted 30 June 2011 - 17:37 #15

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, 30 June 2011 - 17:54.


kylania
kylania

    Lieutenant Colonel

  • Members
  • 8281 posts

  • Joined: 20-May 2009

Posted 30 June 2011 - 17:42 #16

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";


Thread Starter
CER10TY
CER10TY

    Master Gunnery Sergeant

  • Members
  • 1084 posts

  • Joined: 20-November 2010

Posted 30 June 2011 - 20:06 #17

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.

Riouken
Riouken

    Gunnery Sergeant

  • Members
  • 570 posts

  • Joined: 15-December 2009

Posted 30 June 2011 - 21:55 #18

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, 30 June 2011 - 21:58.


Thread Starter
CER10TY
CER10TY

    Master Gunnery Sergeant

  • Members
  • 1084 posts

  • Joined: 20-November 2010

Posted 30 June 2011 - 22:18 #19

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.

kylania
kylania

    Lieutenant Colonel

  • Members
  • 8281 posts

  • Joined: 20-May 2009

Posted 30 June 2011 - 23:48 #20

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.