SWBFGamers

Modding for the Original SWBF1 and SWBF2 => SWBF2 Modding => Topic started by: i2Bros on December 05, 2017, 02:13:53 AM

Title: Custom Sounds working only on vanilla maps
Post by: i2Bros on December 05, 2017, 02:13:53 AM
I am really losing my head on this. What's going on? I can hear everything but the custom weapons sounds
That's my 025.lua script
[spoiler]--
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("setup_teams")
   

   --  CIS Attacking (attacker is always #1)
    CIS = 1;
    REP = 2;
    --  These variables do not change
    ATT = CIS;
    DEF = REP;


function ScriptPostLoad()

    cp1 = CommandPost:New{name = "cp1"}
    cp2 = CommandPost:New{name = "cp2"}
    cp3 = CommandPost:New{name = "cp4"}
    cp4 = CommandPost:New{name = "cp5"}
    cp5 = CommandPost:New{name = "cp6"}
    cp6 = CommandPost:New{name = "cp7"}
    cp7 = CommandPost:New{name = "cp8"}
    cp8 = CommandPost:New{name = "cp9"}
    cp9 = CommandPost:New{name = "cp10"}
    cp10 = CommandPost:New{name = "cp12"}
   
   
    --This sets up the actual objective.  This needs to happen after cp's are defined
    conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF,
                                     textATT = "game.modes.con",
                                     textDEF = "game.modes.con2",
                                     multiplayerRules = true}
   
    --This adds the CPs to the objective.  This needs to happen after the objective is set up
    conquest:AddCommandPost(cp1)
    conquest:AddCommandPost(cp2)
    conquest:AddCommandPost(cp3)
    conquest:AddCommandPost(cp4)
    conquest:AddCommandPost(cp5)
    conquest:AddCommandPost(cp6)
    conquest:AddCommandPost(cp7)
    conquest:AddCommandPost(cp8)
    conquest:AddCommandPost(cp9)
    conquest:AddCommandPost(cp10)
   
    conquest:Start()
   
      onfirstspawn = OnCharacterSpawn(
           function(character)
               if IsCharacterHuman(character) then
                  SetProperty(GetCharacterUnit(character), "AddHealth", 50)
               end
           end)

    EnableSPHeroRules()

   
end


---------------------------------------------------------------------------
-- FUNCTION:    ScriptInit
-- PURPOSE:     This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES:       The name, 'ScriptInit' is a chosen convention, and each
--              mission script must contain a version of this function, as
--              it is called from C to start the mission.
---------------------------------------------------------------------------

function ScriptInit()

ReadDataFile("dc:Load\\common.lvl")

    SetUberMode(1);   
    ReadDataFile("ingame.lvl")
   

    SetMaxFlyHeight(186)
    SetMaxPlayerFlyHeight(186)
   
   SetMemoryPoolSize ("Combo",200)              -- should be ~ 2x number of jedi classes
   SetMemoryPoolSize ("Combo::State",500)      -- should be ~12x #Combo
   SetMemoryPoolSize ("Combo::Transition",500) -- should be a bit bigger than #Combo::State
   SetMemoryPoolSize ("Combo::Condition",500)  -- should be a bit bigger than #Combo::State
   SetMemoryPoolSize ("Combo::Attack",500)     -- should be ~8-12x #Combo
   SetMemoryPoolSize ("Combo::DamageSample",4000)  -- should be ~8-12x #Combo::Attack
   SetMemoryPoolSize ("Combo::Deflect",500)     -- should be ~1x #combo
   SetMemoryPoolSize ("ClothData",200)
   SetMemoryPoolSize ("EntityCloth",200)
   SetMemoryPoolSize ("Music", 200)

    ReadDataFile("sound\\kas.lvl;kas2cw")
ReadDataFile("dc:sound\\025.lvl;025cw")

ReadDataFile("dc:sound\\bot.lvl")
OpenAudioStream("dc:sound\\bot.lvl", "BOT_Unit_VO_S")
ReadDataFile("dc:sound\\bot.lvl;BOTcw")


    ReadDataFile("dc:SIDE\\Krell.lvl",
                             "rep_hero_krell")
    ReadDataFile("dc:SIDE\\501.lvl",
                             "501_inf_ep3_rifleman",
                "501_inf_ep3_rocketeer",
                "501_inf_ep3_engineer",
                "501_inf_ep3_sniper",
                "501_inf_ep3_medic",
                "501_inf_ep3_arf",
                "rep_inf_hardcase",
                "rep_inf_dogma",
                "rep_inf_fives",
                "rep_inf_rex",
                             "rep_walk_oneman_atst",
                             "rep_walk_atte",
              "rep_fly_gunship",
              "rep_fly_gunship2",
              "rep_fly_gunship3",
                             "rep_hero_anakin",
                             "rep_hover_barcspeeder")
    ReadDataFile("dc:SIDE\\cis.lvl",
                             "umb_inf_Umbaran_01",
                             "umb_inf_Umbaran_02",
                             "umb_inf_Umbaran_03",
                "cis_inf_engineer",
                "cis_inf_commander",
                "umb_inf_Umbaran_08",
                "cis_inf_tactical",
                "cis_inf_officer",
                             "cis_inf_droideka",
                             "cis_hero_darthmaul",
             "cis_fly_ufighter",
            "cis_hover_utank",
              "umb_walk_spider",
                                    "cis_hover_aat")
                             
                             
    ReadDataFile("SIDE\\tur.lvl",
             "tur_bldg_laser",
             "tur_bldg_tower")         
                             
   SetupTeams{
      rep = {
         team = REP,
         units = 203,
         reinforcements = 750,
         soldier  = { "501_inf_ep3_rifleman",85, 100},
         assault  = { "501_inf_ep3_rocketeer",75, 100},
         engineer = { "501_inf_ep3_engineer",10, 40},
         sniper   = { "501_inf_ep3_sniper",9, 25},
         officer = {"501_inf_ep3_medic",1, 4},
         special = { "501_inf_ep3_arf",20, 25},
          
      },
      cis = {
         team = CIS,
         units = 203,
         reinforcements = 750,
         soldier  = { "umb_inf_Umbaran_01",75, 100},
         assault  = { "umb_inf_Umbaran_02",55, 100},
         engineer = { "cis_inf_engineer",10, 40},
         sniper   = { "umb_inf_Umbaran_03",10, 40},
         officer = {"cis_inf_officer",30, 40},
         special = { "cis_inf_droideka",10, 40},
      }
   }

      AddUnitClass(CIS, "cis_inf_commander",1,2)
      AddUnitClass(CIS, "umb_inf_Umbaran_08",1,2)
      AddUnitClass(CIS, "cis_inf_tactical",1,1)
      AddUnitClass(REP, "rep_inf_dogma",1,1)
      AddUnitClass(REP, "rep_inf_fives",1,1)
     AddUnitClass(REP, "rep_inf_rex",1,1)
     
    SetHeroClass(CIS, "cis_hero_darthmaul")
    SetHeroClass(REP, "rep_hero_krell")
   

    --  Level Stats
    --  ClearWalkers()
AddWalkerType(0, 4)-- special -> droidekas
AddWalkerType(1, 4)-- 1x2 (1 pair of legs)
AddWalkerType(2, 0)-- 2x2 (2 pairs of legs)
AddWalkerType(3, 0)-- 3x2 (3 pairs of legs)
SetMemoryPoolSize("PowerupItem", 60)
SetMemoryPoolSize("EntityMine", 40)
SetMemoryPoolSize("WalkerLegPair", 12)
--SetMemoryPoolSize("TreeGridStack", 960)
SetMemoryPoolSize("TreeGridStack", 999)
SetMemoryPoolSize("EntityHover", 14)
SetMemoryPoolSize("EntityWalker", 4)
SetMemoryPoolSize("CommandWalker", 4)
SetMemoryPoolSize("EntityFlyer", 8)
SetMemoryPoolSize("Aimer", 500)
SetMemoryPoolSize("EntityLight", 500)
SetMemoryPoolSize("Obstacle", 999)
SetMemoryPoolSize("WalkerBlendUnit", 60)

    --  Attacker Stats
    --SetTeamAsFriend(ATT, 3)

    --  Defender Stats
    --SetTeamAsEnemy(DEF, 3)
   
SetSpawnDelay(10.0, 0.25)
    --ReadDataFile("dc:025\\025.lvl", "025_conquest")
    ReadDataFile("dc:025\\025.lvl", "025_conquest")
    SetDenseEnvironment("false")

    AddDeathRegion("Death1");
    AddDeathRegion("Death2");
    AddDeathRegion("Death3");
    AddDeathRegion("Death4");
    AddDeathRegion("Death5");
    AddDeathRegion("Death6");
    AddDeathRegion("Death7");
    AddDeathRegion("Death8");
    AddDeathRegion("Death9");
    AddDeathRegion("Death10");
    AddDeathRegion("Death11");
    AddDeathRegion("Death12");
    AddDeathRegion("Death13");
    AddDeathRegion("Death14");
    AddDeathRegion("Death15");
    AddDeathRegion("Death16");
    AddDeathRegion("Death17");
    AddDeathRegion("Death18");
    AddDeathRegion("Death19");
    AddDeathRegion("Death20");
    AddDeathRegion("Death21");
    AddDeathRegion("Death22");
    AddDeathRegion("Death23");
    AddDeathRegion("Death24");

--  Birdies
    SetNumBirdTypes(2);
    SetBirdType(0,1.0,"bird3");
    SetBirdType(1,1.5,"bird4");

    --  Sound
   
    voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
    AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_slow", voiceSlow)
    AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)
   
    voiceQuick = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_quick")
    AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_quick", voiceQuick)

    OpenAudioStream("sound\\global.lvl",  "cw_music")
    OpenAudioStream("dc:sound\\025.lvl",  "025gcw_music")
    OpenAudioStream("dc:sound\\025.lvl",  "025gcw")
    OpenAudioStream("sound\\kas.lvl",  "kas")
    OpenAudioStream("sound\\kas.lvl",  "kas")

    OpenAudioStream("dc:sound\\025.lvl",  "025")
    OpenAudioStream("dc:sound\\025.lvl",  "025")


       SetBleedingVoiceOver(REP, REP, "rep_off_com_report_us_overwhelmed", 1)
       SetBleedingVoiceOver(REP, CIS, "rep_off_com_report_enemy_losing",   1)
       SetBleedingVoiceOver(CIS, REP, "cis_off_com_report_enemy_losing",   1)
       SetBleedingVoiceOver(CIS, CIS, "cis_off_com_report_us_overwhelmed", 1)
       
       SetLowReinforcementsVoiceOver(REP, REP, "rep_off_defeat_im", .1, 1)
       SetLowReinforcementsVoiceOver(REP, CIS, "rep_off_victory_im", .1, 1)
       SetLowReinforcementsVoiceOver(CIS, CIS, "cis_off_defeat_im", .1, 1)
       SetLowReinforcementsVoiceOver(CIS, REP, "cis_off_victory_im", .1, 1)     
   
    SetAmbientMusic(REP, 1.0, "imp_umb_amb_start",  0,1)
    SetAmbientMusic(REP, 0.9, "imp_umb_amb_middle", 1,1)
    SetAmbientMusic(REP, 0.1, "imp_umb_amb_end",    2,1)
    SetAmbientMusic(CIS, 1.0, "all_umb_amb_start",  0,1)
    SetAmbientMusic(CIS, 0.9, "all_umb_amb_middle", 1,1)
    SetAmbientMusic(CIS, 0.1, "all_umb_amb_end",    2,1)

    SetVictoryMusic(REP, "rep_kas_amb_victory")
    SetDefeatMusic (REP, "rep_kas_amb_defeat")
    SetVictoryMusic(CIS, "cis_kas_amb_victory")
    SetDefeatMusic (CIS, "cis_kas_amb_defeat")

    SetOutOfBoundsVoiceOver(2, "Repleaving")
    SetOutOfBoundsVoiceOver(1, "Cisleaving")

    SetSoundEffect("ScopeDisplayZoomIn",  "binocularzoomin")
    SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
    --SetSoundEffect("WeaponUnableSelect",  "com_weap_inf_weaponchange_null")
    --SetSoundEffect("WeaponModeUnableSelect",  "com_weap_inf_modechange_null")
    SetSoundEffect("SpawnDisplayUnitChange",       "shell_select_unit")
    SetSoundEffect("SpawnDisplayUnitAccept",       "shell_menu_enter")
    SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change")
    SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter")
    SetSoundEffect("SpawnDisplayBack",             "shell_menu_exit")

--start camerashots
--highway
AddCameraShot(0.866429, 0.000000, 0.497798, 0.000000, 218.657883, 15.766537, 142.812714);
--tentacules
AddCameraShot(-0.318809, 0.000000, -0.946403, 0.000000, 27.424097, 29.265772, -521.292725);
--bridge
AddCameraShot(0.703257, 0.000000, -0.710362, 0.000000, 119.500610, 42.950558, 208.319794);
--end camerashots

end

[/spoiler]
Title: Re: Custom Sounds working only on vanilla maps
Post by: Ginev on December 06, 2017, 08:14:18 AM
Maybe the problem is in your sounds folder.I am having a sound tutorial.DId you tryed it.You made the sound.lvl by yourself right?
Title: Re: Custom Sounds working only on vanilla maps
Post by: LitFam on December 06, 2017, 09:12:26 AM
Actually I made the bot .lvl sound file. I let i2Bros use the bot.lvl file. As far as I know the sound file works, so all the coding is right.

Now I have zero idea why non vanilla maps reject the bot .lvl file. i2Bros try loading my sound .lvl file before the other sound .lvl files maybe this will fix the issue.

ReadDataFile("dc:sound\\bot.lvl")
OpenAudioStream("dc:sound\\bot.lvl", "BOT_Unit_VO_S")
ReadDataFile("dc:sound\\bot.lvl;BOTcw")
Title: Re: Custom Sounds working only on vanilla maps
Post by: i2Bros on December 06, 2017, 02:11:16 PM
if I do, only 025.lvl works, but kas.lvl doesn't.
EDIT: changing kas.lvl with yav1.lvl everything works fine.
EhPortal 1.34 © 2024, WebDev