Hi all,
I've made a script that forces a helicopter to crash when it takes damage.
The script activates an EH to watch for damage, which then forces the chopper to crash.
It works fine with a slight flaw.
When the missile/rocket hits, the chopper is forced back, which looks unrealistic.
I've tried getting the velocity of the chopper before the impact and then setting it back, directly after the impact but i'm getting scalar errors when I try to pass the x,y,z to the EH.
Heres the two parts of the event:
Apache flyinheight 40
;Get the initial velocity of the chopper
_Speed = velocity Apache
_xVelo = _Speed select 0
_yVelo = _Speed select 1
_zVelo = _Speed select 2
Apache AddEventHandler ["hit", {[Apache, _Speed] exec "crash.sqs"}]
hint format["X:%1 Y:%2 Z:%3", _xVelo, _yVelo, _zVelo]
exit
_Target = _This select 0
;Get the initial velocity of the chopper
_Velocity = _this select 1
_xVelo = _Velocity select 0
_yVelo = _Velocity select 1
_zVelo = _Velocity select 2
hint format["X:%1 Y:%2 Z:%3", _xVelo, _yVelo, _zVelo]
;Stop the rotors spinning
_Target setfuel 0
;camcreate 2 shells that hit each other at the choppers x,y,z
bomb1 = "HEAT105" camcreate getpos _Target
bomb1 = "HEAT105" camcreate getpos _Target
; set velocity of chopper back to original vel before explosion caused an offset.
_Target setvelocity [_xVelo, _yVelo, _zVelo]
;======================================================================================
#Crash
_Height = getPos _Target select 2
_Direction = getDir _Target
_Dir = (random(0.8))+1
;_Target FlyInHeight (_Height - 2)
_Target setDir (_Direction + _Dir)
drop ["cl_basic","","Billboard",1,random(4),[-1,-6,2],[random(1),random(1),random(0.1)+0.4],1,random(0.1)+0.5,0.5,random(0.1),[random(0.1)+0.2,random(1)+2,random(1)+3],[[0.2,0.2,0.2,1],[1,1,1,0]],[0],0,0,"","",_Target]
? _Height < 2 : bomb1 = "HEAT105" camcreate [getpos _Target select 0, getPos _Target select 1, (getPos _Target select 2) +1]
? _Height < 2 : bomb1 = "HEAT105" camcreate [getpos _Target select 0, getPos _Target select 1, (getPos _Target select 2) +1]
? _Height < 2 : goto "End"
~0.01
goto "Crash"
;=========================================================================================
#End
exit
~Any help is much appreciated ;D