Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Zmiana muzyki w menu/kontynuacja BGMa po bitwie
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # Autorzy:
- # Hiretsukan (Kevin Gadd) - [email protected]
- # RPG/Cowlol (Firas Assad)
- # ArePeeGee - AIM name
- # mcgluszak (Andrzej Głuszak) - [email protected]
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # Wersja: 1.0
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # Opis: Skrypt pozwala na zmienienie muzyki w menu i kontynuację poprzedniego
- # BGMa i BGSa po powrocie na mapę oraz po zakończeniu bitwy.
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # Instrukcja: Skopiuj z dema (http://www.hbgames.org/forums/viewtopic.php?t=55486)
- # do projektu bibliotekę fmodex.dll oraz pierwszy skrypt ("FmodEX *")
- # Ten skrypt wklej nad main.
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # Kompatybilność: Nie testowany z SDK. Kontynuacja BGMa po bitwie może
- # nie działać z niektórymi CBS-ami.
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # Licencja:
- # Use of this script is subject to the permissive BSD-like license below.
- # That basically means you could use it in any way you like as long
- # as you keep the following copyright and license unchanged and available,
- # and don't use name of copyright holder to promote products based on
- # this software. Note, however, that this license only applies to the
- # script, and not to the FMOD library. For more information about FMOD
- # licenses consult FMOD website: http://www.fmod.org/index.php/sales
- # It's free for non-commercial use, and they provide several types
- # of licenses for different types of developers.
- #
- # Copyright (c) 2005, Kevin Gadd
- # All rights reserved.
- #
- # Redistribution and use in source and binary forms, with or without
- # modification, are permitted provided that the following conditions are met:
- # * Redistributions of source code must retain the above copyright
- # notice, this list of conditions and the following disclaimer.
- # * Redistributions in binary form must reproduce the above copyright
- # notice, this list of conditions and the following disclaimer in the
- # documentation and/or other materials provided with the distribution.
- # * The name of the contributors may not be used to endorse or promote
- # products derived from this software without specific prior written
- # permission.
- #
- # THIS SOFTWARE IS PROVIDED BY Kevin Gadd ''AS IS'' AND ANY
- # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- # DISCLAIMED. IN NO EVENT SHALL Kevin Gadd BE LIABLE FOR ANY
- # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-=
- # Zmiany: v1.0 (19.02.12) - wydanie skryptu
- # Starsza wersja: http://www.hbgames.org/forums/viewtopic.php?t=55486
- #==============================================================================
- ################
- # KONFIGURACJA #
- ################
- module Gluszak
- Zmiana_BGM_w_menu = true
- Menu_BGM = '012-Theme01'
- Kontynuacja_BGM_po_bitwie = true # może być niekompatybilne z CBS-ami
- end
- ##########
- # KONIEC #
- ##########
- #==============================================================================
- # ** Game_System
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # * Play Background Music
- #--------------------------------------------------------------------------
- def bgm_play(bgm, pos = 0)
- @playing_bgm = bgm
- if bgm != nil and bgm.name != ""
- Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume, bgm.pitch, pos)
- else
- Audio.bgm_stop
- end
- Graphics.frame_reset
- end
- #--------------------------------------------------------------------------
- # * Memorize Background Music
- #--------------------------------------------------------------------------
- alias :fmodex_old_system_bgm_memorize :bgm_memorize unless $@
- def bgm_memorize
- fmodex_old_system_bgm_memorize
- @bgm_memorized_position = FMod::bgm_position
- end
- #--------------------------------------------------------------------------
- # * Restore Background Music
- #--------------------------------------------------------------------------
- def bgm_restore
- bgm_play(@memorized_bgm, @bgm_memorized_position)
- end
- #--------------------------------------------------------------------------
- # * Play Background Sound
- # bgs : background sound to be played
- #--------------------------------------------------------------------------
- def bgs_play(bgs, pos = 0)
- @playing_bgs = bgs
- if bgs != nil and bgs.name != ""
- Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume, bgs.pitch, pos)
- else
- Audio.bgs_stop
- end
- Graphics.frame_reset
- end
- #--------------------------------------------------------------------------
- # * Stop Background Sound
- #--------------------------------------------------------------------------
- def bgs_stop
- @playing_bgs = nil
- Audio.bgs_stop
- end
- #--------------------------------------------------------------------------
- # * Memorize Background Sound
- #--------------------------------------------------------------------------
- alias :fmodex_old_system_bgs_memorize :bgs_memorize unless $@
- def bgs_memorize
- fmodex_old_system_bgs_memorize
- @bgs_memorized_position = FMod::bgs_position
- end
- #--------------------------------------------------------------------------
- # * Restore Background Sound
- #--------------------------------------------------------------------------
- def bgs_restore
- bgs_play(@memorized_bgs, @bgs_memorized_position)
- end
- end
- #==============================================================================
- # ** Game_Temp
- #==============================================================================
- class Game_Temp
- attr_accessor :map_bgm_pos
- attr_accessor :map_bgs_pos
- attr_accessor :map_bgs
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- alias :fmodex_old_temp_initialize :initialize unless $@
- def initialize
- fmodex_old_temp_initialize
- @map_bgm_pos = 0
- @map_bgs = nil
- @map_bgs_pos = 0
- end
- end
- if Gluszak::Zmiana_BGM_w_menu
- #==============================================================================
- # ** Scene_Menu
- #==============================================================================
- class Scene_Menu
- #--------------------------------------------------------------------------
- # * Main
- #--------------------------------------------------------------------------
- alias :fmodex_old_main :main unless $@
- def main
- fmodex_old_main
- if $scene.is_a? Scene_Map
- $game_system.bgm_fade 0.2
- $game_system.bgm_play($game_temp.map_bgm, $game_temp.map_bgm_pos)
- $game_system.bgs_play($game_temp.map_bgs, $game_temp.map_bgs_pos)
- end
- end
- end
- #==============================================================================
- # ** Scene_Map
- #==============================================================================
- class Scene_Map
- #--------------------------------------------------------------------------
- # * Call Battle
- #--------------------------------------------------------------------------
- alias :fmodex_old_map_call_battle :call_battle unless $@
- def call_battle
- $game_temp.map_bgm_pos = FMod.bgm_position
- fmodex_old_map_call_battle
- end
- #--------------------------------------------------------------------------
- # * Call Menu
- #--------------------------------------------------------------------------
- alias :fmodex_old_map_call_menu :call_menu unless $@
- def call_menu
- $game_temp.map_bgm_pos = FMod.bgm_position
- $game_temp.map_bgs_pos = FMod.bgs_position
- $game_temp.map_bgm = $game_system.playing_bgm
- $game_temp.map_bgs = $game_system.playing_bgs
- fmodex_old_map_call_menu
- $game_system.bgm_fade 0.2
- $game_system.bgs_fade 0.2
- Audio.me_fade 0.2
- bgm = RPG::AudioFile.new(Gluszak::Menu_BGM)
- $game_system.bgm_play(bgm)
- end
- end
- end
- if Gluszak::Kontynuacja_BGM_po_bitwie
- #==============================================================================
- # ** Scene_Battle
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # * Judge
- #--------------------------------------------------------------------------
- def judge
- if $game_party.all_dead? or $game_party.actors.size == 0
- if $game_temp.battle_can_lose
- $game_system.bgm_play($game_temp.map_bgm, $game_temp.map_bgm_pos)
- battle_end(2)
- return true
- end
- $game_temp.gameover = true
- return true
- end
- for enemy in $game_troop.enemies
- if enemy.exist?
- return false
- end
- end
- start_phase5
- return true
- end
- #--------------------------------------------------------------------------
- # * Phase 5 Start
- #--------------------------------------------------------------------------
- def start_phase5
- @phase = 5
- $game_system.bgm_play($game_temp.map_bgm, $game_temp.map_bgm_pos)
- $game_system.me_play($game_system.battle_end_me)
- exp = 0
- gold = 0
- treasures = []
- for enemy in $game_troop.enemies
- unless enemy.hidden
- exp += enemy.exp
- gold += enemy.gold
- if rand(100) < enemy.treasure_prob
- if enemy.item_id > 0
- treasures.push($data_items[enemy.item_id])
- end
- if enemy.weapon_id > 0
- treasures.push($data_weapons[enemy.weapon_id])
- end
- if enemy.armor_id > 0
- treasures.push($data_armors[enemy.armor_id])
- end
- end
- end
- end
- treasures = treasures[0..5]
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- if actor.cant_get_exp? == false
- last_level = actor.level
- actor.exp += exp
- if actor.level > last_level
- @status_window.level_up(i)
- end
- end
- end
- $game_party.gain_gold(gold)
- for item in treasures
- case item
- when RPG::Item
- $game_party.gain_item(item.id, 1)
- when RPG::Weapon
- $game_party.gain_weapon(item.id, 1)
- when RPG::Armor
- $game_party.gain_armor(item.id, 1)
- end
- end
- @result_window = Window_BattleResult.new(exp, gold, treasures)
- @phase5_wait_count = 100
- end
- #--------------------------------------------------------------------------
- # * Phase 5 Update
- #--------------------------------------------------------------------------
- def update_phase5
- if @phase5_wait_count > 0
- @phase5_wait_count -= 1
- if @phase5_wait_count == 0
- @result_window.visible = true
- $game_temp.battle_main_phase = false
- @status_window.refresh
- end
- return
- end
- if Input.trigger?(Input::C)
- battle_end(0)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment