Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Mr.Mo Add-On: On-Map Battle Music

Status
Not open for further replies.
Mr.Mo Add-on: On-Map Battle Music
Version: 1.2

1.0 - Works for Mr.Mo's ABS
1.1 - Fixed bug (initialize method added)
1.2 - Works with Near's SBABS

Introduction

This is probably without a doubt not the best script in the world, I made it for my game and... well, it's probably not the best way of doing this. But I thought I should share it as others might find it useful. It's dead simple so no credit is required unless you want to.

Made for Mr.Mo's SBABS, but it might work with his ABS too, I dunno if the method names are the same.

Script

Code:
class MrMo_ABS
alias wy_mbm_ea update_enemy_attack
  def update_enemy_attack(e, actor)
    wy_mbm_ea(e, actor)
    $bm_counter = 40
  end
end

class Scene_Map
alias wy_mbm_update update
alias wy_mbm_init initialize
  def initialize
    $bm_counter = 0
    wy_mbm_init
  end
  def update
    if $bm_counter == 0
      $game_map.autoplay
    else
      $game_system.bgm_play($game_system.battle_bgm)
    end
    $bm_counter -= 1 unless $bm_counter == 0
    wy_mbm_update
  end
end
Code:
class Action_Battle_System
alias wy_mbm_ea enemy_attack
  def enemy_attack(enemy)
    wy_mbm_ea(enemy)
    $bm_counter = 40
  end
end

class Scene_Map
alias wy_mbm_update update
alias wy_mbm_init initialize
  def initialize
    $bm_counter = 0
    wy_mbm_init
  end
  def update
    if $bm_counter == 0
      $game_map.autoplay
    else
      $game_system.bgm_play($game_system.battle_bgm)
    end
    $bm_counter -= 1 unless $bm_counter == 0
    wy_mbm_update
  end
end

Instructions
Above main but below Mr.Mo's SBABS.

FAQ

What does it do?
When the enemy attacks you, battle music starts playing (whether it's a miss or not). If the enemy doesn't attack you for 40 frames, the music stops playing. Simple as that. It just adds a little bit of extraness so on-map battles feel like... battles.

Where do I edit to set the map or battle music?
It uses the map's default music and the battle music from the editor.

Compatibility

I aliased, so it should be compatible with most things though I'm not sure entirely.

Only compatible with Mr.Mo's SBABS and possibly his ABS and ABS-lite.

Credits and Thanks

Don't bother creditting me please, unless you really want to. Free or commercial (but check with the terms in Mr.Mo's ABS for his terms).

Thanks to Mr.Mo for making the battle system(s), and thanks to Tibuda for helping me a bit.

Author's Notes

Yes, I know it's a really short script. But a script is still a script.
 
I can probably make this work with other ABS's, it's just a simple case of changing the lines that say:

class MrMo_ABS

And all the bits that say

update_enemy_attack.
 

Hero

Member

Cool, so this is like in Zelda OoT where a tension music plays when an enemy is near you. I might consider using this if I ever make an ABS game.
 
I can't with Mr.Mo's unfortunately. I tried this, and all it does is play the battle music every time you press the attack button, rather than when you're just attacking the enemy. (Because the ABS counts every attack-button-press as an attack for some reason). It probably is possible somehow, but I couldn't work it out.
 
Done, added to the main post.

That should work, I'm unsure though as I can't test sound at the moment (it's 11 PM here and there's other peeps in the house).

Also fixed a small bug stopping it working.
 
Have to put this up
Can you edit the script so that it can continue playing the bgm after accessing the menu? Ev

Venetia: Don't necropost, please. If you have a question about an old script, post the question in RGSS Support. Thanks.
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top