设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 66|回复: 0

[制作教程] How to avoid repeating the introduction of background music in a map (WAV format

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    前天 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4434

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    22875
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    28203

    灌水之王

    发表于 7 天前 | 显示全部楼层 |阅读模式
    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: [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:
                    Code:        
    @> 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:
                    Code:        
    @> 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)



    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: [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   @> 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: [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!




    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/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-14 12:54 , Processed in 0.064679 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表