Home   Help Search Login Register  

Author Topic: Ejection script for ground vehicles  (Read 1070 times)

0 Members and 1 Guest are viewing this topic.

SSG Plazmoid

  • Guest
Ejection script for ground vehicles
« on: 20 Dec 2002, 21:11:26 »
I first thought of the ejection script as an extension of the lock vehicle script - a way to boot someone out of your vehicle. Probly not needed if you lock the vehicle right away but it's still pretty fun.

The action calls a script that ejects you at 50mph up (using set velocity) and waits for your vertical speed to drop below 5mph. Then it uses the trick of moving you into a chopper and ejecting (client doesn't see this as it's so fast) so you can parachute down safely to ground.

It might be kind of funny to load people into a bus and use the eject script to zoom along and have all of them eject and parachute down. You can also fire infantry across the map by increasing the forward velocity and then deploy a parachute before they splat.

What's needed:
a named chopper to put people in/out to get the parachute

add action to vehicle
Code: [Select]
actionID = this addAction ["Eject","eject.sqs"]
eject.sqs
Code: [Select]
;eject
_unit = _this select 1
_vehicle = _this select 0

?(_vehicle == _unit)||(vehicle _unit == _unit):hint "You may eject from inside only";exit

_velocity = velocity _vehicle

_unit action ["EJECT",_vehicle]
_unit setbehaviour "AWARE"
unassignvehicle _unit

_dir = getdir _unit
_x = sin(_dir)
_y = cos(_dir)
_x0 = _velocity select 0
_y0 = _velocity select 1
_z0 = _velocity select 2
_x1 = _x * _x0
_y1 = _y * _y0
_z1 = _z0 + 50
_unit setvelocity [_x1,_y1,_z1]

#loop
~.05
?(velocity _unit select 2 < 5):goto "deploy"
goto "loop"

#deploy
_x0 = getpos wDrop1 select 0
_y0 = getpos wDrop1 select 1
_z0 = getpos wDrop1 select 2
_x = getpos _unit select 0
_y = getpos _unit select 1
_z = getpos _unit select 2
wDrop1 setpos [_x,_y,_z]
_unit moveincargo wDrop1
_unit action ["EJECT",wDrop1]
_unit setbehaviour "AWARE"
unassignvehicle _unit
wDrop1 setpos [_x0,_y0,_z0]
hint "EJECTED"
exit
« Last Edit: 20 Dec 2002, 21:33:03 by SSG Plazmoid »