Author Topic: Playing 2 sounds at once on a vehicle  (Read 1290 times)

Ok. I have a vehicle I want to modify. How can I add a horn that is clickpress-clickrelease basis? Also, my horn has sequencing. A beginning ring, a middle ring, and an end ring.

The beginning will always be played, middle will play until the end ring, then the "end" ring will ring when the mouse is released.



Also, what are some functions such as detecting when the brakes are applied, and how is it possible to have different sounds when the train is between speed X and speed Y.
« Last Edit: March 26, 2009, 03:46:35 PM by Kalphiter »


%vehicle.playAudio(%slot,%sound) will start playing a sound from the vehicle's position.
%vehicle.stopAudio(%slot) or just playing another sound from the same slot will stop it.
You can use both of these to play the three sounds in order and have them 'fit' together - play startSound, schedule the middle one as 'looping', play the end one on mouse release.

Use Armor::onTrigger or VehicleData::onTrigger to start the sounds. I think there's some Add-Ons that use these which you could use for an example. (e.g. Box Truck uses the jump key as a trigger for an animation in a similar way)

Ok, for %vehicle, is it just a parameter in those functions you mentioned(in other words, I'll just look at F18)?


%vehicle is whatever object you have as the vehicle in the functions. Probably the %obj parameter of the trigger function you have.

The "Handbrake" can be activated on a vehicle by pressing the Jump key (try moving in a Jeep then holding jump, you stop quickly), so you could use that as a trigger for the sounds. Alternately, look at the Stunt Plane and how it applies the trail particles/propeller speed animations, which are activated when you are moving faster or slower.

%vehicle is whatever object you have as the vehicle in the functions. Probably the %obj parameter of the trigger function you have.

The "Handbrake" can be activated on a vehicle by pressing the Jump key (try moving in a Jeep then holding jump, you stop quickly), so you could use that as a trigger for the sounds. Alternately, look at the Stunt Plane and how it applies the trail particles/propeller speed animations, which are activated when you are moving faster or slower.
One question.

I don't want the person to leave the vehicle to brake, just at any point where there is manual deceleration(as compared to the engineBrake).

Also, what is %slot?

It won't - Jet is to leave the vehicle. Jump is handbrake. Unless you have Jump+Jet Combo enabled... However, this won't detect when you're holding Move Backwards to slow down. (the typical method)

%slot is the slot you're mounted in, 0 for the driver.

It won't - Jet is to leave the vehicle. Jump is handbrake. Unless you have Jump+Jet Combo enabled... However, this won't detect when you're holding Move Backwards to slow down. (the typical method)

%slot is the slot you're mounted in, 0 for the driver.
Thanks it worked correctly, took forever until I noticed that I missed a few ";".

I also released that I could play the break sound whenever the original recorded speed is greater then the current speed.

Currently, my problem is that I can't get two sounds to play at once.
How can I achieve this, by playing to another slot?




Ok. I also need to know how I can calculate deceleration using a ----torque value(such as brakeTorque), and might the mass be a factor?
« Last Edit: March 10, 2009, 05:04:00 PM by Kalphiter »



Bump

Recap: need to know how to play two sounds at once.


You don't understand.

A click-activated horn needs to stop and start according to the click.

The engine depends on the speed.



I can't have them play as one track.