X Tutup

DEFINE AN INTRO FOR WAV MUSIC BACKGROUND MUSIC

Although the RM2K and RM2K3 have the option to check when a background music loop ends, this seems to only work with MIDI and MP3, and not with WAV format music

So, let's say I want to create a map with a musical introduction, but one that doesn't repeat. Since it's not MIDI, this is impossible, as far as I understand.

Using the "Current BGM has completed a loop" parameter in Conditional Branch could solve this, but it doesn't work for WAV format music and isn't present in older versions of RM2K/2K3. However, although it seems to work the same way, the "MIDI Play Location (Tick)" option recognizes the WAV format, so that will be used to perform this check.

Since it's not possible to determine the exact size of each song in TICK, I used two variables for comparison. The first one reads constantly:
@> Control Variables: [0005:MIDI Pos.Curr] = MIDI Play Location (Tick)


The second value will always copy the value of the first as long as the first is greater than or equal to the second:
@> Conditional Branch: Variable [0005:MIDI Pos.Curr] >= Variable [0006:MIDI Pos.Dura]

@> Control Variables: [0006:MIDI Pos.Dura] = Variable [0005]
@>
: Else
@>
: Branch End


So this means that when the position returns to zero, the exception for this condition will be executed, so I change the BGM and then delete the event:
@> Control Variables: [0005:MIDI Pos.Curr] = MIDI Play Location (Tick)

@> Conditional Branch: Variable [0005:MIDI Pos.Curr] >= Variable [0006:MIDI Pos.Dura]
@> Control Variables: [0006:MIDI Pos.Dura] = Variable [0005]
@>
: Else
@> Play BGM: 'Village1', 100, 100, 50
@> Erase Event
@>
: Branch End
@> Wait: 0.0 seconds

(I included the wait time simply out of habit to avoid lag on older processors)

But how do you make this work with a cutscene or dialogue event that changes the music, but you want it to continue only after the music's introduction? In that case, we can use a loop to wait for the music to end:
@> Text: Hello Mr. Hero...

@> Play BGM: 'BossFinal_Intro', 100, 50, 50
@> Loop
@> Control Variables: [0005:MIDI Pos.Curr] = MIDI Play Location (Tick)
@> Conditional Branch: Variable [0005:MIDI Pos.Curr] >= Variable [0006:MIDI Pos.Dura]
@> Control Variables: [0006:MIDI Pos.Dura] = Variable [0005]
@>
: Else
@> Play BGM: 'BossFinal', 100, 100, 50
@> Break Loop
@>
: Branch End
@>
: Repeat Above
@> Text: This is the moment when we meet for the final battle!
X Tutup