1. Dismiss Notice
  2. GOG.com logo

    Thanks to YOUR votes, GOG.com now sells:
    - Sea Dogs - Sea Dogs: Caribbean Tales
    - Sea Dogs: City of Abandoned Ships

    Vote now to add Pirates of the Caribbean to the list!

    Dismiss Notice
  3. Under the Crossbones Podcast

    A Pirate Podcast with Interviews
    Music, Comedy and all things Pirate!

    - Episode Guide - About - Subscribe -
    - Twitter - Facebook - iTunes - Android -
    - Youtube - Fill the Coffers -

    Dismiss Notice
  4. New Horizons logo

    Quick links for PotC: New Horizons
    - Download latest version
    - Wiki - FAQ - Report bugs here
    - ModDB profile

  5. GOF logo

    Quick links for AoP2: Gentlemen of Fortune 2
    - Downloads and info
    - Historical Immersion Supermod
    - ModDB Profile

Dismiss Notice
New to the forum?
Please take a moment to read our Welcome Message and Forum Rules.

Need Help Sounds mod

Discussion in 'POTC: New Horizons Mod' started by Blackjack, Jun 7, 2017.

  1. Blackjack

    Blackjack Landlubber

    Joined:
    Jun 7, 2017
    Messages:
    6
    Gender:
    Male
    Occupation:
    PhD student in astrophysics
    Hi everyone,

    I've started a little mod on POTC New Horizons to improve sound environment for some locations.

    But I encountered a little problem...

    I created a sound scheme in sound_scheme.ini. I created a sound type location in sound.c (in the switch(loc.type)) linked with my sound scheme. And then I tried to change the type of a dockyard.

    Sounds worked perfectly as wanted but there was a problem. When my character was on the locator of the dockyard the little picture didn't show shipyard but the padlock.

    So I tried to fix the problem searching in many files but I didn't find where is the necessary code. Anyone can help?

    Thanks in advance :D

    Blackjack
     
  2. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    @Jack Rackham, I think you are the #1 expert to answer that question! :cheeky
     
  3. Jack Rackham

    Jack Rackham HoO Team Member Quest Writer Storm Modder

    Joined:
    Jul 5, 2004
    Messages:
    3,288
    Gender:
    Male
    Occupation:
    math teacher
    Location:
    Sund, Ramsjö, Sweden
    Dockyard is that a new type (of shipyard)? In that case no icon is prepared for it but that can be done.
    Don't remember at the moment where all changes are. What should the icon look like?
     
  4. Blackjack

    Blackjack Landlubber

    Joined:
    Jun 7, 2017
    Messages:
    6
    Gender:
    Male
    Occupation:
    PhD student in astrophysics
    The location type of the shipyards (I said dockyard but it's shipyard sorry) is "shop". As I want to change shipyard's sound scheme and not just shop's sound scheme I changed the location type (created by me).
    So I would like to keep the shipyard's icon because the location is still a shipyard! I thought that every icon was linked to a special type of location but location type is the same for shipyard and store for example :

    Code:
        Locations[n].id = "Falaise_de_fleur_shipyard";
        Locations[n].filespath.models = "locations\inside\shipyard2";
        locations[n].id.label = "#stown_name# shipyard";
        Locations[n].image = "Inside_Shipyard2.tga";
    
        //Town sack
        Locations[n].townsack = "Falaise de Fleur";
    
        //Sound
        locations[n].type = "shop";
        locations[n].fastreload = "Falaise_De_Fleur";
    (...)
        Locations[n].id = "Falaise_de_Fleur_store";
        locations[n].id.label = "#stown_name# store";
        Locations[n].filespath.models = "locations\inside\LargeStore";
        Locations[n].image = "Inside_LargeStore.tga";
    
        //Town sack
        Locations[n].townsack = "Falaise de Fleur";
    
        //Sound
        locations[n].type = "shop";
        locations[n].fastreload = "Falaise_De_Fleur";
    
    So how the difference is made between store and shipyard?

    And here is the code I've changed in Redmond.c :

    Code:
        Locations[n].id = "Redmond_Shipyard";
        locations[n].id.label = "#stown_name# shipyard";
        Locations[n].filespath.models = "locations\inside\Shipyard";
        Locations[n].image = "Inside_Shipyard1.tga";
    
        //Town sack
        Locations[n].townsack = "Redmond";
    
        //Sound
        locations[n].type = "shipyard_bj";
        locations[n].fastreload = "Redmond";
    I just need to know in which file(s) I need to change the code to keep the right icons. :cheeky
     
  5. Jack Rackham

    Jack Rackham HoO Team Member Quest Writer Storm Modder

    Joined:
    Jul 5, 2004
    Messages:
    3,288
    Gender:
    Male
    Occupation:
    math teacher
    Location:
    Sund, Ramsjö, Sweden
    The "shop" type was divided up depending on the location.id.

    I have made the fix for you. Line 163. :onya
    I'll upload it here but will also include it in my next upload.
     

    Attached Files:

    Pieter Boelen likes this.
  6. Blackjack

    Blackjack Landlubber

    Joined:
    Jun 7, 2017
    Messages:
    6
    Gender:
    Male
    Occupation:
    PhD student in astrophysics
    It works thank you! I will keep you informed of developments! :thumbs1
     
    Pieter Boelen likes this.
  7. Blackjack

    Blackjack Landlubber

    Joined:
    Jun 7, 2017
    Messages:
    6
    Gender:
    Male
    Occupation:
    PhD student in astrophysics
    Hi! I've another question! For me static sounds called "fireplace" don't work in interior locations (like blacksmith or houses). Is it the same for you?

    Here the file with the code I've added to fix the problem (line 1034). I can't set min and max distances but fortunately the sounds aren't too loud and the rendering seems to be good!
     

    Attached Files:

    • sound.c
      File size:
      43.1 KB
      Views:
      17
  8. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
  9. Jack Rackham

    Jack Rackham HoO Team Member Quest Writer Storm Modder

    Joined:
    Jul 5, 2004
    Messages:
    3,288
    Gender:
    Male
    Occupation:
    math teacher
    Location:
    Sund, Ramsjö, Sweden
    No, but I think I found it. Have to test a little more.
     
    Pieter Boelen likes this.
  10. Jack Rackham

    Jack Rackham HoO Team Member Quest Writer Storm Modder

    Joined:
    Jul 5, 2004
    Messages:
    3,288
    Gender:
    Male
    Occupation:
    math teacher
    Location:
    Sund, Ramsjö, Sweden
    @Blackjack I have fixed your code in sound.c
    It checked only if the locatorname was "fireplace" not for "fireplace1" for.ex
    Now it works for any locator which has the word "fireplace".

    I'll include it in my next upload too.
     

    Attached Files:

    • sound.c
      File size:
      43.1 KB
      Views:
      14
    Pieter Boelen likes this.
  11. Blackjack

    Blackjack Landlubber

    Joined:
    Jun 7, 2017
    Messages:
    6
    Gender:
    Male
    Occupation:
    PhD student in astrophysics
    @Jack Rackham Thank you it's better! But with the original code no fireplace sound is played ingame and with that fix we can't set min and max distance and volume... :shrug

    I've added sound schemes for towns ports and land for : day + rain ; day + storm ; night. And some other sound schemes for special locations.

    I also have added rain sounds inside buildings but I encounter a problem : weather is rain --> rain sound in tavern for example --> after sleeping in the room there is always rain sound but weather isn't necessarily rain when you get out! I think it's due to weather not reloaded in some interior locations (with Locations[n].environment.weather = "false").

    Any ideas to fix this? I'll continue to search by myself and tell you if I find something good!
     
  12. Jack Rackham

    Jack Rackham HoO Team Member Quest Writer Storm Modder

    Joined:
    Jul 5, 2004
    Messages:
    3,288
    Gender:
    Male
    Occupation:
    math teacher
    Location:
    Sund, Ramsjö, Sweden
    Well I thought it was your mod I modded? :confused:
    I'll not include this in my next upload instead let you decide what you want to add or not.
     
  13. Blackjack

    Blackjack Landlubber

    Joined:
    Jun 7, 2017
    Messages:
    6
    Gender:
    Male
    Occupation:
    PhD student in astrophysics
    Yes it's my mod! I just say that with my mod (before and after your fix) we can't set min and max distance for fireplace sounds.

    With non-modded POTC New-Horizons file, fireplace static sounds didn't work. And now with my mod it works (and with your fix it's better because it takes in account more locators) ;) But there is always a (very) little problem because I can't use the sound_alias [fireplace] and set min and max distances. It's not troublesome because the original sound file isn't to loud (I just wanted to know if there was no way to improve my code yet :D)

    My first question was to know if fireplace sounds were played in your game (without my new sound.c file). :)

    Original sound.c :
    Code:
    void SetStaticSounds(ref loc)
    {
        if(!IsEntity(loc)) return;
        if(!CheckAttribute(loc, "locators.sound")) return;
    
        aref locatorGroup; makearef(locatorGroup, loc.locators.sound);
        int locatorCount = GetAttributesNum(locatorGroup);
        if(locatorCount <= 0) return;
    
        for(int i=0; i<locatorCount; i++)
        {
            aref locator = GetAttributeN(locatorGroup, i);
            string locatorName = GetAttributeName(locator);
            string LocatorType = locatorName;
            while (isDigit(locatorType, strLen(locatorType)-1)) locatorType = strLeft(locatorType, strLen(locatorType)-1);    // LDH 19Mar09
    //TraceAndLog("SetStaticSounds: locatorName = " + locatorName + ", locatorType = " + locatorType);    // LDH test 26Mar09
            if (locatorType=="tree") continue;    // LDH we don't have a tree sound defined - 19Mar09
            SendMessage(Sound,"lsllllllfff",MSG_SOUND_PLAY, locatorType, SOUND_WAV_3D, VOLUME_FX, false, true, true, 0, stf(locator.x), stf(locator.y), stf(locator.z));//MAXIMUS
        }
    }
    My sound.c with your fix:
    Code:
    void SetStaticSounds(ref loc)
    {
        if(!IsEntity(loc)) return;
        if(!CheckAttribute(loc, "locators.sound")) return;
    
        aref locatorGroup; makearef(locatorGroup, loc.locators.sound);
        int locatorCount = GetAttributesNum(locatorGroup);
        if(locatorCount <= 0) return;
    
        for(int i=0; i<locatorCount; i++)
        {
            aref locator = GetAttributeN(locatorGroup, i);
            string locatorName = GetAttributeName(locator);
            string LocatorType = locatorName;
            while (isDigit(locatorType, strLen(locatorType)-1)) locatorType = strLeft(locatorType, strLen(locatorType)-1);    // LDH 19Mar09
    //TraceAndLog("SetStaticSounds: locatorName = " + locatorName + ", locatorType = " + locatorType);    // LDH test 26Mar09
            if (locatorType=="tree") continue;    // LDH we don't have a tree sound defined - 19Mar09
    // BLACKJACK -->
    // JRH fix
            if(HasSubStr(locatorType,"fireplace"))
            {
                SendMessage(Sound,"lsllllllfff",MSG_SOUND_PLAY, "NATURE\fireplace.wav", SOUND_WAV_3D, VOLUME_FX, false, true, true, 0, stf(locator.x), stf(locator.y), stf(locator.z));
                SendMessage(Sound,"lsllllllfff",MSG_SOUND_PLAY, "NATURE\fireplace1.wav", SOUND_WAV_3D, VOLUME_FX, false, true, true, 0, stf(locator.x), stf(locator.y), stf(locator.z));
            }
    //BLACKJACK <--
            SendMessage(Sound,"lsllllllfff",MSG_SOUND_PLAY, locatorType, SOUND_WAV_3D, VOLUME_FX, false, true, true, 0, stf(locator.x), stf(locator.y), stf(locator.z));//MAXIMUS
        }
    }
     

Share This Page