[Tutorial] Optimize Sounds for Vehicles (Buggy, Striker and Killer)

Results 1 to 10 of 10
  1. #1
    failed in javascript ItzFdr is offline
    MemberRank
    May 2013 Join Date
    BrasilLocation
    293Posts

    [Tutorial] Optimize Sounds for Vehicles (All Right Source)

    This Tutorial, is for "Improve" Sounds on Car, Like that video:

    https://www.youtube.com/watch?v=mthsVHd9Y9c

    ONLY WORK ON AllRight Source
    Okay, lets go to Tutorial!

    In obj_Vehicle.cpp Search for this...
    PHP Code:
    void obj_Vehicle::UpdateEngineSound() 
    And Change for this
    PHP Code:
    void obj_Vehicle::UpdateEngineSound()
    {    
    // ONLY SAME CAR!!!!!!!!!!!!!!!!    
    //if (!EngineSnd) return;   
     
    if (!gClientLogic().localPlayer_) return;   
     if (
    gClientLogic().localPlayer_->curcar == NULL) return;    
    if (
    gClientLogic().localPlayer_->curcar != this) return;    
    //if (!status) return;
        
    if (!SoundSys.IsHandleValid(EngineSnd))    
     {       
     if (
    EngineSnd)        
    SoundSys.Release(EngineSnd);       
     
    EngineSnd NULL;        
    //EngineSnd = SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/DuneBuggyEngineLoop"), GetPosition());        
    {       
     if(
    FileName == "data/objectsdepot/vehicles/drivable_stryker.sco"//Fdr Novos sons para o carro...                
    EngineSnd SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngineLoop"), GetPosition());
        else if (
    FileName == "data/objectsdepot/vehicles/drivable_buggy_02.sco")                
    EngineSnd SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/DuneBuggyEngineLoop"), GetPosition());                
    else if  (
    FileName == "data/objectsdepot/vehicles/zombie_killer_car.sco")                
    EngineSnd SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngineLoop"), GetPosition());  
                  
    else            
    EngineSnd NULL;       
     }    
            
    SoundSys.Stop(EngineSnd);       
     if (!
    SoundSys.IsHandleValid(EngineSnd)) 
    return;    
    }
        
    //else if(!SoundSys.isPlaying(EngineSnd))  
      
    if (fuel 2)        
    SoundSys.Stop(EngineSnd);    
      else      
      if(!
    SoundSys.isPlaying(EngineSnd))            
     
    SoundSys.Start(EngineSnd);
        
    float rpm;
        if (
    gClientLogic().localPlayer_->isDriving() && gClientLogic().localPlayer_->curcar == this)        
    rpm R3D_MIN(getVehicleDescriptor()->vehicle->mDriveDynData.getEngineRotationSpeed()*5.33f8000.0f);    
    else  
     
    rpm R3D_MIN(getVehicleDescriptor()->vehicle->mDriveDynData.getEngineRotationSpeed()*7.33f8000.0f);
    SoundSys.SetParamValue(EngineSnd,"rpm",rpm);    
    SoundSys.SetSoundPos(EngineSnd,GetPosition());

    Like That
    PHP Code:
    // Engine 
    void obj_Vehicle::UpdateEngineSound
    ()
    {    
    // ONLY SAME CAR!!!!!!!!!!!!!!!!    
    //if (!EngineSnd) return;   
     
    if (!gClientLogic().localPlayer_) return;   
     if (
    gClientLogic().localPlayer_->curcar == NULL) return;    
    if (
    gClientLogic().localPlayer_->curcar != this) return;    
    //if (!status) return;
        
    if (!SoundSys.IsHandleValid(EngineSnd))    
     {       
     if (
    EngineSnd)        
    SoundSys.Release(EngineSnd);       
     
    EngineSnd NULL;        
    //EngineSnd = SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/DuneBuggyEngineLoop"), GetPosition());        
    {       
     if(
    FileName == "data/objectsdepot/vehicles/drivable_stryker.sco"//Fdr Novos sons para o carro...                
    EngineSnd SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngineLoop"), GetPosition());
        else if (
    FileName == "data/objectsdepot/vehicles/drivable_buggy_02.sco")                
    EngineSnd SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/DuneBuggyEngineLoop"), GetPosition());                
    else if  (
    FileName == "data/objectsdepot/vehicles/zombie_killer_car.sco")                
    EngineSnd SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngineLoop"), GetPosition());  
                  
    else            
    EngineSnd NULL;       
     }    
            
    SoundSys.Stop(EngineSnd);       
     if (!
    SoundSys.IsHandleValid(EngineSnd)) 
    return;    
    }
        
    //else if(!SoundSys.isPlaying(EngineSnd))  
      
    if (fuel 2)        
    SoundSys.Stop(EngineSnd);    
      else      
      if(!
    SoundSys.isPlaying(EngineSnd))            
     
    SoundSys.Start(EngineSnd);
        
    float rpm;
        if (
    gClientLogic().localPlayer_->isDriving() && gClientLogic().localPlayer_->curcar == this)        
    rpm R3D_MIN(getVehicleDescriptor()->vehicle->mDriveDynData.getEngineRotationSpeed()*5.33f8000.0f);    
    else  
     
    rpm R3D_MIN(getVehicleDescriptor()->vehicle->mDriveDynData.getEngineRotationSpeed()*7.33f8000.0f);
    SoundSys.SetParamValue(EngineSnd,"rpm",rpm);    
    SoundSys.SetSoundPos(EngineSnd,GetPosition());
    }
    void obj_Vehicle::UpdateTraction() 
    Now Search for this
    PHP Code:
    BOOL obj_Vehicle::OnCreate() 
    And Change for this.
    PHP Code:
    BOOL obj_Vehicle::OnCreate()
    {    
    m_ActionUI_Title gLangMngr.getString("Vehicle");    
    m_ActionUI_Msg gLangMngr.getString("Hold E To Enter Vehicle");
        if (!
    parent::OnCreate())        
    return 
    FALSE;
        
    r3dMesh *MeshLOD[0];   
     if (!
    m)       
     return 
    FALSE;
        
    vd g_pPhysicsWorld->m_VehicleManager->CreateVehicle(m);   
     if (
    vd)    
    {        
    //    Set position and orientation for car        
    SwitchToDrivable(d_drive_vehicles->GetBool());        
    SyncPhysicsPoseWithObjectPose();        
    r3dBoundBox bb GetBBoxLocal();        
    std::swap(bb.Size.xbb.Size.z);        
    std::swap(bb.Org.xbb.Org.z);        
    SetBBoxLocal(bb);        
    vd->owner this;    
    }    
    if (
    FileName == "data/objectsdepot/vehicles/drivable_stryker.sco"//Fdr - Novos sons para o carro...        
    {        
    EngineSnd SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngineLoop"), GetPosition());       
    }
        if (
    FileName == "data/objectsdepot/vehicles/drivable_buggy_02.sco")        
    {       
    EngineSnd SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/DuneBuggyEngineLoop"), GetPosition());       
     }
        if (
    FileName == "data/objectsdepot/vehicles/zombie_killer_car.sco")       
     {        
    EngineSnd SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngineLoop"), GetPosition());        
    }
        
    netMover.Teleport(GetPosition());
        
    dura 100.0f;
        
    RemoteSpeed 0.0f;
        
    //extime = 0.0f;
        //(obj_ParticleSystem*)srv_CreateGameObject("obj_ParticleSystem", "Fire_Large_01", GetPosition() );
        
    Light = (obj_LightHelper*)srv_CreateGameObject("obj_LightHelper""Spot"GetPosition ());    
    Light->SetRotationVector(GetRotationVector());    
    //Light->m_pPreset = m_pPreset;    
    Light->SetPosition(GetBBoxWorld().Center());    
    Light->Color r3dColor::white;;    
    /*Light->LT.bDiffuseOnly = 0;    
    Light->LT.bCastShadows = 0;   
     Light->LT.bDiffuseOnly = 0;   
     Light->LT.bDiffuseOnly = 0;*/   
     /*    Light->LT.Intensity = 4.0f;    
    Light->bOn = true;   
     Light->innerRadius = 30.0f;   
     Light->outerRadius = 40.0f;*/   
     
    Light->LT.Intensity 0.0f;  
      
    Light->bOn true;  
      
    Light->innerRadius 0.0f;  
      
    Light->outerRadius 0.0f;   
     
    Light->bKilled false;
        
    //Light->bSerialized = true;
        //bOn = false;
        
    m_ParticleTracer NULL;
        
    //fuel = 100;
        // Sound
        //EngineSnd = NULL;
        //EngineSnd = SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/DuneBuggyEngineLoop"), GetPosition());    
    SoundSys.Stop(EngineSnd);    
    r3d_assert(EngineSnd);
        return 
    vd != 0;

    Like That
    PHP Code:
    BOOL obj_Vehicle::OnCreate()
    {    
    m_ActionUI_Title gLangMngr.getString("Vehicle");    
    m_ActionUI_Msg gLangMngr.getString("Hold E To Enter Vehicle");
        if (!
    parent::OnCreate())        
    return 
    FALSE;
        
    r3dMesh *MeshLOD[0];   
     if (!
    m)       
     return 
    FALSE;
        
    vd g_pPhysicsWorld->m_VehicleManager->CreateVehicle(m);   
     if (
    vd)    
    {       
     
    //    Set position and orientation for car        
    SwitchToDrivable(d_drive_vehicles->GetBool());        
    SyncPhysicsPoseWithObjectPose();        
    r3dBoundBox bb GetBBoxLocal();        
    std::swap(bb.Size.xbb.Size.z);        
    std::swap(bb.Org.xbb.Org.z);        
    SetBBoxLocal(bb);        
    vd->owner this;    
    }    
    if (
    FileName == "data/objectsdepot/vehicles/drivable_stryker.sco"//Fdr - Novos sons para o carro...        
    {        
    EngineSnd SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngineLoop"), GetPosition());       
    }
        if (
    FileName == "data/objectsdepot/vehicles/drivable_buggy_02.sco")        
    {       
    EngineSnd SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/DuneBuggyEngineLoop"), GetPosition());       
     }
        if (
    FileName == "data/objectsdepot/vehicles/zombie_killer_car.sco")       
     {        
    EngineSnd SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngineLoop"), GetPosition());        
    }
        
    netMover.Teleport(GetPosition());
        
    dura 100.0f;
        
    RemoteSpeed 0.0f;
        
    //extime = 0.0f;
        //(obj_ParticleSystem*)srv_CreateGameObject("obj_ParticleSystem", "Fire_Large_01", GetPosition() );
        
    Light = (obj_LightHelper*)srv_CreateGameObject("obj_LightHelper""Spot"GetPosition ());    
    Light->SetRotationVector(GetRotationVector());    
    //Light->m_pPreset = m_pPreset;    
    Light->SetPosition(GetBBoxWorld().Center());    
    Light->Color r3dColor::white;;    
    /*Light->LT.bDiffuseOnly = 0;    
    Light->LT.bCastShadows = 0;   
     Light->LT.bDiffuseOnly = 0;   
     Light->LT.bDiffuseOnly = 0;*/   
     /*    Light->LT.Intensity = 4.0f;    
    Light->bOn = true;   
     Light->innerRadius = 30.0f;   
     Light->outerRadius = 40.0f;*/   
     
    Light->LT.Intensity 0.0f;  
      
    Light->bOn true;  
      
    Light->innerRadius 0.0f;  
      
    Light->outerRadius 0.0f;   
     
    Light->bKilled false;
        
    //Light->bSerialized = true;
        //bOn = false;
        
    m_ParticleTracer NULL;
        
    //fuel = 100;
        // Sound
        //EngineSnd = NULL;
        //EngineSnd = SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/DuneBuggyEngineLoop"), GetPosition());    
    SoundSys.Stop(EngineSnd);    
    r3d_assert(EngineSnd);
        return 
    vd != 0;
    }
    ////////////////////////////////////////////////////////////////////////// 
    Now in Al_Player.cpp Search for this
    PHP Code:
    if(dropObj->Class->Name == "obj_Vehicle"
    And Change for this
    PHP Code:
    if(dropObj->Class->Name == "obj_Vehicle")                              
     {               
    obj_Vehicletarget_Vehicle = (obj_Vehicle*)dropObj;                    
    if ( 
    target_Vehicle  // now we're going to try to use vehicles (otherwise UAV characters can't use vehicles).                   
    {                        
    if ( 
    target_Vehicle->status )                        
    {                            
    //hudMain->showMessage(L"Cannot enter vehicle");                            
    curcar target_Vehicle;                            
    vehicleViewActive_ VehicleView_Passenger;                            
    hudActionUI->Deactivate();                            
    TogglePhysicsSimulation(false);                            
    PKT_C2C_CarPass_s n;                            
    n.NetID toP2pNetId(target_Vehicle->GetNetworkID());                           
    p2pSendToHost(gClientLogic().localPlayer_, &nsizeof(n));                            
    return;                        
    }                        
    hudActionUI->showEBlock(false,false);                        
    hudActionUI->Deactivate();                        
    d_drive_vehiclescon->SetBool(true);                        
    enterVehicletarget_Vehicle );                        
    curcar target_Vehicle;                       
    //g_pPhysicsWorld->m_VehicleManager->DriveCar(target_Vehicle->vd);                    
    if (FileName == "data/objectsdepot/vehicles/drivable_stryker.sco"//Fdr Novos sons para o carro...        
    {        
    SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngine_Start"), GetPosition());         
    }    
    if (
    FileName == "data/objectsdepot/vehicles/drivable_buggy_02.sco")        
    {        
    SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/Vehicles/DuneBuggyEngine_Start"),GetPosition());       
    }   
    if (
    FileName == "data/objectsdepot/vehicles/zombie_killer_car.sco")        
    {        
    SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngine_Start"),GetPosition());            
    }                                                           
    }                
    return;                                

    Like That
    PHP Code:
    if(dropObj->Class->Name == "obj_Vehicle")                              
     {               
    obj_Vehicletarget_Vehicle = (obj_Vehicle*)dropObj;                    
    if ( 
    target_Vehicle  // now we're going to try to use vehicles (otherwise UAV characters can't use vehicles).                   
    {                        
    if ( 
    target_Vehicle->status )                        
    {                            
    //hudMain->showMessage(L"Cannot enter vehicle");                            
    curcar target_Vehicle;                            
    vehicleViewActive_ VehicleView_Passenger;                            
    hudActionUI->Deactivate();                            
    TogglePhysicsSimulation(false);                            
    PKT_C2C_CarPass_s n;                            
    n.NetID toP2pNetId(target_Vehicle->GetNetworkID());                           
    p2pSendToHost(gClientLogic().localPlayer_, &nsizeof(n));                            
    return;                        
    }                        
    hudActionUI->showEBlock(false,false);                        
    hudActionUI->Deactivate();                        
    d_drive_vehiclescon->SetBool(true);                        
    enterVehicletarget_Vehicle );                        
    curcar target_Vehicle;                       
    //g_pPhysicsWorld->m_VehicleManager->DriveCar(target_Vehicle->vd);                    
    }                
    // SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/Vehicles/DuneBuggyEngine_Start"),GetPosition());                    
    {                    
    if (
    FileName == "data/objectsdepot/vehicles/drivable_stryker.sco"//Fdr Novos sons para o carro...        
    {        
    SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngine_Start"), GetPosition());         
    }    
    if (
    FileName == "data/objectsdepot/vehicles/drivable_buggy_02.sco")        
    {        
    SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/Vehicles/DuneBuggyEngine_Start"),GetPosition());       
    }   
    if (
    FileName == "data/objectsdepot/vehicles/zombie_killer_car.sco")        
    {        
    SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngine_Start"),GetPosition());            
    }                                                           
    }                
    return;                                
    }
    if(
    dropObj->Class->Name == "obj_SafeLock"
    Now Search for This
    PHP Code:
    void obj_Player::exitVehicle() 
    And Change to this
    PHP Code:
    void obj_Player::exitVehicle()
    {    
    hudMain->setCarInfo(0,0,0,0,0,false);    
    //SoundSys.Stop(m_sndVehicleDrive);    
    //SoundSys.Play(SoundSys.GetEventIDByPath("Sounds/Vehicles/DuneBuggyEngine_Stop"), curcar->GetPosition(), true);    
    r3dVector targetPosition curcar->GetPosition() + r3dPoint3D43); 
    // Server Vehicles    TeleportPlayer( targetPosition, "Exiting vehicle");    
    curcar->SwitchToDrivablefalse );    
    vehicleViewActive_ VehicleView_None;    
    d_drive_vehiclescon->SetBool(false);    
    d_drive_vehicles->SetBoolfalse );    
    curcar->SwitchToDrivablefalse );    
    PKT_C2C_CarStatus_s n;    
    n.status false;    
    n.fuel curcar->fuel;    
    p2pSendToHost(curcar,&n,sizeof(n));    
    //    g_pPhysicsWorld->m_VehicleManager->getRealDrivenVehicle()->owner = NULL;    
    curcar->NetworkLocal false;    
    //g_pPhysicsWorld->m_VehicleManager->getRealDrivenVehicle()->vd->owner=0;    
    TogglePhysicsSimulation(true);

    if (
    FileName == "data/objectsdepot/vehicles/drivable_stryker.sco"//Fdr Novos sons para o carro...        
    {        
    SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngine_Stop"), GetPosition());        
    }    
    if (
    FileName == "data/objectsdepot/vehicles/drivable_buggy_02.sco")        
    {        
    SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/Vehicles/DuneBuggyEngine_Stop"), GetPosition());         
    }
    if (
    FileName == "data/objectsdepot/vehicles/zombie_killer_car.sco")        
    {        
    SoundSys.PlayAndForget(SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngine_Stop"), GetPosition());         
    }




    Credits: Aomosin - Source
    me for Codes ..
    Last edited by ItzFdr; 27-03-14 at 10:13 PM.


  2. #2
    Harro Syxn is offline
    MemberRank
    Mar 2013 Join Date
    767Posts

    Re: [Tutorial] Optimize Sounds for Vehicles (Buggy, Striker and Killer)

    Nice tutorial keep it up :)

  3. #3
    Alpha Member javaz97 is offline
    MemberRank
    May 2006 Join Date
    HellLocation
    1,537Posts

    Re: [Tutorial] Optimize Sounds for Vehicles (Buggy, Striker and Killer)

    plz mark the code with red color

  4. #4
    Alpha Member javaz97 is offline
    MemberRank
    May 2006 Join Date
    HellLocation
    1,537Posts

    Re: [Tutorial] Optimize Sounds for Vehicles (Buggy, Striker and Killer)

    and...more

    find
    if (isDriving() && d_drive_vehiclescon->GetBool())

    change
    fts = SoundSys.GetEventIDByPath("Sounds/Vehicles/DuneBuggy_Engine");

    to
    fts = SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngineLoop");

    ^^

  5. #5
    failed in javascript ItzFdr is offline
    MemberRank
    May 2013 Join Date
    BrasilLocation
    293Posts

    config Re: [Tutorial] Optimize Sounds for Vehicles (Buggy, Striker and Killer)

    Quote Originally Posted by javaz97 View Post
    and...more

    find
    if (isDriving() && d_drive_vehiclescon->GetBool())

    change
    fts = SoundSys.GetEventIDByPath("Sounds/Vehicles/DuneBuggy_Engine");

    to
    fts = SoundSys.GetEventIDByPath("Sounds/Vehicles/StrykerEngineLoop");

    ^^
    I gonna "improve" you code, thanks for posting xD

  6. #6
    Account Upgraded | Title Enabled! JonnyTruant is offline
    MemberRank
    Mar 2013 Join Date
    555Posts

    Re: [Tutorial] Optimize Sounds for Vehicles (Buggy, Striker and Killer)

    Of course, I believe you did beg someone to tell you how to do this.

    Thanks anyways.

  7. #7
    French Guy :D skyone is offline
    MemberRank
    Nov 2013 Join Date
    254Posts

    Re: [Tutorial] Optimize Sounds for Vehicles (Buggy, Striker and Killer)

    can someone help me ?

    http://puu.sh/7EFEi.png

  8. #8
    failed in javascript ItzFdr is offline
    MemberRank
    May 2013 Join Date
    BrasilLocation
    293Posts

    Re: [Tutorial] Optimize Sounds for Vehicles (Buggy, Striker and Killer)

    Quote Originally Posted by skyone View Post
    can someone help me ?

    http://puu.sh/7EFEi.png
    Sorry, its a error in my tutorial...

    I Fix this, if you need to fix this, remake my tutorial..I Update them

  9. #9
    French Guy :D skyone is offline
    MemberRank
    Nov 2013 Join Date
    254Posts

    Re: [Tutorial] Optimize Sounds for Vehicles (Buggy, Striker and Killer)

    Quote Originally Posted by fdrgamer View Post
    Sorry, its a error in my tutorial...

    I Fix this, if you need to fix this, remake my tutorial..I Update them
    thanks dude :)

  10. #10
    Member manhun1222 is offline
    MemberRank
    Jun 2013 Join Date
    68Posts

    Re: [Tutorial] Optimize Sounds for Vehicles (Buggy, Striker and Killer)

    i have 49 error message! help my please.
    http://pastebin.com/AwX0M2ad



Advertisement