SHOW:
|
|
- or go back to the newest paste.
| 1 | #============================================================================== | |
| 2 | # Zmiana muzyki w menu/kontynuacja BGMa po bitwie | |
| 3 | #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-= | |
| 4 | # Autorzy: | |
| 5 | # Hiretsukan (Kevin Gadd) - [email protected] | |
| 6 | # RPG/Cowlol (Firas Assad) | |
| 7 | # ArePeeGee - AIM name | |
| 8 | # mcgluszak (Andrzej Głuszak) - [email protected] | |
| 9 | #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-= | |
| 10 | # Wersja: 1.0 | |
| 11 | #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-= | |
| 12 | # Opis: Skrypt pozwala na zmienienie muzyki w menu i kontynuację poprzedniego | |
| 13 | # BGMa i BGSa po powrocie na mapę oraz po zakończeniu bitwy. | |
| 14 | #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-= | |
| 15 | # Instrukcja: Skopiuj z dema (http://www.hbgames.org/forums/viewtopic.php?t=55486) | |
| 16 | # do projektu bibliotekę fmodex.dll oraz pierwszy skrypt ("FmodEX *")
| |
| 17 | # Ten skrypt wklej nad main. | |
| 18 | #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-= | |
| 19 | # Kompatybilność: Nie testowany z SDK. Kontynuacja BGMa po bitwie może | |
| 20 | # nie działać z niektórymi CBS-ami. | |
| 21 | #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-= | |
| 22 | # Licencja: | |
| 23 | # Use of this script is subject to the permissive BSD-like license below. | |
| 24 | # That basically means you could use it in any way you like as long | |
| 25 | # as you keep the following copyright and license unchanged and available, | |
| 26 | # and don't use name of copyright holder to promote products based on | |
| 27 | # this software. Note, however, that this license only applies to the | |
| 28 | # script, and not to the FMOD library. For more information about FMOD | |
| 29 | # licenses consult FMOD website: http://www.fmod.org/index.php/sales | |
| 30 | # It's free for non-commercial use, and they provide several types | |
| 31 | # of licenses for different types of developers. | |
| 32 | # | |
| 33 | # Copyright (c) 2005, Kevin Gadd | |
| 34 | # All rights reserved. | |
| 35 | # | |
| 36 | # Redistribution and use in source and binary forms, with or without | |
| 37 | # modification, are permitted provided that the following conditions are met: | |
| 38 | # * Redistributions of source code must retain the above copyright | |
| 39 | - | # bgm : background music to be played |
| 39 | + | # notice, this list of conditions and the following disclaimer. |
| 40 | # * Redistributions in binary form must reproduce the above copyright | |
| 41 | - | ############################################################################ |
| 41 | + | # notice, this list of conditions and the following disclaimer in the |
| 42 | - | # ADDED pos (POSITION) AS PARAMETER TO METHOD |
| 42 | + | # documentation and/or other materials provided with the distribution. |
| 43 | - | ############################################################################ |
| 43 | + | # * The name of the contributors may not be used to endorse or promote |
| 44 | # products derived from this software without specific prior written | |
| 45 | # permission. | |
| 46 | # | |
| 47 | # THIS SOFTWARE IS PROVIDED BY Kevin Gadd ''AS IS'' AND ANY | |
| 48 | - | ############################################################################ |
| 48 | + | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 49 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 50 | # DISCLAIMED. IN NO EVENT SHALL Kevin Gadd BE LIABLE FOR ANY | |
| 51 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 52 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 53 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
| 54 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 55 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 56 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 57 | #-=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=--=-=-=-=-=-= | |
| 58 | # Zmiany: v1.0 (19.02.12) - wydanie skryptu | |
| 59 | # Starsza wersja: http://www.hbgames.org/forums/viewtopic.php?t=55486 | |
| 60 | #============================================================================== | |
| 61 | ||
| 62 | ################ | |
| 63 | # KONFIGURACJA # | |
| 64 | ################ | |
| 65 | ||
| 66 | - | ############################################################################ |
| 66 | + | |
| 67 | - | # ADDED @bgm_memorized_position AS PARAMETER TO METHOD |
| 67 | + | |
| 68 | - | ############################################################################ |
| 68 | + | Zmiana_BGM_w_menu = true |
| 69 | Menu_BGM = '012-Theme01' | |
| 70 | - | ############################################################################ |
| 70 | + | Kontynuacja_BGM_po_bitwie = true # może być niekompatybilne z CBS-ami |
| 71 | ||
| 72 | end | |
| 73 | ||
| 74 | ########## | |
| 75 | # KONIEC # | |
| 76 | - | ############################################################################ |
| 76 | + | ########## |
| 77 | - | # ADDED pos (POSITION) AS PARAMETER TO METHOD |
| 77 | + | |
| 78 | - | ############################################################################ |
| 78 | + | |
| 79 | #============================================================================== | |
| 80 | # ** Game_System | |
| 81 | #============================================================================== | |
| 82 | class Game_System | |
| 83 | - | ############################################################################ |
| 83 | + | |
| 84 | # * Play Background Music | |
| 85 | #-------------------------------------------------------------------------- | |
| 86 | def bgm_play(bgm, pos = 0) | |
| 87 | @playing_bgm = bgm | |
| 88 | if bgm != nil and bgm.name != "" | |
| 89 | Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume, bgm.pitch, pos)
| |
| 90 | else | |
| 91 | Audio.bgm_stop | |
| 92 | end | |
| 93 | Graphics.frame_reset | |
| 94 | end | |
| 95 | #-------------------------------------------------------------------------- | |
| 96 | # * Memorize Background Music | |
| 97 | #-------------------------------------------------------------------------- | |
| 98 | alias :fmodex_old_system_bgm_memorize :bgm_memorize unless $@ | |
| 99 | def bgm_memorize | |
| 100 | fmodex_old_system_bgm_memorize | |
| 101 | @bgm_memorized_position = FMod::bgm_position | |
| 102 | end | |
| 103 | #-------------------------------------------------------------------------- | |
| 104 | # * Restore Background Music | |
| 105 | #-------------------------------------------------------------------------- | |
| 106 | def bgm_restore | |
| 107 | bgm_play(@memorized_bgm, @bgm_memorized_position) | |
| 108 | - | ############################################################################ |
| 108 | + | |
| 109 | - | # ADDED @bgs_memorized_position AS PARAMETER TO METHOD |
| 109 | + | |
| 110 | - | ############################################################################ |
| 110 | + | |
| 111 | # bgs : background sound to be played | |
| 112 | - | ############################################################################ |
| 112 | + | |
| 113 | def bgs_play(bgs, pos = 0) | |
| 114 | @playing_bgs = bgs | |
| 115 | if bgs != nil and bgs.name != "" | |
| 116 | Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume, bgs.pitch, pos)
| |
| 117 | else | |
| 118 | Audio.bgs_stop | |
| 119 | end | |
| 120 | Graphics.frame_reset | |
| 121 | end | |
| 122 | #-------------------------------------------------------------------------- | |
| 123 | # * Stop Background Sound | |
| 124 | #-------------------------------------------------------------------------- | |
| 125 | def bgs_stop | |
| 126 | - | |
| 126 | + | |
| 127 | Audio.bgs_stop | |
| 128 | end | |
| 129 | #-------------------------------------------------------------------------- | |
| 130 | # * Memorize Background Sound | |
| 131 | #-------------------------------------------------------------------------- | |
| 132 | alias :fmodex_old_system_bgs_memorize :bgs_memorize unless $@ | |
| 133 | def bgs_memorize | |
| 134 | fmodex_old_system_bgs_memorize | |
| 135 | @bgs_memorized_position = FMod::bgs_position | |
| 136 | end | |
| 137 | #-------------------------------------------------------------------------- | |
| 138 | # * Restore Background Sound | |
| 139 | #-------------------------------------------------------------------------- | |
| 140 | - | # If all dead determinant is true, or number of members in party is 0 |
| 140 | + | |
| 141 | bgs_play(@memorized_bgs, @bgs_memorized_position) | |
| 142 | - | # If possible to lose |
| 142 | + | |
| 143 | ||
| 144 | - | ############################################################################ |
| 144 | + | |
| 145 | - | # ADDED $game_temp.map_bgm_pos AS 2ND PARAMETE TO bgm_play |
| 145 | + | |
| 146 | - | ############################################################################ |
| 146 | + | #============================================================================== |
| 147 | - | # Return to BGM before battle starts |
| 147 | + | # ** Game_Temp |
| 148 | - | $game_system.bgm_play($game_temp.map_bgm, $game_temp.map_bgm_pos) |
| 148 | + | #============================================================================== |
| 149 | - | ############################################################################ |
| 149 | + | |
| 150 | - | # Battle ends |
| 150 | + | |
| 151 | attr_accessor :map_bgm_pos | |
| 152 | - | # Return true |
| 152 | + | |
| 153 | attr_accessor :map_bgs | |
| 154 | #-------------------------------------------------------------------------- | |
| 155 | - | # Set game over flag |
| 155 | + | # * Initialize |
| 156 | #-------------------------------------------------------------------------- | |
| 157 | - | # Return true |
| 157 | + | |
| 158 | def initialize | |
| 159 | fmodex_old_temp_initialize | |
| 160 | - | # Return false if even 1 enemy exists |
| 160 | + | |
| 161 | @map_bgs = nil | |
| 162 | @map_bgs_pos = 0 | |
| 163 | end | |
| 164 | ||
| 165 | end | |
| 166 | - | # Start after battle phase (win) |
| 166 | + | |
| 167 | if Gluszak::Zmiana_BGM_w_menu | |
| 168 | - | # Return true |
| 168 | + | #============================================================================== |
| 169 | # ** Scene_Menu | |
| 170 | #============================================================================== | |
| 171 | class Scene_Menu | |
| 172 | #-------------------------------------------------------------------------- | |
| 173 | - | # Shift to phase 5 |
| 173 | + | # * Main |
| 174 | #-------------------------------------------------------------------------- | |
| 175 | - | ############################################################################ |
| 175 | + | |
| 176 | - | # ADDED $game_temp.map_bgm_pos AS 2ND PARAMETE TO bgm_play |
| 176 | + | |
| 177 | - | # AND SWITCHED PLAY ORDER SO BGM IS PLAYED FIRST |
| 177 | + | |
| 178 | - | ############################################################################ |
| 178 | + | |
| 179 | - | # Return to BGM before battle started |
| 179 | + | |
| 180 | $game_system.bgm_play($game_temp.map_bgm, $game_temp.map_bgm_pos) | |
| 181 | - | # Play battle end ME |
| 181 | + | |
| 182 | end | |
| 183 | - | ############################################################################ |
| 183 | + | |
| 184 | - | # Initialize EXP, amount of gold, and treasure |
| 184 | + | |
| 185 | end | |
| 186 | #============================================================================== | |
| 187 | # ** Scene_Map | |
| 188 | - | # Loop |
| 188 | + | #============================================================================== |
| 189 | class Scene_Map | |
| 190 | - | # If enemy is not hidden |
| 190 | + | |
| 191 | # * Call Battle | |
| 192 | - | # Add EXP and amount of gold obtained |
| 192 | + | |
| 193 | alias :fmodex_old_map_call_battle :call_battle unless $@ | |
| 194 | def call_battle | |
| 195 | - | # Determine if treasure appears |
| 195 | + | |
| 196 | fmodex_old_map_call_battle | |
| 197 | end | |
| 198 | #-------------------------------------------------------------------------- | |
| 199 | # * Call Menu | |
| 200 | #-------------------------------------------------------------------------- | |
| 201 | alias :fmodex_old_map_call_menu :call_menu unless $@ | |
| 202 | def call_menu | |
| 203 | $game_temp.map_bgm_pos = FMod.bgm_position | |
| 204 | $game_temp.map_bgs_pos = FMod.bgs_position | |
| 205 | $game_temp.map_bgm = $game_system.playing_bgm | |
| 206 | $game_temp.map_bgs = $game_system.playing_bgs | |
| 207 | fmodex_old_map_call_menu | |
| 208 | $game_system.bgm_fade 0.2 | |
| 209 | - | # Treasure is limited to a maximum of 6 items |
| 209 | + | |
| 210 | Audio.me_fade 0.2 | |
| 211 | - | # Obtaining EXP |
| 211 | + | |
| 212 | $game_system.bgm_play(bgm) | |
| 213 | end | |
| 214 | ||
| 215 | end | |
| 216 | end | |
| 217 | ||
| 218 | if Gluszak::Kontynuacja_BGM_po_bitwie | |
| 219 | #============================================================================== | |
| 220 | # ** Scene_Battle | |
| 221 | #============================================================================== | |
| 222 | - | # Obtaining gold |
| 222 | + | |
| 223 | #-------------------------------------------------------------------------- | |
| 224 | - | # Obtaining treasure |
| 224 | + | # * Judge |
| 225 | #-------------------------------------------------------------------------- | |
| 226 | def judge | |
| 227 | if $game_party.all_dead? or $game_party.actors.size == 0 | |
| 228 | if $game_temp.battle_can_lose | |
| 229 | $game_system.bgm_play($game_temp.map_bgm, $game_temp.map_bgm_pos) | |
| 230 | battle_end(2) | |
| 231 | return true | |
| 232 | end | |
| 233 | $game_temp.gameover = true | |
| 234 | return true | |
| 235 | - | # Make battle result window |
| 235 | + | |
| 236 | for enemy in $game_troop.enemies | |
| 237 | - | # Set wait count |
| 237 | + | |
| 238 | return false | |
| 239 | end | |
| 240 | end | |
| 241 | start_phase5 | |
| 242 | return true | |
| 243 | - | # If wait count is larger than 0 |
| 243 | + | |
| 244 | #-------------------------------------------------------------------------- | |
| 245 | - | # Decrease wait count |
| 245 | + | # * Phase 5 Start |
| 246 | #-------------------------------------------------------------------------- | |
| 247 | - | # If wait count reaches 0 |
| 247 | + | |
| 248 | @phase = 5 | |
| 249 | - | # Show result window |
| 249 | + | |
| 250 | $game_system.me_play($game_system.battle_end_me) | |
| 251 | - | # Clear main phase flag |
| 251 | + | |
| 252 | gold = 0 | |
| 253 | - | # Refresh status window |
| 253 | + | |
| 254 | for enemy in $game_troop.enemies | |
| 255 | unless enemy.hidden | |
| 256 | exp += enemy.exp | |
| 257 | gold += enemy.gold | |
| 258 | - | # If C button was pressed |
| 258 | + | |
| 259 | if enemy.item_id > 0 | |
| 260 | - | ############################################################################ |
| 260 | + | |
| 261 | - | # REMOVED $game_system.play_bgm BECAUSE IT'S DONE AUTOMATICALLY |
| 261 | + | |
| 262 | - | # WHEN ME IS DONE PLAYING |
| 262 | + | |
| 263 | - | ############################################################################ |
| 263 | + | |
| 264 | - | ############################################################################ |
| 264 | + | |
| 265 | - | # Battle ends |
| 265 | + | |
| 266 | treasures.push($data_armors[enemy.armor_id]) | |
| 267 | end | |
| 268 | end | |
| 269 | end | |
| 270 | end | |
| 271 | treasures = treasures[0..5] | |
| 272 | for i in 0...$game_party.actors.size | |
| 273 | actor = $game_party.actors[i] | |
| 274 | if actor.cant_get_exp? == false | |
| 275 | last_level = actor.level | |
| 276 | actor.exp += exp | |
| 277 | if actor.level > last_level | |
| 278 | @status_window.level_up(i) | |
| 279 | end | |
| 280 | end | |
| 281 | end | |
| 282 | $game_party.gain_gold(gold) | |
| 283 | for item in treasures | |
| 284 | case item | |
| 285 | when RPG::Item | |
| 286 | $game_party.gain_item(item.id, 1) | |
| 287 | when RPG::Weapon | |
| 288 | $game_party.gain_weapon(item.id, 1) | |
| 289 | when RPG::Armor | |
| 290 | $game_party.gain_armor(item.id, 1) | |
| 291 | end | |
| 292 | end | |
| 293 | @result_window = Window_BattleResult.new(exp, gold, treasures) | |
| 294 | @phase5_wait_count = 100 | |
| 295 | end | |
| 296 | #-------------------------------------------------------------------------- | |
| 297 | # * Phase 5 Update | |
| 298 | #-------------------------------------------------------------------------- | |
| 299 | def update_phase5 | |
| 300 | if @phase5_wait_count > 0 | |
| 301 | @phase5_wait_count -= 1 | |
| 302 | if @phase5_wait_count == 0 | |
| 303 | @result_window.visible = true | |
| 304 | $game_temp.battle_main_phase = false | |
| 305 | @status_window.refresh | |
| 306 | end | |
| 307 | return | |
| 308 | end | |
| 309 | if Input.trigger?(Input::C) | |
| 310 | battle_end(0) | |
| 311 | end | |
| 312 | end | |
| 313 | ||
| 314 | end | |
| 315 | end |