Notice: fwrite(): Write of 461 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96

Notice: fwrite(): Write of 59 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96

Notice: fwrite(): Write of 1714 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96

Notice: fwrite(): Write of 44 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96

Notice: fwrite(): Write of 8192 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96
Print Page - Ambush BGMs

The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: modern algebra on April 20, 2009, 10:50:20 PM

Title: Ambush BGMs
Post by: modern algebra on April 20, 2009, 10:50:20 PM
Ambush BGMs
Version: 1.0
Author: modern algebra
Date: April 20, 2009

Version History




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


Screenshots

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

Instructions

See inside the script for instructions.

Script




#==============================================================================
#  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




Thanks


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.