Jump to content
Sign in to follow this  
easyeb

Help AI survive parachute drop

Recommended Posts

So whenever I parachute with my AI squad there is always a couple of them dying when they land for reasons I can't understand.

Is there some script or anything I can do to ensure they survive the landing?

I'd appreciate any help I can get.

Cheers!

Share this post


Link to post
Share on other sites

Somewhere in your drop script:

_unit allowDamage false;

waitUntil {((getPosATL _unit) select 2) < 1};

sleep 2;

_unit allowDamage true;

Share this post


Link to post
Share on other sites

It sometimes just doesn't fire when it needs to (inconsistent), at least that's my experience, the wiki also says that it works better when it's with other conditions, not just by itself, so:

waitUntil {isTouchingGround _unit || ((getPosATL _unit) select 2) < 1};
//would be "better"

Share this post


Link to post
Share on other sites
I guess in that case' date=' I'd withdraw my statement and support your [i']getPosATL[/i] answer. ^_^

I believed what you did until I was told differently in a thread a couple weeks back, so...don't feel lonely :).

Share this post


Link to post
Share on other sites
isTouchingGround is weird, I would not recommend it.

Doesn't always work because of different surface. Even detecting height above the ground might not help if unit is stuck on tree or some object that is not configured to be walkable on. You can line intersect to find surface, could be little bit more expensive though.

Share this post


Link to post
Share on other sites

What about using velocity for the check, seemed to work when just dropping a man without shut.

_unit allowDamage false;

sleep 1;// needs a delay to allow the unit to start falling before checking

waitUntil {(velocity _unit select 2) == 0};

sleep 1;

_unit allowDamage true;

I'm not sure about on water so you may need another check for that.

On the subject of water why does a unit fall vertically over land but over water he uses the horizontal free fall animation?

Share this post


Link to post
Share on other sites

Yeah velocity might be good solution. As for water, it is an old bug, there is even ticket about it. Besides water interaction is so annoyingly buggy, I have no strength or desire report those bugs anymore, so I try to limit myself to boats only.

Share this post


Link to post
Share on other sites

Thanks for your help guys! I am however not having any luck.

The reason for this is probably because of two things; first I'm not experienced in scripting. I kind of get the idea but I can't find whats wrong when something is not working. Secondly, more to this matter, is that I'm using WWAI "Eject player & selection" for my parachute drops.

The eject code looks like this:

private ["_selectedUnits"];

_selectedUnits = _this select 0;

ww_openChute =

{

private ["_unit", "_vehicle"];

_unit = _this select 0;

_vehicle = _this select 1;

_pack = unitBackpack _unit;

sleep random 2;

_unit action ["eject", _vehicle];

while{_unit distance _vehicle < 10} do

{

sleep 0.5;

};

waitUntil {

(getPosATL _unit) select 2 < 300

};

_pack attachTo [_unit,[0,-0.13,0],"Pelvis"];

_pack setVectorDirAndUp [[0,0,1],[0,1,0]]; //flip pack upside down

_unit addBackpack "B_Parachute";

_unit action ["OpenParachute", _unit];

_pack setPos [(getPos _unit) select 0,(getPos _unit) select 1,-50];

waitUntil {

(getPosATL _unit) select 2 <1

};

deletevehicle (vehicle _unit);

detach _pack;

_pack setVectorDirAndUp [[0,0,-1],[0,-1,0]];

_pack setPosATL [getposATL _unit select 0,getposATL _unit select 1,-0.13];

(_unit) action ["TakeBag",_pack];

};

ww_eject =

{

private ["_unit","_vehicle"];

_unit = _this select 0;

_vehicle = _this select 1;

//sleep 0.5+random 2;

if(_vehicle isKindOf "Air" && ((getPosATL _vehicle) select 2)>3) then

{

[_unit, _vehicle] spawn ww_openChute;

}

else

{

_unit action ["eject", vehicle _unit];

};

};

{

if (_x != vehicle _X) then

{

_vehicle = vehicle _x;

[_x, _vehicle] spawn ww_eject;

};

}foreach _selectedUnits;

/*_pack = unitBackpack _unit;

_unit addBackpack "B_Parachute";

_pack attachTo [_unit,[0,-0.13,0],"Pelvis"];

_pack setVectorDirAndUp [[0,0,1],[0,1,0]]; //flip pack upside down

_nil = [_unit,_pack] spawn {

_unit = _this select 0;

_pack = _this select 1;

waitUntil {isTouchingGround _unit};

detach _pack;

//these two lines are because i couldn't figure out how to have

// a backpack just lay there asif naturally dropped instead of created

// so it flips it over (from the HALO position) and buries it...

_pack setVectorDirAndUp [[0,0,-1],[0,-1,0]];

_pack setPosAtl [getposATL _pack select 0,getposATL _pack select 1,-.13];

(_unit) action ["TakeBag",_pack];

//_pack addAction ["Take Bag",{(_this select 1) action ["TakeBag",_this select 0];}];

};*/

I've tried pasting your suggestions in here (not sure where so I placed it in the end, after everything) but without luck. It's so weird because everything works fine. We get out of the plane, parachutes deploy for everybody, we take a smooth ride to the ground and then all of a sudden 1/4 or even 1/3 of my squad just ends up dead when they land.

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  

×