Save-Point
KStolenBGM XP - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: KStolenBGM XP (/thread-13602.html)



KStolenBGM XP - kyonides - 06-19-2026

KStolenBGM XP

by Kyonides

Introduction

This simple scriptlet allows you to make the game, namely the NPC or the narrator or somebody else, to refuse to play the BGM or BGS that have been stolen so far.

It includes both script calls for stealing or releasing the BGM and BGS during gameplay.

You might need to delete old saved games to prevent the game from crashing. (It won't be able to find the new variables I've created there.)

The Script

Code:
# * KStolenBGM XP * #
#   Scripter : Kyonides
#   v0.5.0 - 2026-06-19

# Let your game steal BGM and BGS from your players!
# This means that the game won't be able to play them unless they do
# something about it! Oh my!

# * Script Calls * #

# - Steal a BGM:
# $game_system.steal_bgm!(OptionalMapID)

# - Steal a BGS:
# $game_system.steal_bgs!(OptionalMapID)

# - Release a BGM:
# $game_system.free_bgm!(OptionalMapID)

# - Release a BGS:
# $game_system.free_bgs!(OptionalMapID)

class Game_System
  alias :kyon_stolen_bgm_gm_sys_init :initialize
  alias :kyon_stolen_bgm_gm_sys_bgm_play :bgm_play
  alias :kyon_stolen_bgm_gm_sys_bgs_play :bgs_play
  def initialize
    kyon_stolen_bgm_gm_sys_init
    @stolen_bgm = []
    @stolen_bgs = []
  end

  def bgm_play(bgm)
    if $game_map and @stolen_bgm.include?($game_map.map_id)
      bgm = nil
    end
    kyon_stolen_bgm_gm_sys_bgm_play(bgm)
  end

  def steal_bgm!(map_id=nil)
    map_id ||= $game_map.map_id
    @stolen_bgm |= [map_id]
    @stolen_bgm = @stolen_bgm.sort
    map_id
  end

  def free_bgm!(map_id=nil)
    map_id ||= $game_map.map_id
    @stolen_bgm.delete(map_id)
  end

  def bgs_play(bgs)
    if $game_map and @stolen_bgs.include?($game_map.map_id)
      bgm = nil
    end
    kyon_stolen_bgm_gm_sys_bgs_play(bgs)
  end

  def steal_bgs!(map_id=nil)
    map_id ||= $game_map.map_id
    @stolen_bgs |= [map_id]
    @stolen_bgs = @stolen_bgs.sort
    map_id
  end

  def free_bgs!(map_id=nil)
    map_id ||= $game_map.map_id
    @stolen_bgs.delete(map_id)
  end
  attr_reader :stolen_bgm, :stolen_bgs
end
Terms & Conditions

Under the MIT License.
That's it! Tongue sticking out