Jump to content
Sign in to follow this  
gerix

How to make units eject

Recommended Posts

Hello!

I'm currently working on a paratrooper script but I got the problem, that the units don't jump out of the plane.

[...]

para2 = "TK_Soldier_Medic_EP1" createUnit [[0,0,0], _paraGroup, "this moveInCargo [_cargoPlane, 5]" , 0.9,""];
para2 action ["Eject", vehicle _cargoPlane]; unassignVehicle para2;

sleep 0.5;


para3 = "TK_Soldier_AT_EP1" createUnit [[0,0,0], _paraGroup, "this moveInCargo [_cargoPlane, 5]" , 0.9,""];
para3 action ["Eject", vehicle _cargoPlane]; unassignVehicle para3;

sleep 0.5;


_cargoPlanePos setPos (getPos _cargoPlane);

sleep 2;

_ammoBox = "USVehicleBox" createVehicle [0,0,0];
_obj_para setpos (getPos _cargoPlanePos);

_chute = "ParachuteBigWest" createVehicle [getPos _ammoBox select 0, getPos _ammoBox select 1, getPos _ammoBox select 2];
_ammoBox attachTo [_chute,[0,0,0]];
_para setPos [getPos _box select 0, getPos _box select 1, 2000];


//MARKERS

_markerBig = createMarker ["", (getPos _ammoBox)];
_markerBig setMarkerBrush "Solid";
_markerBig setMarkerColor "ColorRed";
_markerBig setMarkerPos _ammoBoxPos;
_markerBig setMarkerSize [200, 200];
_markerBig setMarkerShape "ELLIPSE";

_markerSmall = createMarker ["SUPPLY DROP", (getPos _ammoBox)];
_markerSmall setMarkerBrush "Solid";
_markerSmall setMarkerColor "ColorBlack";
_markerSmall setMarkerPos _ammoBoxPos;
_markerSmall setMarkerSize [100, 100];
_markerSmall setMarkerShape "ELLIPSE";

_markerText = createMarker ["SUPPLY DROP", (getPos _ammoBox)];
_markerSmall setMarkerBrush "Solid";
_markerSmall setMarkerColor "ColorBlack";
_markerText setMarkerShape "ICON";
_markerText setMarkerType "Empty";
_markerText setMarkerSize [1, 1];

This is only a small part of the script, btw.

I'd be glad if theres somebody who could tell me what I'm doing wrong ;)

Greedings

GeriX

Share this post


Link to post
Share on other sites

You don't need to specify that its a vehicle so you would use

para2 action ["Eject", _cargoPlane];

instead of

para2 action ["Eject", vehicle _cargoPlane];

You probably got the "vehicle _cargoPlane" part from the wiki Here. What that does in that instance is ejects him from whatever vehicle he is in, So he could eject from a car and not just the specified C130-J. If you wanted to implement this into your script you would use:

para2 action ["Eject", vehicle para2];

Share this post


Link to post
Share on other sites

Ok so I tried it and changed all what you said but it still doesn't work...

Also I noticed that the ammoBox doesn't drop so I think that it has to do with the _cargoPlane.

This is the code of the creation of the cargoplane:

_cargoPlane =  createVehicle ["C130J", _cargoPlaneStart, [], 0, "FLY"];
_pilot = _pilotGroup createUnit ["TK_Soldier_Pilot_EP1", [12000, 12360, 0], [],0.9,"CAN_COLLIDE"];
_pilot moveInDriver _cargoPlane;

Share this post


Link to post
Share on other sites

need to unassign first then eject.

para2 = "TK_Soldier_Medic_EP1" createUnit [[0,0,0], _paraGroup, "this moveInCargo [_cargoPlane, 5]" , 0.9,""]; 
unassignVehicle para2;
para2 action ["Eject", _cargoPlane];  

Share this post


Link to post
Share on other sites

I tried this, too. But it still doesn't work... They spawn properly inside the plane but just don't want to jump out.

What am I doing wrong?? :O

Share this post


Link to post
Share on other sites

This can't work because neither para2, nor para3 have valid values, because the createUnit-version you're using doesn't return anything ;)

What you want to do is:

"TK_Soldier_AT_EP1" createUnit [[0,0,0], _paraGroup, "para3 = this; this moveInCargo [_cargoPlane, 5]" , 0.9,""];
waitUntil {!isNil "para3"};
para3 action ["eject", vehicle para3];

// .... 

Share this post


Link to post
Share on other sites

@ geriX I have a really good para script that I work on that will give you 25 units that will jump out from c130 ~ 500 meters away and the group will move to the players location that he call them in. the group will then follow you at your 6 around the AO with a small delay. it has a few adjustable things to meet your needs of your mission. AT units will have unlimited ammo since the AI ground units will not rearm in the game. If you cant get your script to work let me know if you want it for your mission.

Share this post


Link to post
Share on other sites

by:

XxAnimusxX + Nimrod_Z

"TK_Soldier_AT_EP1" createUnit [[0,0,0], _paraGroup, "para3 = this; this moveInCargo [_cargoPlane, 5]" , 0.9,""];
unassignVehicle para3;
para3 action ["Eject", _cargoPlane];

...tested, it works

Edited by Morieza

Share this post


Link to post
Share on other sites

Yes works now fine! Thanks @XxAnimusxX ;)

But I still got a problem with the supply crate though.. It just spawns a Parachute at the ground wich despawns shortly after but the crate doesn't appear.

Anyone a solution?

Code:

_cargoPlanePos = getPos _cargoPlane;

sleep 1;

_ammoBox = "USVehicleBox" createVehicle(_cargoPlanePos);

_chute = "ParachuteBigWest" createVehicle [getPos _ammoBox select 0, getPos _ammoBox select 1,getPos _ammoBox select 2];
_ammoBox attachTo [_chute, [0,0,-1]];


// [...]

while {getPos _ammoBox select 2 < 0} do
{
sleep 0.1;
};
while {getPos _ammoBox select 2 > 1} do
{
sleep 0.1;
};
detach _ammoBox;


_ammoBox setVehicleInit "[this] call BIS_EVO_DropBox";
processInitCommands;	


BIS_EVO_DropBox = 
{
	_vec = _this select 0;
	clearWeaponCargo _vec;
	clearMagazineCargo _vec;

	_vec AddWeaponCargo ["M9SD", 1];
	_vec AddWeaponCargo ["Binoculars", 1];
	_vec AddWeaponCargo ["NVGoggles", 1];
	_vec AddWeaponCargo ["M16A2", 1];
};

Share this post


Link to post
Share on other sites

please try this...

_cargoPlanePos = getPos _cargoPlane;
sleep 1;
_ammoBox0 = createVehicle ["USVehicleBox", _cargoPlanePos, [], 0, "none"];
_chute = createVehicle ["ParachuteBigWest", _ammoBox0, [], 0, "none"];
_ammoBox0 attachTo [_chute, [0,0,-1]];

waituntil {0.1 > getPos _ammoBox0 select 2};
detach _ammoBox0;
_abx0p = getpos _ammobox0;
deletevehicle _ammoBox0;
sleep 0.01;
_ammoBox = "USVehicleBox" createVehicle (_abx0p);
sleep 0.01;
clearMagazineCargo _ammoBox;
clearWeaponCargo _ammoBox;
_ammoBox addMagazineCargo ["15Rnd_9x19_M9SD",10];
_ammoBox addMagazineCargo ["30Rnd_556x45_Stanag",10];
_ammoBox AddWeaponCargo ["M9SD", 2];
_ammoBox AddWeaponCargo ["M16A2", 2];
_ammoBox AddWeaponCargo ["Binocular", 2];
_ammoBox AddWeaponCargo ["NVGoggles",2];

Share this post


Link to post
Share on other sites

Thanks after a lotta testing and some further changes with your script it works!

Although the log is spammed with:

B 1-1-D:8: Getting out while IsMoveOutInProgress

B 1-1-D:9: Getting out while IsMoveOutInProgress

B 1-1-D:10: Getting out while IsMoveOutInProgress

B 1-1-D:11: Getting out while IsMoveOutInProgress

B 1-1-D:12: Getting out while IsMoveOutInProgress

and following...

Someone knows how to fix that?

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  

×