OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: my acc. was remove on 04 Nov 2005, 14:54:00
-
as a big plane crashes into the water, it seems to just fall through the water & slide underwater ;D
that doesnt happen in real life & this script could save the units inside the plane
the script should function this way:
-as the plane hits the water, it should make an instant stop leaving only some 3 or 4 mph of speed
- the should start slowly sinking
-the infantry in cargo would use the GET OUT action automatically
-inflate a rescue raft
-the plane should not be destroyed once it happens
should work 4 any type of air vehicles
-
Not a bad idea, I think at least some sort of drop command to spray water into the air would be a great improvement.
as the plane hits the water, it should make an instant stop leaving only some 3 or 4 mph of speed
Actually, in reality this would kill everyone on board instantly, the plane will slow down, but it won't instantly stop...unless it hit the water at a high angle of attack (AOA), that is.
This would be diffucult to pull off because the script would have to determine the angle (or downward velocity) the plane hits at, if it hits too high, the plane should break up and be destroyed. If it hits at a lower AOA (or a lower vertical speed), it should settle into the water and slow down without being destroyed.
-Pilot
-
I actually have a script that does this(not the calculating part, though. But the slowing down part nonetheless)
When you have saved all the scripts, execute the following one as [this] exec "init.sqs" on a plane or helicopter and crash it into the sea.
Save as init.sqs -
goto "init"
#start
@ getpos _vehicle select 2 < (-0)
_gl = "logic" createVehicle [getpos _vehicle select 0,getpos _vehicle select 1,0]; _gl setpos [getpos _vehicle select 0,getpos _vehicle select 1,0]; _gl setDir (getDir _vehicle)
[_vehicle] exec "\nmod_effects\slowdown.sqs";
[_gl] exec "\nmod_effects\waterexplosionN.sqs";
exit
#init
_vehicle = _this select 0
goto "start"
Save as waterexp.sqs -
goto "initialise"
#explosion1
_Xrad = 8+random 4
_Yrad = 8+random 4
_Xcos = sin _Cen
_YCos = cos _Cen
drop ["cl_water" , "" , "Billboard" , 1 , 3, [(_Xcos * _Xrad), _posy + (_YCos * _Xrad), -1.0+random 0.5-random 1.5] , [random _Force-random _Force,random _Force-random _Force,random 2-random 2] , 1 , 2.1 , 1.55 , 0.10 , [3.5-random 1.5,15.0-random 4] , [[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0.55],[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0]] , [0,1,0] , 2 , 4.3 , "" , "" , _groundZero]
drop ["cl_water" , "" , "Billboard" , 1 , 3, [(_Xcos * _Yrad), _posy + (_YCos * _Yrad), -1.0+random 0.5-random 1.5] , [random _Force-random _Force,random _Force-random _Force,random 2-random 2] , 1 , 2.1 , 1.55 , 0.10 , [3.5-random 1.5,15.0-random 4] , [[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0.55],[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0]] , [0,1,0] , 2 , 4.3 , "" , "" , _groundZero]
_Cen = _Cen + 4.8
?(_Cen < 361): goto "explosion1"
#explosion2
_Xrad = 8+random 4
_Yrad = 8+random 4
_Xcos = sin _Cen
_YCos = cos _Cen
drop ["cl_water" , "" , "Billboard" , 1 , 3, [(_Xcos * _Xrad), _posy + (_YCos * _Xrad), -1.0+random 0.5-random 1.5] , [random _Force-random _Force,random _Force-random _Force,random 2-random 2] , 1 , 2.1 , 1.55 , 0.10 , [3.5-random 1.5,15.0-random 4] , [[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0.55],[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0]] , [0,1,0] , 2 , 4.3 , "" , "" , _groundZero]
drop ["cl_water" , "" , "Billboard" , 1 , 3, [(_Xcos * _Yrad), _posy + (_YCos * _Yrad), -1.0+random 0.5-random 1.5] , [random _Force-random _Force,random _Force-random _Force,random 2-random 2] , 1 , 2.1 , 1.55 , 0.10 , [3.5-random 1.5,15.0-random 4] , [[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0.55],[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0]] , [0,1,0] , 2 , 4.3 , "" , "" , _groundZero]
_Cen = _Cen + 4.8
?(_Cen < 361): goto "explosion2"
#loop
_i = 0
#l1
_vel = [(random 5)-random 5, (random 5)-random 5, 10 + random 10]
_vel = [(random 5)-random 5, (random 5)-random 5, 10 + random 10]
_size1 = random _sizeX
_size2 = random _sizeX
_size = [_size1, _size2]
drop [_shape, "", "Billboard", _lifetime, _lifetime, [_x, _y, 0], _vel, 0, 3, 0, 0.1, _size, _color, - , 0.1, 0.2, "", "", "_groundZero"]
_vel = [(random 5)-random 5, (random 5)-random 5,random 1]
_vel = [(random 5)-random 5, (random 5)-random 5,random 1]
_size1 = random _sizeX
_size2 = random _sizeX
_size = [_size1, _size2,_size2 * 3]
drop [_shape, "", "Billboard", _lifetime, _lifetime, [_x, _y, 0], _vel, 0, 3, 0, 0.01, _size, _color, - , 0.1, 0.2, "", "", "_groundZero"]
_i = _i + 1
?_i < 10: goto "l1"
_j = _j + 1
~0.01
?_j<10: goto "loop"
exit
#initialise
_groundzero = _this select 0
[_vehicle] exec "slowdown.sqs";
_posy = 1
_Cen = 0
_Force = 3
_xc = (GetPos _groundZero Select 0)
_yc = (GetPos _groundZero Select 1)
_repeat = true
_shape = "cl_water"
_j = 0
_x = getpos _groundZero select 0
_y = getpos _groundZero select 1
_color = [[0.8,0.8,0.9,0],[0.9,0.9,1,0.7],[0.8,0.8,0.9,0],[0.8,0.8,0.9,0]]
_lifetime = 5
_sizeX = 15
goto "explosion1"
Save as slowdown.sqs -
goto "init"
#slowdown
_vehicle setvelocity [(velocity _vehicle select 0) / _div,(velocity _vehicle select 1) / _div,(velocity _vehicle select 2) / _div]
~_rate
?speed _vehicle <= _goal:goto "exit"
goto "slowdown"
exit
#init
_vehicle = _this select 0
_rate = 0.15
_goal = 1
_div = 1.3
_speed = speed _vehicle
@ (getpos _vehicle select 2 < 3)
goto "slowdown"
Yeah...
-
Well, I had to adjust the scripts slightly, but the effect does look good!
Also, it is not good practice to name a script init.sqs, that name is reserved and called by the game engine at the start of the mission. I named the script waterinit.sqs
Here are the adjusted scripts:
waterinit.sqs
goto "init"
#start
@ getpos _vehicle select 2 < (-0)
_gl = "logic" createVehicle [getpos _vehicle select 0,getpos _vehicle select 1,0]; _gl setpos [getpos _vehicle select 0,getpos _vehicle select 1,0]; _gl setDir (getDir _vehicle)
[_vehicle] exec "slowdown.sqs";
[_gl] exec "waterexp.sqs";
exit
#init
_vehicle = _this select 0
goto "start"
waterexp.sqs
goto "initialise"
#explosion1
_Xrad = 8+random 4
_Yrad = 8+random 4
_Xcos = sin _Cen
_YCos = cos _Cen
drop ["cl_water" , "" , "Billboard" , 1 , 3, [(_Xcos * _Xrad), _posy + (_YCos * _Xrad), -1.0+random 0.5-random 1.5] , [random _Force-random _Force,random _Force-random _Force,random 2-random 2] , 1 , 2.1 , 1.55 , 0.10 , [3.5-random 1.5,15.0-random 4] , [[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0.55],[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0]] , [0,1,0] , 2 , 4.3 , "" , "" , _groundZero]
drop ["cl_water" , "" , "Billboard" , 1 , 3, [(_Xcos * _Yrad), _posy + (_YCos * _Yrad), -1.0+random 0.5-random 1.5] , [random _Force-random _Force,random _Force-random _Force,random 2-random 2] , 1 , 2.1 , 1.55 , 0.10 , [3.5-random 1.5,15.0-random 4] , [[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0.55],[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0]] , [0,1,0] , 2 , 4.3 , "" , "" , _groundZero]
_Cen = _Cen + 4.8
?(_Cen < 361): goto "explosion1"
#explosion2
_Xrad = 8+random 4
_Yrad = 8+random 4
_Xcos = sin _Cen
_YCos = cos _Cen
drop ["cl_water" , "" , "Billboard" , 1 , 3, [(_Xcos * _Xrad), _posy + (_YCos * _Xrad), -1.0+random 0.5-random 1.5] , [random _Force-random _Force,random _Force-random _Force,random 2-random 2] , 1 , 2.1 , 1.55 , 0.10 , [3.5-random 1.5,15.0-random 4] , [[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0.55],[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0]] , [0,1,0] , 2 , 4.3 , "" , "" , _groundZero]
drop ["cl_water" , "" , "Billboard" , 1 , 3, [(_Xcos * _Yrad), _posy + (_YCos * _Yrad), -1.0+random 0.5-random 1.5] , [random _Force-random _Force,random _Force-random _Force,random 2-random 2] , 1 , 2.1 , 1.55 , 0.10 , [3.5-random 1.5,15.0-random 4] , [[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0.55],[0.8,0.8,0.9,0.35],[0.8,0.8,0.9,0]] , [0,1,0] , 2 , 4.3 , "" , "" , _groundZero]
_Cen = _Cen + 4.8
?(_Cen < 361): goto "explosion2"
#loop
_i = 0
#l1
_vel = [(random 5)-random 5, (random 5)-random 5, 10 + random 10]
_size1 = random _sizeX
_size2 = random _sizeX
_size = [_size1, _size2]
drop [_shape, "", "Billboard", _lifetime, _lifetime, [_x, _y, 0], _vel, 0, 3, 0, 0.1, _size, _color, [0], 0.1, 0.2, "", "", _groundZero]
_vel = [(random 5)-random 5, (random 5)-random 5,random 1]
_size1 = random _sizeX
_size2 = random _sizeX
_size = [_size1, _size2,_size2 * 3]
drop [_shape, "", "Billboard", _lifetime, _lifetime, [_x, _y, 0], _vel, 0, 3, 0, 0.01, _size, _color, [0], 0.1, 0.2, "", "", _groundZero]
_i = _i + 1
?_i < 10: goto "l1"
_j = _j + 1
~0.01
?_j<10: goto "loop"
exit
#initialise
_groundzero = _this select 0
[_vehicle] exec "slowdown.sqs";
_posy = 1
_Cen = 0
_Force = 3
_xc = (GetPos _groundZero Select 0)
_yc = (GetPos _groundZero Select 1)
_repeat = true
_shape = "cl_water"
_j = 0
_x = getpos _groundZero select 0
_y = getpos _groundZero select 1
_color = [[0.8,0.8,0.9,0],[0.9,0.9,1,0.7],[0.8,0.8,0.9,0],[0.8,0.8,0.9,0]]
_lifetime = 5
_sizeX = 15
goto "explosion1"
slowdown.sqs
goto "init"
#slowdown
_vehicle setvelocity [(velocity _vehicle select 0) / _div,(velocity _vehicle select 1) / _div,(velocity _vehicle select 2) / _div]
~_rate
?speed _vehicle <= _goal:goto "exit"
goto "slowdown"
exit
#init
_vehicle = _this select 0
_rate = 0.15
_goal = 1
_div = 1.3
_speed = speed _vehicle
@ (getpos _vehicle select 2 < 3)
goto "slowdown"
Once I got it working the effect was good. Thanks for making it.
-Pilot
-
i forgot to ask that where do i put a sqs file????
-
Put your .sqs files in the same folder as your mission.sqm.
Planck
-
how do i use this? what do i have 2 type?
-
Look at the unquoted text in my message above. It's in the beginning.