; Okay, we know who we are
_plane = _this select 0

; If we're dead, we can't spoof
?(not alive (_plane select 0) ): goto "Exit"

; If the engine's off, we can't spoof
?(not isengineon (_plane select 0) ): goto "Exit"

; Random chance not to spoof
?(random 100 < 30): goto "Exit"

; Who's the bad guy?
_enemy = _plane select 2

; And what did he fire?
_weaponname = _plane select 1

; Get the missile object that was launched at us
_missile = nearestobject [_enemy, _weaponname]

; Wait till the missile is close
@ _missile distance (_plane select 0) < 250

; And deflect it
_dirchange = 5 -random 10

_count =0

#BendLoop
_newdir = (direction _missile) + _dirchange

? (_newdir > 360) : _newdir = _newdir -360
? (_newdir < 0) : _newdir = _newdir +360

_missile setdir _newdir

~0.03

? (_count < 20) : goto BendLoop

#Exit
exit
