Jump to content

Adding songs to cutscenes


Recommended Posts

I'm trying to create this component that enhances some of the cutscenes in BGT

In the cutscene battle between Gorion and Sarevok I'd like to add some specific music. This is a little bit more involved than I thought.

I'm going to use PlaySong() in the cutscene script.

Take a look at what I have so far:

Spoiler
////////////////////////////////////////////////////////////////////
BEGIN ~BGT chapter cutscene improvements~ DESIGNATED 210
REQUIRE_PREDICATE GAME_IS ~bgt~ "This component requires Baldur's Gate Trilogy"
////////////////////////////////////////////////////////////////////

// Create "Gorion's Battle" .mus file to be referenced in cutscene ch1cut04.bcs

<<<<<<<<.../WStweaks-inline/ws#ch1.mus
Bl2
17
a1
a2
a3
a4
b1
b2
b3
b4
c1
c2
c3
c4
d1
d2
e1
f1
f2
>>>>>>>>
MKDIR ~weidu_external/data/WStweaks~
COPY ~.../WStweaks-inline/ws#ch1.mus~ ~weidu_external/data/WStweaks~

// Write ws#ch1.mus into songlist.2da and copy it into the music directory

ADD_MUSIC ?

// Add new song to cutscene and smoothen transitions

COPY_EXISTING ~ch1cut04.bcs~ ~override~
    DECOMPILE_AND_PATCH BEGIN
    REPLACE_TEXTUALLY ~CutSceneId("Gorion")~ 
                      ~CutSceneId("Gorion")
                       PlaySong(?)~
    REPLACE_TEXTUALLY ~SetGlobal("Chapter","GLOBAL",0)~ 
                      ~SetGlobal("Chapter","GLOBAL",0)
                       FadeToColor([40.0],0)
                       Wait(4)~
    REPLACE_TEXTUALLY ~AddJournalEntry(75220,INFO)~ 
                      ~AddJournalEntry(75220,INFO)
                       FadeFromColor([40.0],0)~
    END
BUT_ONLY

1. Create a .mus file that will be used. I'll have to tweak the above to fit the cutscene better once I get everything else working.

2. Use ADD_MUSIC to write ws#ch1.mus into songlist.2da and copy it into music folder. Embarrassingly, I'm having trouble writing this. It needs to copy it from weidu_external/data/WStweaks.

3. Using PlaySong() I need to know what row in songlist.2da the song will be written to. I hope I can control this with ADD_MUSIC? Else I'll probably have to do some READ_2DA nonsense.

Thanks for any help.

Edit: Ok, I've figured out "ADD_MUSIC ~ws#ch1~ ~weidu_external/data/WStweaks/ws#ch1.mus~" 

It writes it at the bottom of songlist.2da

Now I just need to do the 2DA magic so it writes in the row % into PlaySong(%%)😮‍💨

 

Edited by WanderingScholar
Link to comment

I figured this out. I'll leave this here in case anyone is interested. 

Spoiler
// Create "Gorion's Battle" .mus file to be used in cutscene ch1cut04.bcs
<<<<<<<<.../WStweaks-inline/ws#ch1.mus
Bl2
20
a1
a2
a3
a4
b1
b2
b3
b4
c1
c2
c3
c4
d1
d2
e1
f1
f2
g1
g2
g3
>>>>>>>>
MKDIR ~weidu_external/data/WStweaks~
COPY ~.../WStweaks-inline/ws#ch1.mus~ ~weidu_external/data/WStweaks~

// Write ws#ch1.mus into songlist.2da and copy it into the music directory
ADD_MUSIC ~ws#ch1~ ~weidu_external/data/WStweaks/ws#ch1.mus~

// Check the first column of the bottom row in songlist.2da for new song #
COPY_EXISTING ~songlist.2da~ ~override~
    COUNT_2DA_ROWS 2 rowcount
    READ_2DA_ENTRY rowcount 0 0 "new_song" 
BUT_ONLY    

// Add new song to cutscene and smoothen transitions
COPY_EXISTING ~ch1cut04.bcs~ ~override~
    DECOMPILE_AND_PATCH BEGIN
    REPLACE_TEXTUALLY ~CutSceneId("Gorion")~ 
                      ~CutSceneId("Gorion")
                       PlaySong("%new_song%")~
    REPLACE_TEXTUALLY ~SetGlobal("Chapter","GLOBAL",0)~ 
                      ~SetGlobal("Chapter","GLOBAL",0)
                       FadeToColor([40.0],0)
                       Wait(4)~
    REPLACE_TEXTUALLY ~AddJournalEntry(75220,INFO)~ 
                      ~AddJournalEntry(75220,INFO)
                       FadeFromColor([40.0],0)~
    END
BUT_ONLY
Link to comment
On 1/24/2024 at 5:49 AM, WanderingScholar said:

I figured this out. I'll leave this here in case anyone is interested. 

  Hide contents
// Create "Gorion's Battle" .mus file to be used in cutscene ch1cut04.bcs
<<<<<<<<.../WStweaks-inline/ws#ch1.mus
Bl2
20
a1
a2
a3
a4
b1
b2
b3
b4
c1
c2
c3
c4
d1
d2
e1
f1
f2
g1
g2
g3
>>>>>>>>
MKDIR ~weidu_external/data/WStweaks~
COPY ~.../WStweaks-inline/ws#ch1.mus~ ~weidu_external/data/WStweaks~

// Write ws#ch1.mus into songlist.2da and copy it into the music directory
ADD_MUSIC ~ws#ch1~ ~weidu_external/data/WStweaks/ws#ch1.mus~

// Check the first column of the bottom row in songlist.2da for new song #
COPY_EXISTING ~songlist.2da~ ~override~
    COUNT_2DA_ROWS 2 rowcount
    READ_2DA_ENTRY rowcount 0 0 "new_song" 
BUT_ONLY    

// Add new song to cutscene and smoothen transitions
COPY_EXISTING ~ch1cut04.bcs~ ~override~
    DECOMPILE_AND_PATCH BEGIN
    REPLACE_TEXTUALLY ~CutSceneId("Gorion")~ 
                      ~CutSceneId("Gorion")
                       PlaySong("%new_song%")~
    REPLACE_TEXTUALLY ~SetGlobal("Chapter","GLOBAL",0)~ 
                      ~SetGlobal("Chapter","GLOBAL",0)
                       FadeToColor([40.0],0)
                       Wait(4)~
    REPLACE_TEXTUALLY ~AddJournalEntry(75220,INFO)~ 
                      ~AddJournalEntry(75220,INFO)
                       FadeFromColor([40.0],0)~
    END
BUT_ONLY

This is great, many thanks for documenting this! Some of those steps I did manually when using add_music to areas, so your script will indeed be useful!

Edited by pete_smith1229
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...