dawidpieper

Liczba postów: 38
Dołączył: 25-05-13
Pomógł: 5

|
Ustawienia
~ Ustawienia ~
Krótki opis:
Witam!
Napisałem ten skrypcik dla twierdzy rpg makera, ale standardowo go tutaj zamieszczam tym bardziej, że z tego, co widziałem nikt jeszcze tutaj takiego nie zamieścił.
Skrypt dodaje do gry ustawienia:
Głośność, dźwięk kroków, poziom trudności, skórka okna, profil systemowy i.t.p.
Głośność jest wciąż zależna od naszej głośności ustawionej podczas edycji zdarzeń.
Przykład:
ustawimy głośność SE 90%, a ktoś w ustawieniach wybierze opcję 50%. Wtedy dźwięk odezwie się z głośnością 45%.
Poziom trudności zmniejsza odpowiednio EXP uzyskiwane za pokonanie przeciwników i maksymalną liczbę HP, jak chcecie mogę też dodać SP.
Wzór:
Poziom (0,5 do 2) * max-HP
i
uzyskane doświadczenie / poziom
Mam nadzieję, że rozumiecie.
Skrypt pozwala też podczas walki testowej zmienić ustawienia, by obejrzeć poziomy trudności.
Jak coś nie działa piszcie, to poprawię.
Autor:
dawidpieper@o2.pl
Tłumaczenie:
skrypt oryginalny po Polsku
Skrypt:
#Skrypt dodaje ustawienia do gry
#Zmienia "Zamknij" w menu na "ustawienia"
#Jeśli chcesz dodać opcję ustawienia nie usuwając opcji wyjście musisz użyć dłuższego skryptu i mniej kąpatybilnego.
#Pobierzerz go stąd:
#http://dpieper.webd.pl/settings.txt
#wersja 1.1
#Konfiguracja: nic nie musisz konfigurować, ale
#Aby zmienić dźwięki kroków edytuj wartości w klasie Scene_Settings_Sounds_Steps
#Aby zmienić windowskiny wyedytuj klasę Scene_Settings_Interface_Skins
#Skrypt:
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs title screen processing.
#==============================================================================
class Scene_Title
def initialize
if FileTest.exist?("settings.stn") or $reset == true
settings = File.open("settings.stn", "r")
$volume = Marshal.load(settings)
$steps = Marshal.load(settings)
$level = Marshal.load(settings)
$skin = Marshal.load(settings)
$profile = Marshal.load(settings)
$reset = Marshal.load(settings)
settings.close
else
settings = File.open("settings.stn", "w")
Marshal.dump(100, settings)
Marshal.dump(nil, settings)
Marshal.dump(1, settings)
Marshal.dump("001-blue01.png", settings)
Marshal.dump(1, settings)
Marshal.dump(nil, settings)
settings.close
$scene = Scene_Title.new
end
end
if $profile == 0
@GetCurrentProcess=Win32API.new('kernel32','GetCurrentProcess',[],'i').call
@SetPriorityClass=Win32API.new('kernel32','SetPriorityClass',['p', 'i'],'i')
@SetPriorityClass.call(@GetCurrentProcess, 0x00000100)
end
if $profile == 1
@GetCurrentProcess=Win32API.new('kernel32','GetCurrentProcess',[],'i').call
@SetPriorityClass=Win32API.new('kernel32','SetPriorityClass',['p', 'i'],'i')
@SetPriorityClass.call(@GetCurrentProcess, 0x00000080)
end
alias pajper_settings_001 main
def main
pajper_settings_001
# If battle test
if $BTEST
if $sbt == nil
print ("Teraz przejdziesz do konfiguracji. Przed tobą ukażą się ustawienia na czas tej walki. Aby pozostawić domyślne, nic nie zmieniaj. Po zamknięciu okna ustawień walka testowa rozpocznie się automatycznie")
$sbt = true
$scene = Scene_Settings_Load.new
else
battle_test
end
return
end
s1 = "nowa gra"
s2 = "Wczytaj"
s3 = "Ustawienia"
s4 = "Wyjście"
@command_window = Window_Command.new(192, [s1, s2, s3, s4])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
loop do
Input.update
Graphics.update
update
if $scene != self
break
end
end
end
alias pajper_settings_002 update
def update
pajper_settings_002
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # New game
command_new_game
when 1 # Continue
command_continue
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Settings_Load.new
when 3 # Shutdown
command_shutdown
end
end
if Input.trigger?(Input::B)
command_shutdown
end
end
# * Battle Test
#--------------------------------------------------------------------------
def battle_test
# Load database (for battle test)
$data_actors = load_data("Data/BT_Actors.rxdata")
$data_classes = load_data("Data/BT_Classes.rxdata")
$data_skills = load_data("Data/BT_Skills.rxdata")
$data_items = load_data("Data/BT_Items.rxdata")
$data_weapons = load_data("Data/BT_Weapons.rxdata")
$data_armors = load_data("Data/BT_Armors.rxdata")
$data_enemies = load_data("Data/BT_Enemies.rxdata")
$data_troops = load_data("Data/BT_Troops.rxdata")
$data_states = load_data("Data/BT_States.rxdata")
$data_animations = load_data("Data/BT_Animations.rxdata")
$data_tilesets = load_data("Data/BT_Tilesets.rxdata")
$data_common_events = load_data("Data/BT_CommonEvents.rxdata")
$data_system = load_data("Data/BT_System.rxdata")
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# Set up party for battle test
$game_party.setup_battle_test_members
# Set troop ID, can escape flag, and battleback
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name
# Play battle start SE
$game_system.se_play($data_system.battle_start_se)
# Play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# Switch to battle screen
$scene = Scene_Battle.new
end
end
class Scene_Settings_Start
def main
$temp_volume = $volume
$scene = Scene_Settings.new
end
end
#==============================================================================
# ** Scene_Settings
#------------------------------------------------------------------------------
# This class performs title screen processing.
#==============================================================================
class Scene_Settings
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
if $settings == false
ustawienia = File.open("settings.stn","r")
$glosnosc = Marshal.load(ustawienia)
ustawienia.close
end
$settings = true
# Make system object
$game_system_settings_temporary = Game_System.new
# Make title graphic
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# Make command window
s1 = "ustawienia dźwięku"
s2 = "ustawienia interfejsu"
s3 = "inne ustawienia"
s4 = "Zapisz"
s5 = "Anuluj"
@command_window = Window_Command.new(192, [s1, s2, s3, s4, s5])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
# Stop playing ME and BGS
Audio.me_stop
Audio.bgs_stop
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of command window
@command_window.dispose
# Dispose of title graphic
@sprite.bitmap.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Settings_Sounds.new
when 1
$game_system.se_play($data_system.decision_se)
$scene = Scene_Settings_Interface.new
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Settings_Other.new
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Settings_Save.new
when 4
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Title.new
end
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Title.new
end
end
end
class Scene_Settings_Sounds
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make system object
$game_system_settings_temporary = Game_System.new
# Make title graphic
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# Make command window
s1 = "Głośność"
s2 = "Dźwięki kroków"
s3 = "Powrót"
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
# Stop playing ME and BGS
Audio.me_stop
Audio.bgs_stop
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of command window
@command_window.dispose
# Dispose of title graphic
@sprite.bitmap.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Settings_Sounds_Volume.new
when 1
$game_system.se_play($data_system.decision_se)
$scene = Scene_Settings_Sounds_Steps.new
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Settings.new
end
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end
end
end
class Scene_Settings_Sounds_Volume
def main
$temp_settings_volume = 0
$window = Window_Settings_Sounds_Volume.new
loop do
Graphics.update
Input.update
$window.refresh
update
if $scene != self
break
end
end
$window.dispose
end
def update
if Input.trigger?(Input::UP)
if $temp_settings_volume <= 90
$temp_settings_volume = $temp_settings_volume + 10
else
$temp_settings_volume = $temp_settings_volume - 90
end
end
if Input.trigger?(Input::DOWN)
if $temp_settings_volume >= 10
$temp_settings_volume = $temp_settings_volume - 10
else
$temp_settings_volume = $temp_settings_volume + 90
end
end
if Input.trigger?(Input::RIGHT)
if $temp_settings_volume <= 100
$temp_settings_volume = $temp_settings_volume + 1
else
$temp_settings_volume = $temp_settings_volume - 99
end
end
if Input.trigger?(Input::LEFT)
if $temp_settings_volume >= 0
$temp_settings_volume = $temp_settings_volume - 1
else
$temp_settings_volume = $temp_settings_volume + 99 + 1
end
end
if Input.trigger?(Input::C)
$window.dispose
$scene = Scene_Settings_Sounds.new
end
end
end
class Window_Settings_Sounds_Volume < Window_Base
def initialize
super(0, 0, 160, 60)
self.contents = Bitmap.new(width, height)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize + 2
self.back_opacity = 160
refresh
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, 0,160, 32, "Wybierz głośność w procentach:")
self.contents.draw_text(0, 0,180, 42, $temp_settings_volume)
end
end
#==============================================================================
# ■ Game_System
#------------------------------------------------------------------------------
# システム周りのデータを扱うクラスです。BGM などの管理も行います。このクラス
# のインスタンスは $game_system で参照されます。
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ● BGM の演奏
# bgm : 演奏する BGM
#--------------------------------------------------------------------------
def bgm_play(bgm)
@playing_bgm = bgm
if $music == 0
if bgm != nil and bgm.name != ""
Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume - 80 + $volume, bgm.pitch)
else
Audio.bgm_stop
end
else
Audio.bgm_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ● BGM の停止
#--------------------------------------------------------------------------
def bgm_stop
Audio.bgm_stop
end
#--------------------------------------------------------------------------
# ● BGS の演奏
# bgs : 演奏する BGS
#--------------------------------------------------------------------------
def bgs_play(bgs)
@playing_bgs = bgs
if bgs != nil and bgs.name != ""
Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume - 80 + $volume, bgs.pitch)
else
Audio.bgs_stop
end
Graphics.frame_reset
end
# # me : 演奏する ME
#--------------------------------------------------------------------------
def me_play(me)
if me != nil and me.name != ""
Audio.me_play("Audio/ME/" + me.name, me.volume - 80 + $volume, me.pitch)
else
Audio.me_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ● SE の演奏
# se : 演奏する SE
#--------------------------------------------------------------------------
def se_play(se)
if se != nil and se.name != ""
Audio.se_play("Audio/SE/" + se.name, se.volume - 80 + $volume, se.pitch)
end
end
#--------------------------------------------------------------------------
# ● SE の停止
#--------------------------------------------------------------------------
def se_stop
Audio.se_stop
end
end
#--------------------------------------------------------------------------
class Scene_Settings_Sounds_Steps
def main
@@step = nil
@@wykonane = false
loop do
Input.update
Graphics.update
update
if $scene != self
break
end
end
end
def update
if Input.trigger?(Input::UP)
if @@wykonane == false
if @@step == nil
@@step = "016-Jump02.ogg"
@@wykonane = true
end
end
if @@step == "016-Jump02.ogg"
if @@wykonane == false
@@step = "017-Jump03.ogg"
@@wykonane = true
end
end
if @@step == "017-Jump03.ogg"
if @@wykonane == false
@@step = nil
@@wykonane = true
end
end
if @@step != nil
Audio.se_play("Audio/SE/" + @@step, 100, 100)
end
@@wykonane = false
end
if Input.trigger?(Input::DOWN)
if @@step == nil
if @@wykonane == false
@@step = "017-Jump03.ogg"
@@wykonane = true
end
end
if @@step == "017-Jump03.ogg"
if @@wykonane == false
@@step = "016-Jump02.ogg"
@@wykonane = true
end
end
if @@step == "016-Jump02.ogg"
if @@wykonane == false
@@step = nil
@@wykonane = true
end
end
if @@step != nil
Audio.se_play("Audio/SE/" + @@step, 100, 100)
end
end
if Input.trigger?(Input::C)
$temp_steps = @@step
$scene = Scene_Settings_Sounds.new
end
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# マップ画面の処理を行うクラスです。
#==============================================================================
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# マップ画面の処理を行うクラスです。
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# スプライトセットを作成
@spriteset = Spriteset_Map.new
# メッセージウィンドウを作成
@message_window = Window_Message.new
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# スプライトセットを解放
@spriteset.dispose
# メッセージウィンドウを解放
@message_window.dispose
# タイトル画面に切り替え中の場合
if $scene.is_a?(Scene_Title)
# 画面をフェードアウト
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ループ
loop do
# マップ、インタプリタ、プレイヤーの順に更新
# (この更新順序は、イベントを実行する条件が満たされているときに
# プレイヤーに一瞬移動する機会を与えないなどの理由で重要)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# システム (タイマー)、画面を更新
$game_system.update
$game_screen.update
# プレイヤーの場所移動中でなければループを中断
unless $game_temp.player_transferring
break
end
# 場所移動を実行
transfer_player
# トランジション処理中の場合、ループを中断
if $game_temp.transition_processing
break
end
end
# スプライトセットを更新
@spriteset.update
# メッセージウィンドウを更新
@message_window.update
# ゲームオーバーの場合
if $game_temp.gameover
# ゲームオーバー画面に切り替え
$scene = Scene_Gameover.new
return
end
# タイトル画面に戻す場合
if $game_temp.to_title
# タイトル画面に切り替え
$scene = Scene_Title.new
return
end
# トランジション処理中の場合
if $game_temp.transition_processing
# トランジション処理中フラグをクリア
$game_temp.transition_processing = false
# トランジション実行
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# メッセージウィンドウ表示中の場合
if $game_temp.message_window_showing
return
end
# エンカウント カウントが 0 で、エンカウントリストが空ではない場合
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
# イベント実行中かエンカウント禁止中でなければ
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# トループを決定
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# トループが有効なら
if $data_troops[troop_id] != nil
# バトル呼び出しフラグをセット
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
# B ボタンが押された場合
if Input.trigger?(Input::B)
# イベント実行中かメニュー禁止中でなければ
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
# メニュー呼び出しフラグと SE 演奏フラグをセット
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
if Input.repeat?(Input::LEFT) or Input.repeat?(Input::RIGHT) or Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN)
if $steps != nil
Audio.se_play("Audio/SE/" + $steps, 100, 100)
end
end
# デバッグモードが ON かつ F9 キーが押されている場合
if $DEBUG and Input.press?(Input::F9)
# デバッグ呼び出しフラグをセット
$game_temp.debug_calling = true
end
# プレイヤーの移動中ではない場合
unless $game_player.moving?
# 各種画面の呼び出しを実行
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
#--------------------------------------------------------------------------
# ● バトルの呼び出し
#--------------------------------------------------------------------------
def call_battle
# バトル呼び出しフラグをクリア
$game_temp.battle_calling = false
# メニュー呼び出しフラグをクリア
$game_temp.menu_calling = false
$game_temp.menu_beep = false
# エンカウント カウントを作成
$game_player.make_encounter_count
# マップ BGM を記憶し、BGM を停止
$game_temp.map_bgm = $game_system.playing_bgm
$game_system.bgm_stop
# バトル開始 SE を演奏
$game_system.se_play($data_system.battle_start_se)
# バトル BGM を演奏
$game_system.bgm_play($game_system.battle_bgm)
# プレイヤーの姿勢を矯正
$game_player.straighten
# バトル画面に切り替え
$scene = Scene_Battle.new
end
#--------------------------------------------------------------------------
# ● ショップの呼び出し
#--------------------------------------------------------------------------
def call_shop
# ショップ呼び出しフラグをクリア
$game_temp.shop_calling = false
# プレイヤーの姿勢を矯正
$game_player.straighten
# ショップ画面に切り替え
$scene = Scene_Shop.new
end
#--------------------------------------------------------------------------
# ● 名前入力の呼び出し
#--------------------------------------------------------------------------
def call_name
# 名前入力呼び出しフラグをクリア
$game_temp.name_calling = false
# プレイヤーの姿勢を矯正
$game_player.straighten
# 名前入力画面に切り替え
$scene = Scene_Name.new
end
#--------------------------------------------------------------------------
# ● メニューの呼び出し
#--------------------------------------------------------------------------
def call_menu
# メニュー呼び出しフラグをクリア
$game_temp.menu_calling = false
# メニュー SE 演奏フラグがセットされている場合
if $game_temp.menu_beep
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# メニュー SE 演奏フラグをクリア
$game_temp.menu_beep = false
end
# プレイヤーの姿勢を矯正
$game_player.straighten
# メニュー画面に切り替え
$scene = Scene_Menu.new
end
#--------------------------------------------------------------------------
# ● セーブの呼び出し
#--------------------------------------------------------------------------
def call_save
# プレイヤーの姿勢を矯正
$game_player.straighten
# セーブ画面に切り替え
$scene = Scene_Save.new
end
#--------------------------------------------------------------------------
# ● デバッグの呼び出し
#--------------------------------------------------------------------------
def call_debug
# デバッグ呼び出しフラグをクリア
$game_temp.debug_calling = false
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# プレイヤーの姿勢を矯正
$game_player.straighten
# デバッグ画面に切り替え
$scene = Scene_Debug.new
end
#--------------------------------------------------------------------------
# ● プレイヤーの場所移動
#--------------------------------------------------------------------------
def transfer_player
# プレイヤー場所移動フラグをクリア
$game_temp.player_transferring = false
# 移動先が現在のマップと異なる場合
if $game_map.map_id != $game_temp.player_new_map_id
# 新しいマップをセットアップ
$game_map.setup($game_temp.player_new_map_id)
end
# プレイヤーの位置を設定
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
# プレイヤーの向きを設定
case $game_temp.player_new_direction
when 2 # 下
$game_player.turn_down
when 4 # 左
$game_player.turn_left
when 6 # 右
$game_player.turn_right
when 8 # 上
$game_player.turn_up
end
# プレイヤーの姿勢を矯正
$game_player.straighten
# マップを更新 (並列イベント実行)
$game_map.update
# スプライトセットを再作成
@spriteset.dispose
@spriteset = Spriteset_Map.new
# トランジション処理中の場合
if $game_temp.transition_processing
# トランジション処理中フラグをクリア
$game_temp.transition_processing = false
# トランジション実行
Graphics.transition(20)
end
# マップに設定されている BGM と BGS の自動切り替えを実行
$game_map.autoplay
# フレームリセット
Graphics.frame_reset
# 入力情報を更新
Input.update
end
end
#==============================================================================
# ■ Scene
#------------------------------------------------------------------------------
# ゲーム終了画面の処理を行うクラスです。
#==============================================================================
class Scene_Settings_Interface
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# コマンドウィンドウを作成
s1 = "Skórka okna gry"
s2 = "Poziom trudności"
s3 = "Powrót"
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 240 - @command_window.height / 2
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@command_window.dispose
# タイトル画面に切り替え中の場合
if $scene.is_a?(Scene_Title)
# 画面をフェードアウト
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# コマンドウィンドウを更新
@command_window.update
# B ボタンが押された場合
# C ボタンが押された場合
if Input.trigger?(Input::C)
# コマンドウィンドウのカーソル位置で分岐
case @command_window.index
when 0 # タイトルへ
$game_system.se_play($data_system.decision_se)
$scene = Scene_Settings_Interface_Skin.new
when 1
$game_system.se_play($data_system.decision_se)
$scene = Scene_Settings_Interface_Level.new
when 2 # やめる
$game_system.se_play($data_system.decision_se)
$scene = Scene_Settings.new
end
end
end
end
class Scene_Settings_Interface_Skin
def main
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.windowskin($data_system.windowskin_name)
@@kursor = 0
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
@sprite.dispose
@sprite.bitmap.dispose
end
end
def update
if Input.trigger?(Input::A)
if @@kursor == 0
@sprite.dispose
@sprite.bitmap.dispose
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.windowskin("001-blue01")
@@kursor = 1
else
@sprite.dispose
@sprite.bitmap.dispose
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.windowskin($data_system.windowskin_name)
end
end
if Input.trigger?(Input::C)
if @@kursor = 0
$temp_windowskin = $data_system.windowskin_name
else
$temp_windowskin = "001-blue01"
end
$scene = Scene_Settings_Interface.new
end
end
end
#==============================================================================
# ■ Scene
#------------------------------------------------------------------------------
# ゲーム終了画面の処理を行うクラスです。
#==============================================================================
class Scene_Settings_Interface_Level
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# コマンドウィンドウを作成
s1 = "łatwy"
s2 = "Normalny"
s3 = "Trudny"
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 240 - @command_window.height / 2
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@command_window.dispose
# タイトル画面に切り替え中の場合
if $scene.is_a?(Scene_Title)
# 画面をフェードアウト
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# コマンドウィンドウを更新
@command_window.update
# B ボタンが押された場合
# C ボタンが押された場合
if Input.trigger?(Input::C)
# コマンドウィンドウのカーソル位置で分岐
case @command_window.index
when 0 # タイトルへ
$temp_lewel = 0.5
when 1 # シャットダウン
$temp_lewel = 1
when 2 # やめる
$temp_level = 2
end
$scene = Scene_Settings_Interface.new
end
end
end
#==============================================================================
# ■ Game_Enemy
#------------------------------------------------------------------------------
# エネミーを扱うクラスです。このクラスは Game_Troop クラス ($game_troop) の
# 内部で使用されます。
#==============================================================================
class Game_Enemy < Game_Battler
alias pajper_settings_003 initialize
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# troop_id : トループ ID
# member_index : トループメンバーのインデックス
#--------------------------------------------------------------------------
def initialize(troop_id, member_index)
pajper_settings_003
@hp = maxhp * $level
@sp = maxsp * $level
end
def base_maxhp
return $data_enemies[@enemy_id].maxhp * $level
end
def base_maxsp
return $data_enemies[@enemy_id].maxsp * $level
end
def base_atk
return $data_enemies[@enemy_id].atk + $level * 10
end
def base_pdef
return $data_enemies[@enemy_id].pdef + $level * 10
end
def base_mdef
return $data_enemies[@enemy_id].mdef + $level * 5
end
def base_eva
return $data_enemies[@enemy_id].eva + $level * 2
end
def exp
return $data_enemies[@enemy_id].exp / $level
end
#--------------------------------------------------------------------------
# ● ゴールドの取得
#--------------------------------------------------------------------------
def gold
if $level == 2
losowanie = rand(2) + 1
else
losowanie = 1
end
return $data_enemies[@enemy_id].gold / losowanie
end
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ● トレジャー出現率の取得
#--------------------------------------------------------------------------
def treasure_prob
return $data_enemies[@enemy_id].treasure_prob
end
def escape
# ヒドゥンフラグをセット
@hidden = true
# カレントアクションをクリア
self.current_action.clear
end
end
#==============================================================================
# ■ Scene
#------------------------------------------------------------------------------
# ゲーム終了画面の処理を行うクラスです。
#==============================================================================
class Scene_Settings_Other
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# コマンドウィンドウを作成
s1 = "Zmień profil systemowy gry"
s2 = "Przywróć ustawienia domyślne"
s3 = "Powrót"
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 240 - @command_window.height / 2
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@command_window.dispose
# タイトル画面に切り替え中の場合
if $scene.is_a?(Scene_Title)
# 画面をフェードアウト
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# コマンドウィンドウを更新
@command_window.update
# B ボタンが押された場合
# C ボタンが押された場合
if Input.trigger?(Input::C)
# コマンドウィンドウのカーソル位置で分岐
case @command_window.index
when 0 # タイトルへ
$game_system.se_play($data_system.decision_se)
$scene = Scene_Settings_Other_Profile.new
when 1 # シャットダウン
$game_system.se_play($data_system.decision_se)
$temp_reset = true
$scene = Scene_Settings_Save.new
when 2 # やめる
$game_system.se_play($data_system.decision_se)
$scene = Scene_Settings.new
end
end
end
end
#==============================================================================
# ■ Scene
#------------------------------------------------------------------------------
# ゲーム終了画面の処理を行うクラスです。
#==============================================================================
class Scene_Settings_Other_Profile
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# コマンドウィンドウを作成
s1 = "Czasu rzeczywistego"
s2 = "Wysoki (zalecany)"
s3 = "Normalny"
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 240 - @command_window.height / 2
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@command_window.dispose
# タイトル画面に切り替え中の場合
if $scene.is_a?(Scene_Title)
# 画面をフェードアウト
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# コマンドウィンドウを更新
@command_window.update
# C ボタンが押された場合
if Input.trigger?(Input::C)
# コマンドウィンドウのカーソル位置で分岐
case @command_window.index
when 0 # タイトルへ
@GetCurrentProcess=Win32API.new('kernel32','GetCurrentProcess',[],'i').call
@SetPriorityClass=Win32API.new('kernel32','SetPriorityClass',['p', 'i'],'i')
@SetPriorityClass.call(@GetCurrentProcess, 0x00000100)
$temp_profile = 0
when 1 # シャットダウン
@GetCurrentProcess=Win32API.new('kernel32','GetCurrentProcess',[],'i').call
@SetPriorityClass=Win32API.new('kernel32','SetPriorityClass',['p', 'i'],'i')
@SetPriorityClass.call(@GetCurrentProcess, 0x00000080)
$temp_profile = 1
when 2 # やめる
@GetCurrentProcess=Win32API.new('kernel32','GetCurrentProcess',[],'i').call
@SetPriorityClass=Win32API.new('kernel32','SetPriorityClass',['p', 'i'],'i')
@SetPriorityClass.call(@GetCurrentProcess, 0x00000060)
$temp_profile = 2
end
$scene = Scene_Settings_Other.ne
end
end
end
class Scene_Settings_Save
def main
settings = File.open("settings.stn", "w")
Marshal.dump($temp_volume, settings)
Marshal.dump($temp_steps, settings)
Marshal.dump($temp_level, settings)
Marshal.dump($temp_skin, settings)
Marshal.dump($temp_profile, settings)
Marshal.dump($temp_reset, settings)
settings.close
$scene = Scene_Title.new
end
end
class Scene_Settings_Load
def main
$temp_volume = $volume
$temp_steps = $steps
$temp_profile = $profile
$temp_skin = $skin
$temp_level = $level
$scene = Scene_Settings.new
$temp_reset = $reset
end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# ゲーム中のすべてのウィンドウのスーパークラスです。
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# x : ウィンドウの X 座標
# y : ウィンドウの Y 座標
# width : ウィンドウの幅
# height : ウィンドウの高さ
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super()
@windowskin_name = $skin
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
self.x = x
self.y = y
self.width = width
self.height = height
self.z = 100
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
# ウィンドウ内容のビットマップが設定されていれば解放
if self.contents != nil
self.contents.dispose
end
super
end
#--------------------------------------------------------------------------
# ● 文字色取得
# n : 文字色番号 (0~7)
#--------------------------------------------------------------------------
def text_color(n)
case n
when 0
return Color.new(255, 255, 255, 255)
when 1
return Color.new(128, 128, 255, 255)
when 2
return Color.new(255, 128, 128, 255)
when 3
return Color.new(128, 255, 128, 255)
when 4
return Color.new(128, 255, 255, 255)
when 5
return Color.new(255, 128, 255, 255)
when 6
return Color.new(255, 255, 128, 255)
when 7
return Color.new(192, 192, 192, 255)
else
normal_color
end
end
#--------------------------------------------------------------------------
# ● 通常文字色の取得
#--------------------------------------------------------------------------
def normal_color
return Color.new(255, 255, 255, 255)
end
#--------------------------------------------------------------------------
# ● 無効文字色の取得
#--------------------------------------------------------------------------
def disabled_color
return Color.new(255, 255, 255, 128)
end
#--------------------------------------------------------------------------
# ● システム文字色の取得
#--------------------------------------------------------------------------
def system_color
return Color.new(192, 224, 255, 255)
end
#--------------------------------------------------------------------------
# ● ピンチ文字色の取得
#--------------------------------------------------------------------------
def crisis_color
return Color.new(255, 255, 64, 255)
end
#--------------------------------------------------------------------------
# ● 戦闘不能文字色の取得
#--------------------------------------------------------------------------
def knockout_color
return Color.new(255, 64, 0)
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
# ウィンドウスキンが変更された場合、再設定
if $game_system.windowskin_name != @windowskin_name
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
end
end
#--------------------------------------------------------------------------
# ● グラフィックの描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# ● 名前の描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_actor_name(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name)
end
#--------------------------------------------------------------------------
# ● クラスの描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_actor_class(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 236, 32, actor.class_name)
end
#--------------------------------------------------------------------------
# ● レベルの描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_actor_level(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Level")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 描画用のステート文字列作成
# actor : アクター
# width : 描画先の幅
# need_normal : [正常] が必要かどうか (true / false)
#--------------------------------------------------------------------------
def make_battler_state_text(battler, width, need_normal)
# 括弧の幅を取得
brackets_width = self.contents.text_size("[]").width
# ステート名の文字列を作成
text = ""
for i in battler.states
if $data_states[i].rating >= 1
if text == ""
text = $data_states[i].name
else
new_text = text + "/" + $data_states[i].name
text_width = self.contents.text_size(new_text).width
if text_width > width - brackets_width
break
end
text = new_text
end
end
end
# ステート名の文字列が空の場合は "[正常]" にする
if text == ""
if need_normal
text = "[Normal]"
end
else
# 括弧をつける
text = "[" + text + "]"
end
# 完成した文字列を返す
return text
end
#--------------------------------------------------------------------------
# ● ステートの描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
# width : 描画先の幅
#--------------------------------------------------------------------------
def draw_actor_state(actor, x, y, width = 120)
text = make_battler_state_text(actor, width, true)
self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
self.contents.draw_text(x, y, width, 32, text)
end
#--------------------------------------------------------------------------
# ● EXP の描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_actor_exp(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 24, 32, "Exp")
self.contents.font.color = normal_color
self.contents.draw_text(x + 24, y, 84, 32, actor.exp_s, 2)
self.contents.draw_text(x + 108, y, 12, 32, "/", 1)
self.contents.draw_text(x + 120, y, 84, 32, actor.next_exp_s)
end
#--------------------------------------------------------------------------
# ● HP の描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
# width : 描画先の幅
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 144)
# 文字列 "HP" を描画
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
# MaxHP を描画するスペースがあるか計算
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
# HP を描画
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
# MaxHP を描画
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
end
#--------------------------------------------------------------------------
# ● SP の描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
# width : 描画先の幅
#--------------------------------------------------------------------------
def draw_actor_sp(actor, x, y, width = 144)
# 文字列 "SP" を描画
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
# MaxSP を描画するスペースがあるか計算
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
# SP を描画
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
# MaxSP を描画
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
end
end
#--------------------------------------------------------------------------
# ● パラメータの描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
# type : パラメータの種類 (0~6)
#--------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
#--------------------------------------------------------------------------
# ● アイテム名の描画
# item : アイテム
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_item_name(item, x, y)
if item == nil
return
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name)
end
end
Dodatkowe informacje:
Wkrótce dodam screenshoty i demo.
Pozdrawiam
Dawid Pieper
(Ten post był ostatnio modyfikowany: 15-06-13 13:04 przez dawidpieper.)
|
|