RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Ambush BGMs

0 Members and 2 Guests are viewing this topic.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Ambush BGMs
Version: 1.0
Author: modern algebra
Date: April 20, 2009

Version History


  • <Version 1.0> 04.20.2009 - Original Release

Description


This script will allow you to set different BGMs to play depending on the ambush conditions of the battle. Thus, if it is a pre-emptive attack (heroes have the upper hand), you can set it to play a different BGM from the regular, or if it is an enemy surprise attack, then you can set it to play still another BGM.

Features

  • Allows you to have different BGMs play depending on the ambush conditions
  • Can set a separate BGM for both party surprise attacks and enemy surprise attacks
  • Can change these BGMs at any time in-game with a call script

Screenshots

This script has no graphical component. Just test it out.

Instructions

See inside the script for instructions.

Script


Code: [Select]
#==============================================================================
#  Ambush BGMs
#  Version: 1.0
#  Author: modern algebra (rmrk.net)
#  Date: April 20, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#    This script makes it so that preemptive battles and surprise battles can
#   have different BGMs playing than regular battles.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#    Insert this script above Main and below other custom scripts.
#
#    You can set the default audio files for this at lines 49 and 50. Just
#   change the words in quotes ("") to the names of the BGM files you choose.
#
#    To change the bgms for preemptive and/or surprise battles during the
#   course of a game, all that you need to do is use the following codes in a
#   script call:
#
#      $game_system.preemptive_battle_bgm = "filename"
#      $game_system.surprise_battle_bgm = "filename"
#
#   where "filename" is the name of the BGM file you wish to change it to.
#==============================================================================

#==============================================================================
# ** Game_System
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - initialize, battle_bgm
#    new instance variables - preemptive_battle_bgm, surprise_battle_bgm
#==============================================================================

class Game_System
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_accessor :preemptive_battle_bgm # BGM to be played if pre-emptive
  attr_accessor :surprise_battle_bgm   # BGM to be played if surprised
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_wt56_bgmspresur_init_7nff4 initialize
  def initialize (*args)
    # RUn Original Method
    ma_wt56_bgmspresur_init_7nff4 (*args)
    # Initialize Special Battle BGMs
    @preemptive_battle_bgm = "Battle2"
    @surprise_battle_bgm = "Battle3"
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Battle BGM
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_wltr3565_btlbgm_srprsbm_63h4 battle_bgm
  def battle_bgm (*args)
    # If special attack occurs
    if $game_troop != nil && $game_troop.preemptive
      return RPG::BGM.new (@preemptive_battle_bgm)
    elsif $game_troop != nil && $game_troop.surprise
      return RPG::BGM.new (@surprise_battle_bgm)
    else
      # Give normal BGM
      return modalg_wltr3565_btlbgm_srprsbm_63h4 (*args)
    end
  end
end

Credit


  • modern algebra

Thanks

  • wltr3565, for the request.

Support


Please post in this topic at rmrk.net for the swiftest response.

Known Compatibility Issues

No known compatibility issues.

Demo


There is no demo. Please see the script.


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
« Last Edit: February 11, 2010, 09:50:48 PM by Modern Algebra »