Now, taking a script from previous sounded vehicles and copypasting/editing isn't as easy as it seems I guess.
I'm trying to get the Humvee Pickup vehicle from Gravity Cat to play sounds when it moves at all- and an idle sound when its not moving.
No error, but it doesn't do anything.
function gc_HumveePickupVehicleSpeedCh eck(%obj)
{
if(!isObject(%obj))
return;
%vehicle = %obj;
%datablock = gc_HumveePickupVehicle;
%slot = 0; //Play the sound in the driver's spot
%speed = vectorLen(%obj.getVelocity());
if(%speed < 0) //Keeps throwing random negative numbers when train is at dead stop
%speed = 0;
if(%speed < 2)
{
%vehicle.playAudio(%slot, HumveeDriveSound);
}
else
{
%vehicle.playAudio(%slot, HumveeIdleSound);
}
schedule(500,0,"gc_HumveePickupVehicleSpeedCh eck",%obj);
}