Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onUpdate(su)
- {
- sound_compressor(su);
- var speed = su.getSpeed();
- var notch = su.getNotch();
- if (notch != 0 && speed > 0.01)
- {
- if (speed >= 12.5 && speed < 20)
- {
- var pitch0 = 0.009 * speed+0.5;
- var vol5 = 0.05 * speed;
- su.playSound('sound_tokyu8500', 'train.tq00', vol5, pitch0);
- }
- else if (speed >= 20 && speed < 60)
- {
- var pitch0 = 0.009 * speed+0.5;
- var vol5 = 0.025 * speed+0.5;
- su.playSound('sound_tokyu8500', 'train.tq00', vol5, pitch0);
- }
- else if (speed >= 60 && speed < 80)
- {
- var pitch0 = 0.009 * speed+0.5;
- var vol5 = -0.1 * speed+8.0;
- su.playSound('sound_tokyu8500', 'train.tq00', vol5, pitch0);
- }
- else
- {
- su.stopSound('sound_tokyu8500', 'train.tq00');
- }
- }
- else
- {
- su.stopSound('sound_tokyu8500', 'train.tq00');
- }
- if (notch != 0 && speed > 0.01)
- {
- if (speed >= 0.01 && speed < 12.5)
- {
- var pitch0 = 0.064 * speed+0.4;
- var vol5 = 0.025 * speed;
- su.playSound('sound_tokyu8500', 'train.tq02', vol5, pitch0);
- }
- else
- {
- su.stopSound('sound_tokyu8500', 'train.tq02');
- }
- }
- else
- {
- su.stopSound('sound_tokyu8500', 'train.tq02');
- }
- if (notch == 0 && speed > 0.01)
- {
- if (speed >= 12.5 && speed < 20)
- {
- var pitch0 = 0.009 * speed+0.5;
- var vol5 = 0.05 * speed;
- su.playSound('sound_tokyu8500', 'train.tq03', vol5, pitch0);
- }
- else if (speed >= 20 && speed < 60)
- {
- var pitch0 = 0.009 * speed+0.5;
- var vol5 = 0.025 * speed+0.5;
- su.playSound('sound_tokyu8500', 'train.tq03', vol5, pitch0);
- }
- else if (speed >= 60 && speed < 80)
- {
- var pitch0 = 0.009 * speed+0.5;
- var vol5 = -0.1 * speed+8.0;
- su.playSound('sound_tokyu8500', 'train.tq03', vol5, pitch0);
- }
- else
- {
- su.stopSound('sound_tokyu8500', 'train.tq03');
- }
- }
- else
- {
- su.stopSound('sound_tokyu8500', 'train.tq03');
- }
- if (speed > 0.01)
- {
- if (speed >= 60 && speed < 80)
- {
- var pitch0 = 0.009 * speed+0.5;
- var vol5 = 0.05 * speed-3.0;
- su.playSound('sound_tokyu8500', 'train.tq01', vol5, pitch0);
- }
- else if (speed >= 80 && speed < 120)
- {
- var pitch0 = 0.009 * speed+0.5;
- var vol5 = 0.025 * speed-1.0;
- su.playSound('sound_tokyu8500', 'train.tq01', vol5, pitch0);
- }
- else
- {
- su.stopSound('sound_tokyu8500', 'train.tq01');
- }
- }
- else
- {
- su.stopSound('sound_tokyu8500', 'train.tq01');
- }
- if(notch >= 1 && speed > 0.01)
- {
- if (speed >= 0.01 && speed < 2)
- {
- var pitch0 = 0.06 * speed+0.5;
- var vol3 = 0.25 * speed;
- su.playSound('sound_tokyu8500', 'train.tq04', vol3, pitch0);
- }
- else if (speed >= 2 && speed < 20)
- {
- var pitch0 = 0.06 * speed+0.5;
- var vol3 = 0.005 * speed+0.49;
- su.playSound('sound_tokyu8500', 'train.tq04', vol3, pitch0);
- }
- else
- {
- su.stopSound('sound_tokyu8500', 'train.tq04');
- }
- if (speed >= 20 && speed < 25)
- {
- var pitch0 = 0.06 * speed-0.2;
- var vol3 = 0.001 * speed+0.57;
- su.playSound('sound_tokyu8500', 'train.tq05', vol3, pitch0);
- }
- else if (speed >= 25 && speed < 30)
- {
- var pitch0 = 0.04 * speed+0.3;
- var vol3 = 0.001 * speed+0.57;
- su.playSound('sound_tokyu8500', 'train.tq05', vol3, pitch0);
- }
- else if (speed >= 30 && speed < 40)
- {
- var pitch0 = 0.01 * speed+1.2;
- var vol3 = -0.06 * speed+2.4;
- su.playSound('sound_tokyu8500', 'train.tq05', vol3, pitch0);
- }
- else
- {
- su.stopSound('sound_tokyu8500', 'train.tq05');
- }
- }
- else
- {
- su.stopSound('sound_tokyu8500', 'train.tq04');
- su.stopSound('sound_tokyu8500', 'train.tq05');
- }
- }
- function sound_compressor(su)
- {
- var count = su.getData("count");
- if (su.isComplessorActive() )
- {
- if (count < 200)
- {
- su.playSound('sound_tokyu8500', 'train.tq8500cp00', 1, 1, false);
- su.stopSound('sound_tokyu8500', 'train.tq8500cp02');
- count++;
- }
- else
- {
- su.playSound('sound_tokyu8500', 'train.tq8500cp01', 1, 1);
- }
- }
- else
- {
- su.stopSound('sound_tokyu8500', 'train.tq8500cp00');
- su.stopSound('sound_tokyu8500', 'train.tq8500cp01');
- su.playSound('sound_tokyu8500', 'train.tq8500cp02', 1, 1, false);
- }
- su.setData("count", count);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement