• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Need Help Sounds mod

Blackjack

Landlubber
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
 
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?
@Jack Rackham, I think you are the #1 expert to answer that question! :cheeky
 
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?
 
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
 
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.
 

Attachments

  • characters_reload_check.c
    10 KB · Views: 152
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!
 

Attachments

  • sound.c
    43.1 KB · Views: 141
@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!
 
and with that fix we can't set min and max distance and volume...
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.
 
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
    }
}
 
Back
Top