• 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..?

This is what you say?
Code:
void Sound_OnSeaAlarm(bool _seaAlarmed)
{
   ref PChar = GetMainCharacter();
   seaAlarmed = _seaAlarmed;
   if (seaAlarmed == oldSeaAlarmed)
       return;

   if (seaAlarmed)
   { //alarm on!
       if (CheckAttribute(PChar, "seabattlemusic"))
       {
           SetMusic(PChar.seabattlemusic);
       }
       else
       {
           SetMusic("music_sea_battle");
       }
   }
   else
   { //alarm off
       SetMusic(oldMusicName);
   }
   oldSeaAlarmed = seaAlarmed;
}
 
If you wait a few days/week, @Grey Roger we'll probably have included that in a mod update.
Then you just need to set and remove the player attributes at the appropriate times.
He can explain to you how it works; but he's usually only around during weekdays.
 
Copy the attached file into "PROGRAM\sound".

Where you want to have custom sailing music while not in combat, edit either the storyline file "quests_reaction.c" or the console file "console.c" to set attribute "PChar.seamusic". Where you want to have custom sea battle music, set attribute "PChar.seabattlemusic". To restore normal music, delete these attributes.
 

Attachments

  • sound.c
    42.8 KB · Views: 188
Copy the attached file into "PROGRAM\sound".

Where you want to have custom sailing music while not in combat, edit either the storyline file "quests_reaction.c" or the console file "console.c" to set attribute "PChar.seamusic". Where you want to have custom sea battle music, set attribute "PChar.seabattlemusic". To restore normal music, delete these attributes.
Thanks, now I try it
If you don't already know, you can do that deleting with DeleteAttribute(PChar, "seamusic"); or DeleteAttribute(PChar, "seabattlemusic"); .
I'm already aware of this, thank you anyway.
 
Copy the attached file into "PROGRAM\sound".

Where you want to have custom sailing music while not in combat, edit either the storyline file "quests_reaction.c" or the console file "console.c" to set attribute "PChar.seamusic". Where you want to have custom sea battle music, set attribute "PChar.seabattlemusic". To restore normal music, delete these attributes
Another small question: 'PChar.seamusic' in 'quest_reaction.c', should it be placed under something specific or where I want it? And in part at 'PChar.seamusic' I have to put something else in?
 
PChar.seamusic = "themusiccaseyouwant";

You need to put it in the quest case where you want it to be set.
Easiest is to play the game until the point where you want the music set, then check compile.log immediately after.
That should tell you the name of the quest case that was executed most recently. Then you know where to put it. :doff
 
I tried to set the music for the battle between the Interceptor and the Black Pearl (Jack Sparrow storyline) but it did not work .. some help?:unsure
 
Can you upload your current version of "quests_reaction.c" so I can see what you have tried?
 
Here I entered it
Code:
//--> CTM (Fix for Barbossa and Ragetti/Pintel turning up when landing on Isla with Interceptor)
            RemovePassenger(Pchar, characterFromID("Barbossa"));

            if (GetAttribute(pchar,"Rag")=="1"){
                RemovePassenger(Pchar, characterFromID("Ragetti"));
                                                  
                                                      PChar.seamusic = InterceptorBattle
            }
 

Attachments

  • quests_reaction.rar
    42.9 KB · Views: 169
Here I entered it
Let me guess: You have an error.log now?
This looks like invalid code:
Code:
PChar.seamusic = InterceptorBattle
At the very least, it should be:
Code:
PChar.seamusic = "InterceptorBattle";
But of course it needs to match with whatever is in music_standard.c .

Also, are you sure you want it INSIDE that if-statement?
 
I think, that's the only thing I've been able to find about the Interceptor Battle against the Black Pearl. Maybe there is another situation that describes the battle, if it was so, I could not find it.
But of course it needs to match with whatever is in music_standard.c .
Yes, obviously:yes
 
Presumably you have added "InterceptorBattle" to "music_standard.c"? No such entry exists there in the normal version.

Attribute "PChar.seamusic" sets custom music to be played while sailing peacefully. Attibute "PChar.seabattlemusic" sets custom music for a battle. If you want your music to play during a battle, use "PChar.seabattlemusic".

Setting it inside that 'if' condition means the attribute will only be set if Pintel and Ragetti are with you.

All this is happening in quest case "before_first_marooning". Looking at some of the other code around there, this appears to be the scene listed in the wiki as "Black Pearl - looking for Cortez Treasure". The quest proceeds to cases "talk_before_first_marooning", "Barbossa_leaves_for_now", "Barbossa_leaves_for_now2" and "get_a_ride_with_smugglers". After talking to smugglers, you sail to Tortuga in their boat.

There appears to be a battle involving the Interceptor later, at quest case "insertforchase2", which is triggered from quest case "insertforchase", which in turn is triggered by a dialog with Barbossa which ends with you becoming Barbossa. This is consistent with the wiki entry "Curse of the Black Pearl", specifically "Steal the Interceptor". So I would imagine that somewhere in either "insertforchase" or "insertforchase2" is where you want to set your music.
 
is where you want to set your music.
Yes, somewhere
Okay, I did as you said but it does not work the same ... music is always that 'Sailing01'. Is not it by accident that we need to start a new game to make this work?
Presumably you have added "InterceptorBattle" to "music_standard.c"? No such entry exists there in the normal version
I entered this code:
Code:
 //============ INTERCEPTORBATTLE =======
                  tmpref.music_interceptor_battle.f1.name = "MUSIC\InterceptorBattle.ogg";
 
Last edited:
Even in 'WoodesRogers' storyline there is a lot of custom music and sounds. I found some codes that might be useful:
Code:
SetSoundScheme("shop");//ambient is silenced down
            PauseAllSounds();//stops music
            PlaySound("AMBIENT\TOWN\window_dog_pistol.wav");
To go into detail .. 'SetSoundScheme ('shop');//ambient is silenced down' to what it refers to?
And this other code:
Code:
case "QC_outside_gate_4":
            PlaySound("MUSIC\brothel_organ.wav");
            PlaySound("MUSIC\brothel_unison.wav");
Could you replace it with 'PlayMusic'?
 
You would need to start a new game for the new line in "music_standard.c" to take effect. As an immediate fix to allow the new music to work in an ongoing game, you could put this into "console.c":
Code:
ref tmpref; makeref(tmpref, Music_Alias);
tmpref.music_interceptor_battle.f1.name = "MUSIC\InterceptorBattle.ogg";
Put that in "console.c" between the lines 'int limit;' and 'switch(0)'. Then, when playing your game, press F12.

That line, whether in "music_standard.c" or "console.c", defines "music_interceptor_battle". So, in "quests_reaction.c", you will need this:
Code:
PChar.seabattlemusic = "music_interceptor_battle";

Further down in the code, when that battle is finished, probably at case "InterceptorDestroyed", add this:
Code:
DeleteAttribute(PChar, "seabattlemusic");
Otherwise, if you do get the custom battle music working, it will play during every sea battle from then on.
 
I did everything you said, but it does not work. Maybe I got something wrong ...
However, do not despair more than you owe.:shock
 

Attachments

  • music_standard.rar
    2.5 KB · Views: 156
  • console.rar
    5 KB · Views: 170
  • quests_reaction.rar
    42.9 KB · Views: 184
Could you replace it with 'PlayMusic'?
No, that function in sound.c is prepared but empty.

The examples you have from WoodesRogers are not cases where the locations soundtype (music and more)
are changed. The existing music is stopped and some one-time-only sounds (can be music) are played.
 
I did everything you said, but it does not work. Maybe I got something wrong ...
However, do not despair more than you owe.:shock
Those files look alright. Presumably you do have the file "RESOURCE\Sounds\MUSIC\InterceptorBattle.ogg"?

When you press F12, do you get an on-screen message "Executed Console"? If not, there's a problem. In any case, after you've played the battle, could you upload the files "compile.log", "system.log", and "error.log" if it exists?

Did you put the modified version of "sound.c", whether from the newest update zip or from post 44 of this thread, into "PROGRAM\sound"?

Try putting PChar.seamusic = "music_interceptor_battle; at the same place as the 'PChar.seabattlemusic' line. "PChar.seabattlemusic" should be the one to set custom music for a battle, but it occurs to me that you reported:
Okay, I did as you said but it does not work the same ... music is always that 'Sailing01'.
"Sailing01" is one of the themes which is supposed to play during peaceful sailing, not during a battle, but I've already found that sometimes the sound code does not correctly detect that you're in battle, and plays peaceful music anyway. Take no chances, set both attributes, and then clear them both when the battle is over - add the line DeleteAttribute(PChar, "seamusic"); to case "InterceptorDestroyed" at the same place where you currently clear "seabattlemusic".
 
Back
Top