• 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!

Discussion Music question..?

Jones

Sailor
I know, it's a strange question, but the point is: can you set up a determinate music for (example) 'hoist the colour' storyline and those of 'freeplay'? Because, playing to both, music is always the same... So you can determinate the music in the various storylines?
 
There are several music packs, but I think at the moment only the PotC film peach is compatible with recent mods.
I can't remember if the music pack is saved with the profile though.

There is also a "storyline main theme" feature, but that needs to be set up properly at different points in the story to live up to its name.
 
On a related note, is it possible to change the music which plays while sailing, temporarily replacing the multiple choices with a single file? And then put back the usual setting later? At the moment I've got my "Ardent" end theme playing when you leave the town hall, which is when the storyline ends, but the music is more suitable for the sea so ideally I'd like it to trigger when you put to sea, then revert to the normal sailing music when you go to worldmap or direct-sail to another island, either of which should be triggered by the "MapEnter" quest check. One complication is that there are different choices of sailing music depending on whether it's day, night or storm.
 
That might require a quest override in the music playing code.
Maybe @Jack Rackham knows where to do that; must be somewhere in PROGRAM\SOUNDS\sound.c, I think?

My imagined solution would be to have a "pchar.quest.seamusic" attribute that overrides the default.
Would that make any sense?
 
This is how I change music temporary in a location I'm already in.

Code:
PauseAllSounds();//stops music
            locations[FindLocation("wr_church_outside")].type = "silent_jungle";// new temp sound type
            PostEvent("LoadSceneSound", 0.1);//starts music

changing back to original would be about the same but

Code:
PauseAllSounds();
            locations[FindLocation("wr_church_outside")].type = "Vane_jungle";//default sound type
            PostEvent("LoadSceneSound", 0.1);

I don't know if you can translate this to the sailing situation.
 
One thing I did try, which was messy, was to replace every option with my theme:
Code:
   ref tmpref; makeref(tmpref, Music_Alias);
   tmpref.music_day_sailing.f1.name = "MUSIC\Mare Nostrum.ogg";
   tmpref.music_day_sailing.f2.name = "MUSIC\Mare Nostrum.ogg";
   tmpref.music_day_sailing.f3.name = "MUSIC\Mare Nostrum.ogg";
   tmpref.music_day_sailing.f4.name = "MUSIC\Mare Nostrum.ogg";
That was a very temporary fix which went into "console.c" and was just to check that the new theme worked. It would need rather more lines to cover sailing at night or in storm, as well as code to store the original settings and then put them back later, but it did what I wanted, which was to have the new theme play every time I went to sea during non-stormy weather in daytime. (And, incidentally, showed that the music was too quiet compared to other PoTC music, but I have sound editing software which took care of that.)

How would that "PChar.quest.seamusic" attribute be implemented? Presumably you set it on the player character when you want the quest-specific music to play and then cancel it to resume normal music, but it's the code to have quest-specific music play, then resume normal music, which is the problem. The attribute just seems to be a convenient way to trigger such code.
 
This is how I change music temporary in a location I'm already in.

Code:
PauseAllSounds();//stops music
            locations[FindLocation("wr_church_outside")].type = "silent_jungle";// new temp sound type
            PostEvent("LoadSceneSound", 0.1);//starts music

changing back to original would be about the same but

Code:
PauseAllSounds();
            locations[FindLocation("wr_church_outside")].type = "Vane_jungle";//default sound type
            PostEvent("LoadSceneSound", 0.1);

I don't know if you can translate this to the sailing situation.
No, that's what I tried first. I don't think sea locations such as "Cuba" respond to the "type" attribute. It does work on land, which is how I've currently set the end theme to play as soon as you leave the town hall.
 
I did just find this code that we added for when the Cursed Dutchman emerges from the depths:
Code:
                PauseAllSounds();
                FadeOutMusic(150);
                PlaystereoOGG("music_emerge_dutchman");
                //FadeOutMusic(500);
                if (!bDisableMapEnter)    PostEvent("LoadSceneSound", 110000);
                else                    PostEvent("LoadSceneSound", 41500);
Maybe that is of any help?
 
Why the distinction between whether or not 'DisableMapEnter' is in effect?

Both the pieces of music for "music_emerge_dutchman" are 10 seconds long. That code would seem to delay normal music being resumed by almost 2 minutes if map is not disabled, and 41.5 seconds if it is. (The piece of music I'm planning to use is a little over 5 minutes, so presumably I'll want a delay of at least 300000.)
 
It doesn't work, anyway. Even with that code in place, background music still plays.

Here's my "compile.log" after loading up a savegame in port, putting to sea, then immediately quitting. It seems the sailing music is set twice:
Code:
SEA: sealogin loading island Cuba
SEA: added pchar to sea
<several ships and their captains generated>
Code:
SEA: Did CRs
SEA: Did any groups
SEA: added ships
SEA: Set tasks
updated AISea
Seafoam done
Telescope initiated
SETTING MUSIC: music_day_sailing
SETTING MUSIC: music_day_sailing
ResumeAllSounds
SEA: SeaLogin end
Sea_FirstInit
FLAGS: The 'Santiago Fort' has spotted us at 572.45, but is not interested as we are not hostile
FLAGS: The 'Anunciación' has spotted us at 863.92, but is not interested as we are not hostile
PauseAllSounds
Quest name finale_end_theme FOUND in QuestComplete
Sea_FirstInit done
SETTING MUSIC: music_day_sailing
SETTING MUSIC: music_day_sailing
ResumeAllSounds
"Quest name finale_end_theme" is the quest case which is supposed to play the end music, and does - and then the sailing music starts up again anyway. It does that even if I comment out the 'PostEvent' line.
 

Attachments

  • compile.log
    4.6 KB · Views: 279
It doesn't work, anyway. Even with that code in place, background music still plays.
Have you tried increasing the number on this line?
Code:
FadeOutMusic(150);
Maybe that mutes the music for a set period of time?
 
Yes, I did try increasing it, but I imagine that if it mutes the music for that number of milliseconds then the original line is going to have next to no effect for the Dutchman. My guess is that it's supposed to wait that long before starting the fade, or maybe make the fade take that long. Either way, it didn't help, probably because the system does everything the code says and then starts up the music again. This is perhaps because I'm trying to do it right after putting to sea; by contrast, when the Dutchman emerges, you're already at sea.
 
So... the search continues then.
I know there must be a way to do what you want; it's just a matter of figuring out the best way to do it.

Have you had a look at sound.c already?
 
Yes, while trying to find out exactly what 'FadeOutMusic' does. I couldn't figure out what it does because it eventually ends up at a 'SendMessage' command, and I've no idea how those work. It's also how I know I need to deal separately with night and day sailing music. Storm music isn't going to be an issue because the end theme doesn't work too well with a storm anyway, so a 'SetNextWeather' command means it's going to be a clear day (or night) when you sail off into free-play.

So I'm back to trying a bunch of commands to store the values of the current "tmpref.music_day_sailing.f*.name" attributes, set the attributes all to "Silence.ogg", and play my end theme. A further quest, triggered by "MapEnter", can put the attributes back from wherever I stored them.
 
Yes, while trying to find out exactly what 'FadeOutMusic' does. I couldn't figure out what it does because it eventually ends up at a 'SendMessage' command, and I've no idea how those work.
Simplest explanation: 'SendMessage' tells the game engine to do something.
So whatever it does, that's the part where we lose control and cannot influence what it does anymore.

So I'm back to trying a bunch of commands to store the values of the current "tmpref.music_day_sailing.f*.name" attributes, set the attributes all to "Silence.ogg", and play my end theme. A further quest, triggered by "MapEnter", can put the attributes back from wherever I stored them.
I think there is code in sound.c that actually plays the sea music; that is also where the day/night difference is handled.
If you find that, you can probably add a simple quest override in place there.
I imagine that is the easiest solution, so that's the one I would recommend.
 
I was interested in a post created by a certain @chri "how to create nation, add music and create a new quest-book?" The part of this post is that of kraken, to add the effect music as soon as the kraken evokes. But the two files modified by @Pieter Boelen do not work for me ...
 
I was interested in a post created by a certain @chri "how to create nation, add music and create a new quest-book?" The part of this post is that of kraken, to add the effect music as soon as the kraken evokes. But the two files modified by @Pieter Boelen do not work for me ...
You'll have to post a link to the relevant post.
I haven't a clue what I did back then. :facepalm
 
Back
Top