Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- 使い方:
- ・差し替えたい画像を640x480のpngで用意する
- ・ファイル名の頭を「x_」にする ※ファイル名に日本語は使わない
- ・Graphics/Pictures/に用意した画像を入れる
- ・ゲーム中Sキーで用意した画像を呼び出せる
- ・戦闘中に呼び出した場合、戦闘中の敵の画像が差し替わる
- ・マップで呼び出した場合、次にエンカウントする敵の画像が差し替わる
- ・複数の画像を用意した場合、Sキーを押す度に切り替わる
- ・一度画像を差し替えた敵は次にエンカウントした時も差し替わったままになる
- ・ファイル名末尾に「_g1」「_s1」など付けることで差分になる 詳しくはオリジナルの画像ファイル参照
- =end
- class Scene_Base
- #------------------------------------------------------------------------------
- def init_retka_pictures
- @retka_pictures = Dir.glob('Graphics/Pictures/x_*.png')
- @retka_pictures.delete_if {|picture_name| picture_name =~ /x_(.+?)_(.+?)/ }
- for picture_name in @retka_pictures
- picture_name.gsub!(/Graphics\/Pictures\/(.+?)\.png/,'\1')
- end
- @retka_picture_index = -1
- end
- #------------------------------------------------------------------------------
- def update_retka_pictures
- Sound.play_decision
- @retka_picture_index += 1
- @retka_picture_index = 0 if @retka_picture_index > @retka_pictures.length - 1
- for i in 5..17
- $game_troop.screen.pictures[i].erase
- end
- $game_variables[141] = 999 if !$game_temp.in_battle
- $game_variables[1001][$game_variables[141]] = @retka_pictures[@retka_picture_index]
- end
- #------------------------------------------------------------------------------
- end
- #==============================================================================
- class Scene_Map < Scene_Base
- #------------------------------------------------------------------------------
- alias retka_start start
- def start
- $game_variables[1001] = [] if !$game_variables[1001].is_a?(Array)
- init_retka_pictures
- $game_map.screen.pictures[3].erase
- retka_start
- end
- alias retka_update update
- def update
- if Input.trigger?(Input::Y)
- update_retka_pictures
- $game_map.screen.pictures[3].show(@retka_pictures[@retka_picture_index], 0, 640*3/4, 0, 25, 25, 255, 0)
- end
- retka_update
- end
- #------------------------------------------------------------------------------
- end
- #==============================================================================
- class Scene_Battle < Scene_Base
- #------------------------------------------------------------------------------
- alias retka_start start
- def start
- init_retka_pictures
- retka_start
- end
- #------------------------------------------------------------------------------
- alias retka_update update
- def update
- if Input.trigger?(Input::Y)
- update_retka_pictures
- $game_troop.screen.pictures[3].show(@retka_pictures[@retka_picture_index], 0, 0, 0, 100, 100, 255, 0)
- end
- retka_update
- end
- #------------------------------------------------------------------------------
- end
- #==============================================================================
- class Game_Picture
- #------------------------------------------------------------------------------
- alias retka_show show
- def show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
- retka_show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
- x_name = $game_variables[1001][$game_variables[141]]
- if $game_temp.in_battle && $game_variables[1001][999]
- x_name = $game_variables[1001][999]
- $game_variables[1001][$game_variables[141]] = x_name
- $game_variables[1001][999] = nil
- end
- if name =~ /^[0-9]+_/ && $game_temp.in_battle && x_name
- name.gsub!(/^[0-9]+/, x_name)
- if name =~ /_s([0-9]+)$/ && !FileTest.exist?("Graphics/Pictures/" + name +".png")
- i = $1.to_i
- while i > 0
- new_name = name.gsub(/_s([0-9]+)$/, "_s" + i.to_s)
- if FileTest.exist?("Graphics/Pictures/" + new_name +".png")
- name = new_name
- break
- end
- i -= 1
- end
- end
- end
- name = x_name if x_name && !FileTest.exist?("Graphics/Pictures/" + name +".png")
- @name = name
- end
- #------------------------------------------------------------------------------
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement