Jump to content
Sign in to follow this  
wyattwic

Unable to get units to eject

Recommended Posts

Hello everyone!

 

I am working a a quick and dirty helicopter reinforce script but I am having no luck getting them to eject.    If you can, please take a look at this snipet of code.

 

The code is populating the helicopter correctly, every seat gets filled, but the portion of the code I spawn out does not appear to be working.

 

EDIT:  This is not the whole script, just the portion I suspect to be having issues.  No errors are being thrown in the RPT.

while {_run} do {
					_spawn = selectrandom selectrandom _i; //Select random from infantry pool, select random from infantry group.
					
					_spawnobj = _group createUnit [_spawn,position _veh, [], 0, "FORM"];
					
					_check = _spawnobj moveInAny _veh;
					if (_check) then {
							
						0 = [_spawnobj,_veh] spawn {
							_target = _this select 0;
							_veh = _this select 1;
							_run = true;
							while {_run} do {
								if ([[getmarkerpos AOname,(getmarkersize AOname) select 0],_target] call BIS_fnc_inTrigger) then {
									_target action ["eject",_veh];
									_run = false;
								};
								sleep 20;
							};
						};
					} else {
						deleteVehicle _spawnobj;
						_run = false;
					}; 

I have also troubleshooted the BIS_fnc_inTrigger in my debug by using the below, it works correctly.

[[getmarkerpos AOname,(getmarkersize AOname) select 0],player] call BIS_fnc_inTrigger

I would love any advice!

Share this post


Link to post
Share on other sites

Relating to  markers you need use string format, and use command instead function

(position player) inArea "AOname"

Sharing part of the code are not good idea, how you can knew which part of script fails if you do not knew how to fix it.

Share this post


Link to post
Share on other sites
_unit setPos (getPos vehicle _unit)

should "eject" you no matter what (even if you couldn't normally). Use

_unit setPos ((getPos vehicle _unit) vectorAdd [0,0,-5])

or something if the units get killed in a collision or something like that. I didn't test it enough to know.

  • Like 1

Share this post


Link to post
Share on other sites

Relating to  markers you need use string format, and use command instead function

(position player) inArea "AOname"

Sharing part of the code are not good idea, how you can knew which part of script fails if you do not knew how to fix it.

 

AOname is already a string.  Ive already troubleshooted what goes on in BIS_fnc_inTrigger and I know the conditional works.

 

The whole script is 500 lines long. I'd rather not flood the forums and I have isolated it to this segment.   Thanks for the help though!

 

 

 

_unit setPos (getPos vehicle _unit)

should "eject" you no matter what (even if you couldn't normally). Use

_unit setPos ((getPos vehicle _unit) vectorAdd [0,0,-5])

or something if the units get killed in a collision or something like that. I didn't test it enough to know.

 

 

Thank you theend3r!  The first method kills everyone instantly, the second method gives me a chance to give them parachutes.  Thanks for the help!

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  

×