Python script for driving sounds?

I really need some help with a script to create an idle, acceleration/deceleration, braking and reverse sounds for a simple driving sim I’ve cobbled together in 2.49b using the Bueraki vehicle scripts etc. If it’s not against this sites policy I can offer modest remuneration for actually writing a script. I’ve attached an early version with all the basic elements.

Attachments

240Z_test.blend (554 KB)

let me dig through my files and find that script, rubbernuke posted that most basic version, ive got one that now does gears and all that other good stuff :smiley:

#######ENGINE SOUND SCRIPT by qazwsx2541(kendrick2541)########
##################### 2.49b ###########################
# The object that this script is attached to, must have the following properties:
# -NAME-     -TYPE-      -VALUE-
# "speed"    "INT"        "0"
# "gear"     "INT"        "1"
# "maxspeed" "INT" (enter the desired max speed of your vehicle)
#
# A sound actuator named "sound" must also be attached to this controller
# the sound actuator must have an engine sound assined to it
#
################# ©2011 PowerSurgeGames ########################



##### Get Required Information #####

controller = GameLogic.getCurrentController()
obj = controller.owner
pointVel = obj.getLinearVelocity(True)
obj['speed'] = pointVel[1] * 4
gear = obj['gear']
speed = obj['speed'] / 6
max = obj['maxspeed']
rat1 = max / 20
rat2 = max / 13
rat3 = max / 9
rat4 = max / 5
rat5 = max / 2


##### GEARS #####
if speed < rat1:
	gear = 1
if speed > rat1 and speed < rat2:
	gear = 2
if speed > rat2 and speed < rat3:
	gear = 3
if speed > rat3 and speed < rat4:
	gear = 4
if speed > rat4 and speed < rat5:
	gear = 5
obj['gear'] = gear

##### Use Values to change sound pitch #####
gear = gear * 10
speed = float(obj['speed']) / gear
sound = controller.actuators['sound']
sound.pitch = speed * 1.2
if sound.pitch < 1:
	sound.pitch = 1
controller.activate(sound)

Thanks for the replies …looks cool! I’ll try it out tonight.