OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: penguinman on 24 Dec 2005, 23:46:09

Title: Shaking and vibrations from dammage
Post by: penguinman on 24 Dec 2005, 23:46:09
is it possible to script shaking and vibrations for when an aircraft gets hit or dammaged. to make it harder to control the aircraft. If so could sombody manifest such a script.

thank you
Title: Re:Shaking and vibrations from dammage
Post by: C0LDSt33L on 25 Dec 2005, 00:39:43
Perhaps the basis could be:

Code: [Select]
_shaken = _this select 0

#Loop

?(getdamage _shaken > 0.1): goto "Start"

~0.5

goto "Loop"

#Start

[_shaken] exec "SmokeAndFlamesScript.sqs"

PlaySound "Bang"

#SecondLoop

_shaken setvelocity[-30+(velocity _shaken select 0)+random 60,-30+(velocity _shaken  select 1)+random 60,-30+(velocity _shaken select 2)+random 60]

~0.2

goto "SecondLoop"


Then all you need is a smoke and flames script (check out UltimateFire from the scripts area) and you're set  :thumbsup:
Title: Re:Shaking and vibrations from dammage
Post by: penguinman on 25 Dec 2005, 02:58:57
 oh cool, thanks. I will try this


Title: Re:Shaking and vibrations from dammage
Post by: penguinman on 25 Dec 2005, 05:04:20
it gets a unknown operator error. about the getdammage part.

EDIT

oh, I just needed to add an extra m in dammage.

it works now but is far to powerful, how would I enter values to make the shaking milder.

thanks
Title: Re:Shaking and vibrations from dammage
Post by: C0LDSt33L on 25 Dec 2005, 14:42:42
The shaking can be changed from altering the setvelocity values. i.e. altering the numbers in bold


_shaken setvelocity[ -30+(velocity _shaken select 0)+random 60,-30+(velocity _shaken  select 1)+random 60,-30+(velocity _shaken select 2)+random 60 ]


Decrease these values to decrease the amount of shaking. I'd reccomend keeping the first number half the second within the component like it is already (30 is half 60).

If it helps you understand this part of the code the script takes the x, y and z components of the velocity and adds between -30 and 30 to them.
Title: Re:Shaking and vibrations from dammage
Post by: penguinman on 29 Dec 2005, 22:37:16
ok, I get it
thank you.