Home   Help Search Login Register  

Author Topic: plane water crashing script(big planes)  (Read 779 times)

0 Members and 1 Guest are viewing this topic.

my acc. was remove

  • Guest
plane water crashing script(big planes)
« 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
« Last Edit: 04 Nov 2005, 14:55:46 by my acc. was remove »

Offline Pilot

  • Contributing Member
  • **
Re:plane water crashing script(big planes)
« Reply #1 on: 04 Nov 2005, 18:25:37 »
Not a bad idea, I think at least some sort of drop command to spray water into the air would be a great improvement.

Quote
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

Offline Nemesis6

  • Members
  • *
Re:plane water crashing script(big planes)
« Reply #2 on: 05 Nov 2005, 00:45:01 »
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 -
Quote
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 -
Quote
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 -
Quote
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...
« Last Edit: 05 Nov 2005, 00:46:15 by Nemesis6 »
I am actually flying into a star... this is incredible!

Offline Pilot

  • Contributing Member
  • **
Re:plane water crashing script(big planes)
« Reply #3 on: 05 Nov 2005, 05:35:19 »
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
Code: [Select]
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
Code: [Select]
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
Code: [Select]
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

my acc. was remove

  • Guest
Re:plane water crashing script(big planes)
« Reply #4 on: 05 Nov 2005, 10:18:57 »
i forgot to ask that where do i put a sqs file????

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:plane water crashing script(big planes)
« Reply #5 on: 05 Nov 2005, 13:57:42 »
Put your .sqs files in the same folder as your mission.sqm.


Planck
I know a little about a lot, and a lot about a little.

my acc. was remove

  • Guest
Re:plane water crashing script(big planes)
« Reply #6 on: 05 Nov 2005, 16:12:21 »
how do i use this? what do i have 2 type?

Offline Nemesis6

  • Members
  • *
Re:plane water crashing script(big planes)
« Reply #7 on: 05 Nov 2005, 20:01:01 »
Look at the unquoted text in my message above. It's in the beginning.
I am actually flying into a star... this is incredible!