Question about this earthquake script and how to lower the "shaking" time.

DangerRuss

OpenDayZ Rockstar!
I found this script on this site, idk who the original author is, but Im looking for a way to to reduce the amount of time the player experiences the "shaking" from the earthquake. Id really like the shaking to stop when the sound effect stops.
Code:
earth = {
playsound "eq";
for "_i" from 0 to 140 do {
_vx = vectorup _this select 0;
_vy = vectorup _this select 1;
_vz = vectorup _this select 2;
_coef = 0.01 - (0.0001 * _i);
_this setvectorup [
_vx+(-_coef+random (2*_coef)),
_vy+(-_coef+random (2*_coef)),
_vz+(-_coef+random (2*_coef))
];
sleep (0.01 + random 0.01);
};
 
};
 
while {true} do {
player spawn earth;
sleep (600 + random 60);
};

is that possible?
 
This is a function
Code:
earth = {
playsound "eq";
for "_i" from 0 to 140 do {
_vx = vectorup _this select 0;
_vy = vectorup _this select 1;
_vz = vectorup _this select 2;
_coef = 0.01 - (0.0001 * _i);
_this setvectorup [
_vx+(-_coef+random (2*_coef)),
_vy+(-_coef+random (2*_coef)),
_vz+(-_coef+random (2*_coef))
];
sleep (0.01 + random 0.01);
};

That this line spawns
Code:
player spawn earth;

In it, it has a timed loop.
Code:
for "_i" from 0 to 140 do {
Each time it loops it adds 1 to 0, until it equals 140. To make the earthquake run less loops, or less times, make 140 a smaller number.
You could even add a random as a variable to randomize the amount of time the ground shakes some.
 
Back
Top