How to avoid repeating the introduction of background music in a map (WAV format
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.
Just set the introduction as the map's music:
In the map, an event would be created in Parallel Process, and within it, a Conditional Branch would be created with this option:
Inside it, the BGM would start, which would loop and delete the event because it is no longer needed until the player leaves and returns to this same map:
The problem is that this doesn't work with WAV files, which, although rare, can be one of the only ways to include specific ambient sounds.
To check the background music playback position, there's an option in the variables that recognizes the WAV format:
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:
Code:
@> Control Variables: = 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:
Code:
@> Conditional Branch: Variable >= Variable @> Control Variables: = Variable @>: 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:
Code:
@> Control Variables: = MIDI Play Location (Tick) @> Conditional Branch: Variable >= Variable @> Control Variables: = Variable @>: 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)
To further enhance the system, you can apply a fast fade-out to the intro and a fade-in to the looped music:
Code:
@> Control Variables: = MIDI Play Location (Tick) @> Conditional Branch: Variable >= Variable @> Control Variables: = Variable @>: Else @> Fadeout BGM: 1 seconds @> Play BGM: 'Village1', 100, 100, 50, @1.0s @> Erase Event @>: Branch End @> Wait: 0.0 seconds
However, it's quite likely that it won't work as it should with most songs, so the best approach would be to do this during music editing and also include a 1-second silence at the end after the fade-out.
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:
Code:
@> Text: Hello Mr. Hero... @> Play BGM: 'BossFinal_Intro', 100, 50, 50 @> Loop @> Control Variables: = MIDI Play Location (Tick) @> Conditional Branch: Variable >= Variable @> Control Variables: = Variable @> : 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!
Now, assuming that several maps or all cities have their own introduction and you don't want to have to create such an event for each map by copying and pasting, remember that the Erase Event command in Common Events only works in RM2K3:
本贴来自国际rpgmaker官方论坛作者:DevRPG2k处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/how-to-avoid-repeating-the-introduction-of-background-music-in-a-map-wav-format.182532/
页:
[1]