My problem is that I'm trying to parachute a bunch of guys out of a fast moving Chinook. In general, it works fine, but there's almost always one bloke or two that don't "get into his parachute", and falls like a stone to the ground. And although it's fun to watch (at least the first time or two), it's just not what I want.
I've tried several different solutions, but to no avail.
The first version of the code was just the old regular
_myDude action ["EJECT", _myVehicle];
unassignVehicle _myDude;
When I noticed that some guys didn't get into their parachutes, I thought it was because the Chinook was flying too fast, so I tried this:
_oldVelocity = velocity _vehicle;
_oldX = _oldVelocity select 0;
_oldY = _oldVelocity select 1;
_speed = sqrt (_oldX * _oldX + _oldY * _oldY);
? _speed > _speedLimit : goto "safeJump";
_unit action ["EJECT", _vehicle];
goto "rest"
#safeJump
_newX = _speedLimit * _oldX / _speed;
_newY = _speedLimit * _oldY / _speed;
_vehicle setVelocity [_newX, _newY, 0];
_unit action ["EJECT", _vehicle];
_vehicle setVelocity _oldVelocity;
#rest
unassignVehicle _unit;
Didn't work either... So then I tried this:
_oldVelocity = velocity _vehicle;
_oldX = _oldVelocity select 0;
_oldY = _oldVelocity select 1;
_speed = sqrt (_oldX * _oldX + _oldY * _oldY);
? _speed > _speedLimit : goto "safeJump";
_unit action ["GETOUT", _vehicle];
_chute = "PARACHUTEWEST" createVehicle getPos _vehicle;
_unit moveInDriver _chute;
_chute setPos (getPos _vehicle);
_chute setVelocity [(velocity _vehicle) select 0, (velocity _vehicle) select 1, 0];
goto "rest"
#safeJump
_newX = _speedLimit * _oldX / _speed;
_newY = _speedLimit * _oldY / _speed;
_unit action ["GETOUT", _vehicle];
_chute = "PARACHUTEWEST" createVehicle getPos _vehicle;
_unit moveInDriver _chute;
_chute setPos (getPos _vehicle);
_chute setVelocity [_newX, _newY, 0];
;_unit action ["EJECT", _vehicle];
;_vehicle setVelocity _oldVelocity;
#rest
unassignVehicle _unit;
which, as you've robably guessed, didn't work either...
So... Does anybody know a failsafe way to parachute my guys from a fast-moving chopper? Or do I have to live with it?