Oblivion-like Menu System
Version 1.0
Author Feoden
Release Date 15-02-12
This script has been created if you wish to create a map battle system with 1 character (but also works with any kind of battle, since it is only a menu) and has been inspired by oblivion menu.
Features
4 scenes up to now:
Parameters
Equipment(Everything in a single window. Why has anyone thought about it?)
Items
Skills
Script
CODE
#Oblivionlike-menu---------------------------------------------------------
#By Feoden
#V 1.0
#Feel free to use it, just do not claim as your own
#--------------------------------------------------------------------------
#change this to allow bar on the map.
BAR_ON_MAPS = true
class Window_Base
#---------------------------------------------------------------------
def draw_actor_face(actor, x, y)
#If you wish to change the picture name, modify here
face = RPG::Cache.picture("Hero")
fw = face.width
fh = face.height
src_rect = Rect.new(0, 0, fw, fh)
self.contents.blt(x - fw / 23, y - fh, face, src_rect)
end
#---------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type, l=120)
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
when 7
parameter_name = "Evasion"
parameter_value = actor.eva
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, l, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + l, y, 36, 32, parameter_value.to_s, 2)
end
#---------------------------------------------------------------------
end
class Window_Instruments < Window_Selectable
#--------------------------------------------------------------------------
def initialize
super(0, 64, 480, 352)
@column_max = 2
refresh
self.index = 0
end
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
def max_item
return @item_max
end
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
number = $game_party.item_number(item.id)
if $game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (240)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 124, 32, item.name, 0)
self.contents.draw_text(x + 152, y, 16, 32, ":", 1)
self.contents.draw_text(x + 168, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
class Window_Parameters < Window_Selectable
#--------------------------------------------------------------------------
def initialize
super(0, 0, 480, 352)
self.contents = Bitmap.new(width - 32, 1300)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
self.index = 0
end
#--------------------------------------------------------------------------
def refresh
@item_max = 11
self.contents.clear
for i in 0...8
x = 64
y = i * 107 + 38
actor = $game_party.actors[0]
text = ["Weapons attack allows","to inflict damage.",
"Physical Defence reduces","damage from weapons.",
"Magical Defence reduces", "damage received from magic.",
"Strength multiplies", "the physical damage.",
"Dexterity is your skill.", "Improves Aim and Luck.",
"Speed improves your", "athletical skills.",
"Magic allows you to", "cast more powerful spells.",
"Evasion allows you", "to avoid enemy attacks."]
self.contents.font.color = system_color
self.contents.font.size = 18
self.contents.font.name = $fontface
self.contents.draw_text(x+180,y-16, 200, 32, text[i*2])
self.contents.draw_text(x+180,y+16, 200, 32, text[i*2+1])
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
draw_actor_parameter(actor, x, y, i)
bitmap = RPG::Cache.picture("rect")
self.contents.blt(x-10, y-8, bitmap, Rect.new(0, 0, 180, 48))
end
draw_actor_hp(actor, 64, 894+0*107, 160)
draw_actor_sp(actor, 64, 894+1*107, 160)
draw_actor_exp(actor, 64, 894+2*107, 160)
text2=["If your HP reaches 0","you lose the game.",
"MP allows to cast","any spell you know.",
"Your experience lets you","improve your fighting skills"]
for i in 0...3
bitmap = RPG::Cache.picture("rect")
self.contents.blt(x-10, 894-8+i*107, bitmap, Rect.new(0, 0, 180, 48))
self.contents.font.color = system_color
self.contents.font.size = 18
self.contents.font.name = $fontface
self.contents.draw_text(x+180,894-16+i*107, 200, 32, text2[i*2])
self.contents.draw_text(x+180,894+16+i*107, 200, 32, text2[i*2+1])
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
end
end
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 107- self.oy, self.width - 32, 106)
end
row = @index
if row < self.top_row
self.top_row = row
end
if row > self.top_row + 2#(self.page_row_max - 1)
self.top_row = row - 2#(self.page_row_max - 1)
end
end
def top_row
return self.oy / 107
end
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 107
end
#--------------------------------------------------------------------------
def page_row_max
return (self.height-32) / 107
end
end
class Window_Wear < Window_Selectable
#--------------------------------------------------------------------------
def initialize
super(0, 64, 480, 352)
@column_max = 1
refresh
self.index = 0
end
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# アイテムを追加
@data.push(0)
unless $game_actors[1].weapon_id == 0
@data.push(-10)
end
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
@data.push(-1)
unless $game_actors[1].armor1_id == 0
@data.push(-11)
end
unless $game_actors[1].armor2_id == 0
@data.push(-12)
end
unless $game_actors[1].armor3_id == 0
@data.push(-13)
end
unless $game_actors[1].armor4_id == 0
@data.push(-14)
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
# 項目数が 0 でなければビットマップを作成し、全項目を描画
@item_max = @data.size
if @item_max > 2
self.contents = Bitmap.new(width - 32, @item_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
if @data[i] == 0
x = 4
y = i * 32
self.contents.font.name = "Monotype Corsiva"
self.contents.font.size = 30
self.contents.font.color = crisis_color
self.contents.draw_text(x+165, y, 150, 32, "Weapons")
elsif @data[i] == -10
item = $data_weapons[$game_actors[1].weapon_id]
x = 4
y = i * 32
self.contents.font.color = knockout_color
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 28, y, 300, 32, item.name)
self.contents.draw_text(x + 308, y, 62, 32, item.atk.to_s)
self.contents.draw_text(x + 406, y, 24, 32, "E")
elsif @data[i] == -1
x = 4
y = i * 32
self.contents.font.name = "Monotype Corsiva"
self.contents.font.size = 30
self.contents.font.color = crisis_color
self.contents.draw_text(x+165, y, 150, 32, "Armors")
elsif @data[i] == -11
item = $data_armors[$game_actors[1].armor1_id]
x = 4
y = i * 32
self.contents.font.color = knockout_color
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 28, y, 300, 32, item.name)
self.contents.draw_text(x + 308, y, 62, 32, (item.pdef+item.mdef).to_s)
self.contents.draw_text(x + 406, y, 24, 32, "E")
elsif @data[i] == -12
item = $data_armors[$game_actors[1].armor2_id]
x = 4
y = i * 32
self.contents.font.color = knockout_color
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 28, y, 300, 32, item.name)
self.contents.draw_text(x + 308, y, 62, 32, (item.pdef+item.mdef).to_s)
self.contents.draw_text(x + 406, y, 24, 32, "E")
elsif @data[i] == -13
item = $data_armors[$game_actors[1].armor3_id]
x = 4
y = i * 32
self.contents.font.color = knockout_color
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 28, y, 300, 32, item.name)
self.contents.draw_text(x + 308, y, 62, 32, (item.pdef+item.mdef).to_s)
self.contents.draw_text(x + 406, y, 24, 32, "E")
elsif @data[i] == -14
item = $data_armors[$game_actors[1].armor4_id]
x = 4
y = i * 32
self.contents.font.color = knockout_color
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 28, y, 300, 32, item.name)
self.contents.draw_text(x + 308, y, 62, 32, (item.pdef+item.mdef).to_s)
self.contents.draw_text(x + 406, y, 24, 32, "E")
else
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
draw_item(i)
end
end
end
end
def max_item
return @item_max
end
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
self.contents.font.color = normal_color
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.font.color = normal_color
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 28, y, 300, 32, item.name)
case item
when RPG::Weapon
self.contents.draw_text(x + 308, y, 62, 32, item.atk.to_s)
when RPG::Armor
self.contents.draw_text(x + 308, y, 62, 32, (item.pdef+item.mdef).to_s)
end
self.contents.draw_text(x + 390, y, 16, 32, ":")
self.contents.draw_text(x + 406, y, 24, 32, number.to_s)
end
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
class Window_Life < Window_Base
#--------------------------------------------------------------------------
def initialize(name)
super(0, 0, 128, 128)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@name = name
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
bitmap = RPG::Cache.picture(@name)
self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 96, 96))
end
end
class Window_Bars < Window_Base
#--------------------------------------------------------------------------
def initialize
super(0, 0, 178, 128)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = ""
self.contents.font.size = $fontsize
@actor = $game_actors[1]
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_hp(@actor, 0, 0, self.width-32)
draw_actor_sp(@actor, 0, 32, self.width-32)
draw_actor_exp(@actor, 0, 64, self.width-32)
@old_hp = $game_actors[1].hp
@old_sp = $game_actors[1].sp
end
def update
if @old_hp != $game_actors[1].hp or @old_sp != $game_actors[1].sp
@old_hp = $game_actors[1].hp
@old_sp = $game_actors[1].sp
refresh
end
end
end
class Window_Stats < Window_Base
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 352)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@actor = $game_actors[1]
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_face(@actor, 16, 96)
self.contents.font.name = "Monotype Corsiva"
self.contents.font.size = 26
self.contents.font.color = crisis_color
draw_actor_name(@actor, 32, 130)
self.contents.font.color = normal_color
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
draw_actor_level(@actor,0,164)
if $scene.is_a?(Scene_Wear)
draw_actor_parameter(@actor, 0, 196, 0,80)
draw_actor_parameter(@actor, 0, 228, 1,80)
draw_actor_parameter(@actor, 0, 260, 2,80)
end
end
end
class Window_Skill2 < Window_Selectable
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 128, 480, 352)
@actor = actor
@column_max = 1
refresh
self.index = 0
# 戦闘中の場合はウィンドウを画面中央へ移動し、半透明に
る
end
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
# 項目数が 0 でなければビットマップを作成し、全項目を描画
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
self.contents.font.color
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 28, y, 300, 32, skill.name, 0)
self.contents.draw_text(x + 332, y, 48, 32, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
class Scene_State
def main
@map = Spriteset_Map.new
@status_window = Window_Parameters.new
@status_window.x = 0
@status_window.y = 0
@status_window.z = 0
@status_window.windowskin = RPG::Cache.windowskin("legno")
# Status here
@life = Window_Life.new("life2")
@life.x = 178
@life.y = 352
@life.z = 30
@life.windowskin = RPG::Cache.windowskin("Paper")
#Equipment here
@life2 = Window_Life.new("weapons2")
@life2.x = 178+64
@life2.y = 352
@life2.z = 20
@life2.windowskin = RPG::Cache.windowskin("Paper02")
#Items here
@life3 = Window_Life.new("items")
@life3.x = 178+64+64
@life3.y = 352
@life3.z = 10
@life3.windowskin = RPG::Cache.windowskin("Paper02")
#Skills here
@life4 = Window_Life.new("skill")
@life4.x = 178+64+64+64
@life4.y = 352
@life4.z = 0
@life4.windowskin = RPG::Cache.windowskin("Paper02")
#HP SP XP bars here
@bars = Window_Bars.new
@bars.x = 0
@bars.y = 352
@bars.z = 100
@bars.windowskin = RPG::Cache.windowskin("legno")
#stats here
@stats = Window_Stats.new
@stats.x = 480
@stats.y = 0
@stats.z = 100
@stats.windowskin = RPG::Cache.windowskin("legno")
#vertical bar here
@bar = Sprite.new
@bar.bitmap = RPG::Cache.picture("bar1")
@bar.x = 460
@bar.y = 16
@bar.z = 9999
#moving bar here
@block = Sprite.new
@block.bitmap = RPG::Cache.picture("bar2")
@block.x = 462
@block.y = 24
@block.z = 9999
Graphics.transition
# メインループ
loop do
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
#@gold_window.dispose
@status_window.dispose
@map.dispose
@life.dispose
@life2.dispose
@life3.dispose
@bars.dispose
@stats.dispose
@bar.dispose
@block.dispose
@life4.dispose
end
#--------------------------------------------------------------------------
def update
@block.y = @status_window.index*27 + 24
@status_window.update
@bars.update
update_status
return
end
#--------------------------------------------------------------------------
def update_status
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::X)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Learnt.new
return
end
if Input.trigger?(Input::Y)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Wear.new
return
end
end
#--------------------------------------------------------------------------
end
class Scene_Wear
def main
@map = Spriteset_Map.new
@item_window = Window_Wear.new
@item_window.x = 0
@item_window.y = 0
@item_window.z = 0
@item_window.windowskin = RPG::Cache.windowskin("legno")
@life = Window_Life.new("life2")
@life.x = 178
@life.y = 352
@life.z = 20
@life.windowskin = RPG::Cache.windowskin("Paper02")
@life2 = Window_Life.new("weapons2")
@life2.x = 178+64
@life2.y = 352
@life2.z = 30
@life2.windowskin = RPG::Cache.windowskin("Paper")
@life3 = Window_Life.new("items")
@life3.x = 178+64+64
@life3.y = 352
@life3.z = 20
@life3.windowskin = RPG::Cache.windowskin("Paper02")
#qui le abilità
@life4 = Window_Life.new("skill")
@life4.x = 178+64+64+64
@life4.y = 352
@life4.z = 10
@life4.windowskin = RPG::Cache.windowskin("Paper02")
@bars = Window_Bars.new
@bars.x = 0
@bars.y = 352
@bars.z = 100
@bars.windowskin = RPG::Cache.windowskin("legno")
@stats = Window_Stats.new
@stats.x = 480
@stats.y = 0
@stats.z = 100
@stats.windowskin = RPG::Cache.windowskin("legno")
@bar = Sprite.new
@bar.bitmap = RPG::Cache.picture("bar1")
@bar.x = 460
@bar.y = 16
@bar.z = 9999
@block = Sprite.new
@block.bitmap = RPG::Cache.picture("bar2")
@block.x = 462
@block.y = 24
@block.z = 9999
@block.zoom_y = 305.0/(@item_window.row_max*34)
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
#@gold_window.dispose
@item_window.dispose
@map.dispose
@life.dispose
@life2.dispose
@life3.dispose
@life4.dispose
@bars.dispose
@stats.dispose
@bar.dispose
@block.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
@block.y = @item_window.index*305/@item_window.row_max + 24
@block.zoom_y = 305.0/(@item_window.max_item*34)
@stats.update
#@gold_window.update
@item_window.update
@bars.update
update_item
return
end
#--------------------------------------------------------------------------
def update_item
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムウィンドウで現在選択されているデータを取得
@item = @item_window.item
# 使用アイテムではない場合
if @item.is_a?(Numeric)
if @item == -10
$game_system.se_play($data_system.equip_se)
$game_actors[1].equip(0, 0)
@item_window.refresh
@stats.refresh
end
if @item == -11
$game_system.se_play($data_system.equip_se)
$game_actors[1].equip(1, 0)
@item_window.refresh
@stats.refresh
end
if @item == -12
$game_system.se_play($data_system.equip_se)
$game_actors[1].equip(2, 0)
@item_window.refresh
@stats.refresh
end
if @item == -13
$game_system.se_play($data_system.equip_se)
$game_actors[1].equip(3, 0)
@item_window.refresh
@stats.refresh
end
if @item == -14
$game_system.se_play($data_system.equip_se)
$game_actors[1].equip(4, 0)
@item_window.refresh
@stats.refresh
end
return
end
case @item
when RPG::Weapon
type = -1
when RPG::Armor
type = @item.kind# +1
end
$game_system.se_play($data_system.equip_se)
$game_actors[1].equip(type+1, @item == nil ? 0 : @item.id)
@item_window.refresh
@stats.refresh
return
end
if Input.trigger?(Input::X)
$game_system.se_play($data_system.decision_se)
$scene = Scene_State.new
return
end
if Input.trigger?(Input::Y)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Items.new
return
end
end
#--------------------------------------------------------------------------
end
class Scene_Items
def main
@map = Spriteset_Map.new
@item_window = Window_Instruments.new
@item_window.x = 0
@item_window.y = 0
@item_window.z = 0
@item_window.windowskin = RPG::Cache.windowskin("legno")
@life = Window_Life.new("life2")
@life.x = 178
@life.y = 352
@life.z = 10
@life.windowskin = RPG::Cache.windowskin("Paper02")
@life2 = Window_Life.new("weapons2")
@life2.x = 178+64
@life2.y = 352
@life2.z = 20
@life2.windowskin = RPG::Cache.windowskin("Paper02")
@life3 = Window_Life.new("items")
@life3.x = 178+64+64
@life3.y = 352
@life3.z = 30
@life3.windowskin = RPG::Cache.windowskin("Paper")
#qui le abilità
@life4 = Window_Life.new("skill")
@life4.x = 178+64+64+64
@life4.y = 352
@life4.z = 20
@life4.windowskin = RPG::Cache.windowskin("Paper02")
@bars = Window_Bars.new
@bars.x = 0
@bars.y = 352
@bars.z = 100
@bars.windowskin = RPG::Cache.windowskin("legno")
@stats = Window_Stats.new
@stats.x = 480
@stats.y = 0
@stats.z = 100
@stats.windowskin = RPG::Cache.windowskin("legno")
@bar = Sprite.new
@bar.bitmap = RPG::Cache.picture("bar1")
@bar.x = 460
@bar.y = 16
@bar.z = 9999
@block = Sprite.new
@block.bitmap = RPG::Cache.picture("bar2")
@block.x = 462
@block.y = 24
@block.z = 9999
@block.zoom_y = 305.0/(@item_window.row_max*34)
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
#@gold_window.dispose
@item_window.dispose
@map.dispose
@life.dispose
@life2.dispose
@life3.dispose
@life4.dispose
@bars.dispose
@stats.dispose
@bar.dispose
@block.dispose
end
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
if @item_window.max_item < 3
@block.zoom_y = 8.9#(305+32)/34
else
@block.y = (@item_window.index-@item_window.index%2)/2*305/@item_window.row_max + 24
@block.zoom_y = 305.0/(@item_window.row_max*34)
end
#@gold_window.update
@item_window.update
@bars.update
update_item
return
end
#--------------------------------------------------------------------------
def update_item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
@item = @item_window.item
unless @item.is_a?(RPG::Item)
$game_system.se_play($data_system.buzzer_se)
return
end
unless $game_party.item_can_use?(@item.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @item.scope >= 3
target = $game_party.actors[0]
used = target.item_effect(@item)
if used
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@item_window.draw_item(@item_window.index)
end
@item_window.refresh
@bars.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
else
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@item_window.draw_item(@item_window.index)
end
$scene = Scene_Map.new
return
end
end
return
end
if Input.trigger?(Input::Y)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Learnt.new
return
end
if Input.trigger?(Input::X)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Wear.new
return
end
end
#--------------------------------------------------------------------------
end
class Scene_Learnt
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
def main
@actor = $game_party.actors[@actor_index]
@map = Spriteset_Map.new
@skill_window = Window_Skill2.new(@actor)
@skill_window.x = 0
@skill_window.y = 0
@skill_window.z = 0
@skill_window.windowskin = RPG::Cache.windowskin("legno")
@life = Window_Life.new("life2")
@life.x = 178
@life.y = 352
@life.z = 0
@life.windowskin = RPG::Cache.windowskin("Paper02")
@life2 = Window_Life.new("weapons2")
@life2.x = 178+64
@life2.y = 352
@life2.z = 10
@life2.windowskin = RPG::Cache.windowskin("Paper02")
@life3 = Window_Life.new("items")
@life3.x = 178+64+64
@life3.y = 352
@life3.z = 20
@life3.windowskin = RPG::Cache.windowskin("Paper02")
@life4 = Window_Life.new("skill")
@life4.x = 178+64+64+64
@life4.y = 352
@life4.z = 30
@life4.windowskin = RPG::Cache.windowskin("Paper")
@bars = Window_Bars.new
@bars.x = 0
@bars.y = 352
@bars.z = 100
@bars.windowskin = RPG::Cache.windowskin("legno")
@stats = Window_Stats.new
@stats.x = 480
@stats.y = 0
@stats.z = 100
@stats.windowskin = RPG::Cache.windowskin("legno")
@bar = Sprite.new
@bar.bitmap = RPG::Cache.picture("bar1")
@bar.x = 460
@bar.y = 16
@bar.z = 9999
@block = Sprite.new
@block.bitmap = RPG::Cache.picture("bar2")
@block.x = 462
@block.y = 24
@block.z = 9999
@block.zoom_y = 305.0/(@skill_window.row_max*34)
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
#@gold_window.dispose
@skill_window.dispose
@map.dispose
@life.dispose
@life2.dispose
@life3.dispose
@life4.dispose
@bars.dispose
@stats.dispose
@bar.dispose
@block.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
if @skill_window.row_max <1
@block.zoom_y = 8.9#(305+32)/34
else
@block.y = @skill_window.index*305/@skill_window.row_max + 24
@block.zoom_y = 305.0/(@skill_window.row_max*34)
end
@skill_window.update
@bars.update
update_skill
return
end
#--------------------------------------------------------------------------
def update_skill
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill == nil or not @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
used = @actor.skill_effect(@actor, @skill)
if used
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@bars.refresh
@skill_window.refresh
@stats.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
return
end
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
if Input.trigger?(Input::Y)
$game_system.se_play($data_system.decision_se)
$scene = Scene_State.new
return
end
if Input.trigger?(Input::X)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Items.new
return
end
end
#--------------------------------------------------------------------------
end
class Scene_Map
alias main_oblivion_menu main
def main
@bars = Window_Bars.new
@bars.y = 352
@bars.opacity=0
@bars.z = 9999
unless BAR_ON_MAPS
@bars.visible = false
end
main_oblivion_menu
@bars.dispose
end
alias update_oblivion_menu update
def update
update_oblivion_menu
@bars.update
end
def call_menu
$game_temp.menu_calling = false
if $game_temp.menu_beep
$game_system.se_play($data_system.decision_se)
$game_temp.menu_beep = false
end
$game_player.straighten
$scene = Scene_State.new
end
end
#THE CODE OF MINE ENDS HERE. WHAT FOLLOWS IS CREDITED TO OTHER PEOPLE
# HP/SP/EXPゲージ表示スクリプト Ver 1.00
# 配布元・サポートURL
# http://members.jcom.home.ne.jp/cogwheel/
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
# の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
#==============================================================================
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# ゲーム中のすべてのウィンドウのスーパークラスです。
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● HP ゲージの描画
#--------------------------------------------------------------------------
# オリジナルのHP描画を draw_actor_hp_hpsp と名前変更
alias :draw_actor_hp_hpsp :draw_actor_hp
def draw_actor_hp(actor, x, y, width = 144)
# 変数rateに 現在のHP/MHPを代入
if actor.maxhp != 0
rate = actor.hp.to_f / actor.maxhp
else
rate = 0
end
# plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
# plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
# align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
# align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
# align3:ゲージタイプ 0:左詰め 1:右詰め
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# グラデーション設定 grade1:空ゲージ grade2:実ゲージ
# (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
grade1 = 1
grade2 = 0
# 色設定。color1:外枠,color2:中枠
# color3:空ゲージダークカラー,color4:空ゲージライトカラー
# color5:実ゲージダークカラー,color6:実ゲージライトカラー
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
# 変数spに描画するゲージの幅を代入
if actor.maxhp != 0
hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
else
hp = 0
end
# ゲージの描画
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, hp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# オリジナルのHP描画処理を呼び出し
draw_actor_hp_hpsp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# ● SP ゲージの描画
#--------------------------------------------------------------------------
# オリジナルのSP描画を draw_actor_sp_hpsp と名前変更
alias :draw_actor_sp_hpsp :draw_actor_sp
def draw_actor_sp(actor, x, y, width = 144)
# 変数rateに 現在のSP/MSPを代入
if actor.maxsp != 0
rate = actor.sp.to_f / actor.maxsp
else
rate = 1
end
# plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
# plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
# align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
# align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
# align3:ゲージタイプ 0:左詰め 1:右詰め
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# グラデーション設定 grade1:空ゲージ grade2:実ゲージ
# (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
grade1 = 1
grade2 = 0
# 色設定。color1:外枠,color2:中枠
# color3:空ゲージダークカラー,color4:空ゲージライトカラー
# color5:実ゲージダークカラー,color6:実ゲージライトカラー
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(0, 64, 0, 192)
color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
# 変数spに描画するゲージの幅を代入
if actor.maxsp != 0
sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
else
sp = (width + plus_width) * rate_width / 100
end
# ゲージの描画
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, sp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# オリジナルのSP描画処理を呼び出し
draw_actor_sp_hpsp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# ● EXP ゲージの描画
#--------------------------------------------------------------------------
# オリジナルのEXP描画を draw_actor_sp_hpsp と名前変更
alias :draw_actor_exp_hpsp :draw_actor_exp
def draw_actor_exp(actor, x, y, width=144)
# 変数rateに 現在のexp/nextexpを代入
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
# plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
# plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
# align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
# align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
# align3:ゲージタイプ 0:左詰め 1:右詰め
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# グラデーション設定 grade1:空ゲージ grade2:実ゲージ
# (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
grade1 = 1
grade2 = 0
# 色設定。color1:外枠,color2:中枠
# color3:空ゲージダークカラー,color4:空ゲージライトカラー
# color5:実ゲージダークカラー,color6:実ゲージライトカラー
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
# 変数expに描画するゲージの幅を代入
if actor.next_exp != 0
exp = (width + plus_width) * actor.now_exp * rate_width /
100 / actor.next_exp
else
exp = (width + plus_width) * rate_width / 100
end
# ゲージの描画
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, exp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# オリジナルのEXP描画処理を呼び出し
draw_actor_exp_hpsp(actor, x, y)
end
#--------------------------------------------------------------------------
# ● ゲージの描画
#--------------------------------------------------------------------------
def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
case align1
when 1
x += (rect_width - width) / 2
when 2
x += rect_width - width
end
case align2
when 1
y -= height / 2
when 2
y -= height
end
# 枠描画
self.contents.fill_rect(x, y, width, height, color1)
self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
if align3 == 0
if grade1 == 2
grade1 = 3
end
if grade2 == 2
grade2 = 3
end
end
if (align3 == 1 and grade1 == 0) or grade1 > 0
color = color3
color3 = color4
color4 = color
end
if (align3 == 1 and grade2 == 0) or grade2 > 0
color = color5
color5 = color6
color6 = color
end
# 空ゲージの描画
self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
color3, color4, grade1)
if align3 == 1
x += width - gauge
end
# 実ゲージの描画
self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
color5, color6, grade2)
end
end
#------------------------------------------------------------------------------
# Bitmapクラスに新たな機能を追加します。
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# ● 矩形をグラデーション表示
# color1 : スタートカラー
# color2 : エンドカラー
# align : 0:横にグラデーション
# 1:縦にグラデーション
# 2:斜めにグラデーション(激重につき注意)
#--------------------------------------------------------------------------
def gradation_rect(x, y, width, height, color1, color2, align = 0)
if align == 0
for i in x...x + width
red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
green = color1.green +
(color2.green - color1.green) * (i - x) / (width - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - x) / (width - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color1.red +
(color2.red - color1.red) * (i - y) / (height - 1)
green = color1.green +
(color2.green - color1.green) * (i - y) / (height - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - y) / (height - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
end
#By Feoden
#V 1.0
#Feel free to use it, just do not claim as your own
#--------------------------------------------------------------------------
#change this to allow bar on the map.
BAR_ON_MAPS = true
class Window_Base
#---------------------------------------------------------------------
def draw_actor_face(actor, x, y)
#If you wish to change the picture name, modify here
face = RPG::Cache.picture("Hero")
fw = face.width
fh = face.height
src_rect = Rect.new(0, 0, fw, fh)
self.contents.blt(x - fw / 23, y - fh, face, src_rect)
end
#---------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type, l=120)
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
when 7
parameter_name = "Evasion"
parameter_value = actor.eva
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, l, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + l, y, 36, 32, parameter_value.to_s, 2)
end
#---------------------------------------------------------------------
end
class Window_Instruments < Window_Selectable
#--------------------------------------------------------------------------
def initialize
super(0, 64, 480, 352)
@column_max = 2
refresh
self.index = 0
end
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
def max_item
return @item_max
end
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
number = $game_party.item_number(item.id)
if $game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (240)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 124, 32, item.name, 0)
self.contents.draw_text(x + 152, y, 16, 32, ":", 1)
self.contents.draw_text(x + 168, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
class Window_Parameters < Window_Selectable
#--------------------------------------------------------------------------
def initialize
super(0, 0, 480, 352)
self.contents = Bitmap.new(width - 32, 1300)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
self.index = 0
end
#--------------------------------------------------------------------------
def refresh
@item_max = 11
self.contents.clear
for i in 0...8
x = 64
y = i * 107 + 38
actor = $game_party.actors[0]
text = ["Weapons attack allows","to inflict damage.",
"Physical Defence reduces","damage from weapons.",
"Magical Defence reduces", "damage received from magic.",
"Strength multiplies", "the physical damage.",
"Dexterity is your skill.", "Improves Aim and Luck.",
"Speed improves your", "athletical skills.",
"Magic allows you to", "cast more powerful spells.",
"Evasion allows you", "to avoid enemy attacks."]
self.contents.font.color = system_color
self.contents.font.size = 18
self.contents.font.name = $fontface
self.contents.draw_text(x+180,y-16, 200, 32, text[i*2])
self.contents.draw_text(x+180,y+16, 200, 32, text[i*2+1])
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
draw_actor_parameter(actor, x, y, i)
bitmap = RPG::Cache.picture("rect")
self.contents.blt(x-10, y-8, bitmap, Rect.new(0, 0, 180, 48))
end
draw_actor_hp(actor, 64, 894+0*107, 160)
draw_actor_sp(actor, 64, 894+1*107, 160)
draw_actor_exp(actor, 64, 894+2*107, 160)
text2=["If your HP reaches 0","you lose the game.",
"MP allows to cast","any spell you know.",
"Your experience lets you","improve your fighting skills"]
for i in 0...3
bitmap = RPG::Cache.picture("rect")
self.contents.blt(x-10, 894-8+i*107, bitmap, Rect.new(0, 0, 180, 48))
self.contents.font.color = system_color
self.contents.font.size = 18
self.contents.font.name = $fontface
self.contents.draw_text(x+180,894-16+i*107, 200, 32, text2[i*2])
self.contents.draw_text(x+180,894+16+i*107, 200, 32, text2[i*2+1])
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
end
end
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 107- self.oy, self.width - 32, 106)
end
row = @index
if row < self.top_row
self.top_row = row
end
if row > self.top_row + 2#(self.page_row_max - 1)
self.top_row = row - 2#(self.page_row_max - 1)
end
end
def top_row
return self.oy / 107
end
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 107
end
#--------------------------------------------------------------------------
def page_row_max
return (self.height-32) / 107
end
end
class Window_Wear < Window_Selectable
#--------------------------------------------------------------------------
def initialize
super(0, 64, 480, 352)
@column_max = 1
refresh
self.index = 0
end
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# アイテムを追加
@data.push(0)
unless $game_actors[1].weapon_id == 0
@data.push(-10)
end
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
@data.push(-1)
unless $game_actors[1].armor1_id == 0
@data.push(-11)
end
unless $game_actors[1].armor2_id == 0
@data.push(-12)
end
unless $game_actors[1].armor3_id == 0
@data.push(-13)
end
unless $game_actors[1].armor4_id == 0
@data.push(-14)
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
# 項目数が 0 でなければビットマップを作成し、全項目を描画
@item_max = @data.size
if @item_max > 2
self.contents = Bitmap.new(width - 32, @item_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
if @data[i] == 0
x = 4
y = i * 32
self.contents.font.name = "Monotype Corsiva"
self.contents.font.size = 30
self.contents.font.color = crisis_color
self.contents.draw_text(x+165, y, 150, 32, "Weapons")
elsif @data[i] == -10
item = $data_weapons[$game_actors[1].weapon_id]
x = 4
y = i * 32
self.contents.font.color = knockout_color
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 28, y, 300, 32, item.name)
self.contents.draw_text(x + 308, y, 62, 32, item.atk.to_s)
self.contents.draw_text(x + 406, y, 24, 32, "E")
elsif @data[i] == -1
x = 4
y = i * 32
self.contents.font.name = "Monotype Corsiva"
self.contents.font.size = 30
self.contents.font.color = crisis_color
self.contents.draw_text(x+165, y, 150, 32, "Armors")
elsif @data[i] == -11
item = $data_armors[$game_actors[1].armor1_id]
x = 4
y = i * 32
self.contents.font.color = knockout_color
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 28, y, 300, 32, item.name)
self.contents.draw_text(x + 308, y, 62, 32, (item.pdef+item.mdef).to_s)
self.contents.draw_text(x + 406, y, 24, 32, "E")
elsif @data[i] == -12
item = $data_armors[$game_actors[1].armor2_id]
x = 4
y = i * 32
self.contents.font.color = knockout_color
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 28, y, 300, 32, item.name)
self.contents.draw_text(x + 308, y, 62, 32, (item.pdef+item.mdef).to_s)
self.contents.draw_text(x + 406, y, 24, 32, "E")
elsif @data[i] == -13
item = $data_armors[$game_actors[1].armor3_id]
x = 4
y = i * 32
self.contents.font.color = knockout_color
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 28, y, 300, 32, item.name)
self.contents.draw_text(x + 308, y, 62, 32, (item.pdef+item.mdef).to_s)
self.contents.draw_text(x + 406, y, 24, 32, "E")
elsif @data[i] == -14
item = $data_armors[$game_actors[1].armor4_id]
x = 4
y = i * 32
self.contents.font.color = knockout_color
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 28, y, 300, 32, item.name)
self.contents.draw_text(x + 308, y, 62, 32, (item.pdef+item.mdef).to_s)
self.contents.draw_text(x + 406, y, 24, 32, "E")
else
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
draw_item(i)
end
end
end
end
def max_item
return @item_max
end
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
self.contents.font.color = normal_color
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.font.color = normal_color
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 28, y, 300, 32, item.name)
case item
when RPG::Weapon
self.contents.draw_text(x + 308, y, 62, 32, item.atk.to_s)
when RPG::Armor
self.contents.draw_text(x + 308, y, 62, 32, (item.pdef+item.mdef).to_s)
end
self.contents.draw_text(x + 390, y, 16, 32, ":")
self.contents.draw_text(x + 406, y, 24, 32, number.to_s)
end
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
class Window_Life < Window_Base
#--------------------------------------------------------------------------
def initialize(name)
super(0, 0, 128, 128)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@name = name
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
bitmap = RPG::Cache.picture(@name)
self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 96, 96))
end
end
class Window_Bars < Window_Base
#--------------------------------------------------------------------------
def initialize
super(0, 0, 178, 128)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = ""
self.contents.font.size = $fontsize
@actor = $game_actors[1]
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_hp(@actor, 0, 0, self.width-32)
draw_actor_sp(@actor, 0, 32, self.width-32)
draw_actor_exp(@actor, 0, 64, self.width-32)
@old_hp = $game_actors[1].hp
@old_sp = $game_actors[1].sp
end
def update
if @old_hp != $game_actors[1].hp or @old_sp != $game_actors[1].sp
@old_hp = $game_actors[1].hp
@old_sp = $game_actors[1].sp
refresh
end
end
end
class Window_Stats < Window_Base
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 352)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@actor = $game_actors[1]
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_face(@actor, 16, 96)
self.contents.font.name = "Monotype Corsiva"
self.contents.font.size = 26
self.contents.font.color = crisis_color
draw_actor_name(@actor, 32, 130)
self.contents.font.color = normal_color
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
draw_actor_level(@actor,0,164)
if $scene.is_a?(Scene_Wear)
draw_actor_parameter(@actor, 0, 196, 0,80)
draw_actor_parameter(@actor, 0, 228, 1,80)
draw_actor_parameter(@actor, 0, 260, 2,80)
end
end
end
class Window_Skill2 < Window_Selectable
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 128, 480, 352)
@actor = actor
@column_max = 1
refresh
self.index = 0
# 戦闘中の場合はウィンドウを画面中央へ移動し、半透明に
る
end
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
# 項目数が 0 でなければビットマップを作成し、全項目を描画
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
self.contents.font.color
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 28, y, 300, 32, skill.name, 0)
self.contents.draw_text(x + 332, y, 48, 32, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
class Scene_State
def main
@map = Spriteset_Map.new
@status_window = Window_Parameters.new
@status_window.x = 0
@status_window.y = 0
@status_window.z = 0
@status_window.windowskin = RPG::Cache.windowskin("legno")
# Status here
@life = Window_Life.new("life2")
@life.x = 178
@life.y = 352
@life.z = 30
@life.windowskin = RPG::Cache.windowskin("Paper")
#Equipment here
@life2 = Window_Life.new("weapons2")
@life2.x = 178+64
@life2.y = 352
@life2.z = 20
@life2.windowskin = RPG::Cache.windowskin("Paper02")
#Items here
@life3 = Window_Life.new("items")
@life3.x = 178+64+64
@life3.y = 352
@life3.z = 10
@life3.windowskin = RPG::Cache.windowskin("Paper02")
#Skills here
@life4 = Window_Life.new("skill")
@life4.x = 178+64+64+64
@life4.y = 352
@life4.z = 0
@life4.windowskin = RPG::Cache.windowskin("Paper02")
#HP SP XP bars here
@bars = Window_Bars.new
@bars.x = 0
@bars.y = 352
@bars.z = 100
@bars.windowskin = RPG::Cache.windowskin("legno")
#stats here
@stats = Window_Stats.new
@stats.x = 480
@stats.y = 0
@stats.z = 100
@stats.windowskin = RPG::Cache.windowskin("legno")
#vertical bar here
@bar = Sprite.new
@bar.bitmap = RPG::Cache.picture("bar1")
@bar.x = 460
@bar.y = 16
@bar.z = 9999
#moving bar here
@block = Sprite.new
@block.bitmap = RPG::Cache.picture("bar2")
@block.x = 462
@block.y = 24
@block.z = 9999
Graphics.transition
# メインループ
loop do
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
#@gold_window.dispose
@status_window.dispose
@map.dispose
@life.dispose
@life2.dispose
@life3.dispose
@bars.dispose
@stats.dispose
@bar.dispose
@block.dispose
@life4.dispose
end
#--------------------------------------------------------------------------
def update
@block.y = @status_window.index*27 + 24
@status_window.update
@bars.update
update_status
return
end
#--------------------------------------------------------------------------
def update_status
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::X)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Learnt.new
return
end
if Input.trigger?(Input::Y)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Wear.new
return
end
end
#--------------------------------------------------------------------------
end
class Scene_Wear
def main
@map = Spriteset_Map.new
@item_window = Window_Wear.new
@item_window.x = 0
@item_window.y = 0
@item_window.z = 0
@item_window.windowskin = RPG::Cache.windowskin("legno")
@life = Window_Life.new("life2")
@life.x = 178
@life.y = 352
@life.z = 20
@life.windowskin = RPG::Cache.windowskin("Paper02")
@life2 = Window_Life.new("weapons2")
@life2.x = 178+64
@life2.y = 352
@life2.z = 30
@life2.windowskin = RPG::Cache.windowskin("Paper")
@life3 = Window_Life.new("items")
@life3.x = 178+64+64
@life3.y = 352
@life3.z = 20
@life3.windowskin = RPG::Cache.windowskin("Paper02")
#qui le abilità
@life4 = Window_Life.new("skill")
@life4.x = 178+64+64+64
@life4.y = 352
@life4.z = 10
@life4.windowskin = RPG::Cache.windowskin("Paper02")
@bars = Window_Bars.new
@bars.x = 0
@bars.y = 352
@bars.z = 100
@bars.windowskin = RPG::Cache.windowskin("legno")
@stats = Window_Stats.new
@stats.x = 480
@stats.y = 0
@stats.z = 100
@stats.windowskin = RPG::Cache.windowskin("legno")
@bar = Sprite.new
@bar.bitmap = RPG::Cache.picture("bar1")
@bar.x = 460
@bar.y = 16
@bar.z = 9999
@block = Sprite.new
@block.bitmap = RPG::Cache.picture("bar2")
@block.x = 462
@block.y = 24
@block.z = 9999
@block.zoom_y = 305.0/(@item_window.row_max*34)
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
#@gold_window.dispose
@item_window.dispose
@map.dispose
@life.dispose
@life2.dispose
@life3.dispose
@life4.dispose
@bars.dispose
@stats.dispose
@bar.dispose
@block.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
@block.y = @item_window.index*305/@item_window.row_max + 24
@block.zoom_y = 305.0/(@item_window.max_item*34)
@stats.update
#@gold_window.update
@item_window.update
@bars.update
update_item
return
end
#--------------------------------------------------------------------------
def update_item
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムウィンドウで現在選択されているデータを取得
@item = @item_window.item
# 使用アイテムではない場合
if @item.is_a?(Numeric)
if @item == -10
$game_system.se_play($data_system.equip_se)
$game_actors[1].equip(0, 0)
@item_window.refresh
@stats.refresh
end
if @item == -11
$game_system.se_play($data_system.equip_se)
$game_actors[1].equip(1, 0)
@item_window.refresh
@stats.refresh
end
if @item == -12
$game_system.se_play($data_system.equip_se)
$game_actors[1].equip(2, 0)
@item_window.refresh
@stats.refresh
end
if @item == -13
$game_system.se_play($data_system.equip_se)
$game_actors[1].equip(3, 0)
@item_window.refresh
@stats.refresh
end
if @item == -14
$game_system.se_play($data_system.equip_se)
$game_actors[1].equip(4, 0)
@item_window.refresh
@stats.refresh
end
return
end
case @item
when RPG::Weapon
type = -1
when RPG::Armor
type = @item.kind# +1
end
$game_system.se_play($data_system.equip_se)
$game_actors[1].equip(type+1, @item == nil ? 0 : @item.id)
@item_window.refresh
@stats.refresh
return
end
if Input.trigger?(Input::X)
$game_system.se_play($data_system.decision_se)
$scene = Scene_State.new
return
end
if Input.trigger?(Input::Y)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Items.new
return
end
end
#--------------------------------------------------------------------------
end
class Scene_Items
def main
@map = Spriteset_Map.new
@item_window = Window_Instruments.new
@item_window.x = 0
@item_window.y = 0
@item_window.z = 0
@item_window.windowskin = RPG::Cache.windowskin("legno")
@life = Window_Life.new("life2")
@life.x = 178
@life.y = 352
@life.z = 10
@life.windowskin = RPG::Cache.windowskin("Paper02")
@life2 = Window_Life.new("weapons2")
@life2.x = 178+64
@life2.y = 352
@life2.z = 20
@life2.windowskin = RPG::Cache.windowskin("Paper02")
@life3 = Window_Life.new("items")
@life3.x = 178+64+64
@life3.y = 352
@life3.z = 30
@life3.windowskin = RPG::Cache.windowskin("Paper")
#qui le abilità
@life4 = Window_Life.new("skill")
@life4.x = 178+64+64+64
@life4.y = 352
@life4.z = 20
@life4.windowskin = RPG::Cache.windowskin("Paper02")
@bars = Window_Bars.new
@bars.x = 0
@bars.y = 352
@bars.z = 100
@bars.windowskin = RPG::Cache.windowskin("legno")
@stats = Window_Stats.new
@stats.x = 480
@stats.y = 0
@stats.z = 100
@stats.windowskin = RPG::Cache.windowskin("legno")
@bar = Sprite.new
@bar.bitmap = RPG::Cache.picture("bar1")
@bar.x = 460
@bar.y = 16
@bar.z = 9999
@block = Sprite.new
@block.bitmap = RPG::Cache.picture("bar2")
@block.x = 462
@block.y = 24
@block.z = 9999
@block.zoom_y = 305.0/(@item_window.row_max*34)
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
#@gold_window.dispose
@item_window.dispose
@map.dispose
@life.dispose
@life2.dispose
@life3.dispose
@life4.dispose
@bars.dispose
@stats.dispose
@bar.dispose
@block.dispose
end
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
if @item_window.max_item < 3
@block.zoom_y = 8.9#(305+32)/34
else
@block.y = (@item_window.index-@item_window.index%2)/2*305/@item_window.row_max + 24
@block.zoom_y = 305.0/(@item_window.row_max*34)
end
#@gold_window.update
@item_window.update
@bars.update
update_item
return
end
#--------------------------------------------------------------------------
def update_item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
@item = @item_window.item
unless @item.is_a?(RPG::Item)
$game_system.se_play($data_system.buzzer_se)
return
end
unless $game_party.item_can_use?(@item.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @item.scope >= 3
target = $game_party.actors[0]
used = target.item_effect(@item)
if used
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@item_window.draw_item(@item_window.index)
end
@item_window.refresh
@bars.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
else
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@item_window.draw_item(@item_window.index)
end
$scene = Scene_Map.new
return
end
end
return
end
if Input.trigger?(Input::Y)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Learnt.new
return
end
if Input.trigger?(Input::X)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Wear.new
return
end
end
#--------------------------------------------------------------------------
end
class Scene_Learnt
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
def main
@actor = $game_party.actors[@actor_index]
@map = Spriteset_Map.new
@skill_window = Window_Skill2.new(@actor)
@skill_window.x = 0
@skill_window.y = 0
@skill_window.z = 0
@skill_window.windowskin = RPG::Cache.windowskin("legno")
@life = Window_Life.new("life2")
@life.x = 178
@life.y = 352
@life.z = 0
@life.windowskin = RPG::Cache.windowskin("Paper02")
@life2 = Window_Life.new("weapons2")
@life2.x = 178+64
@life2.y = 352
@life2.z = 10
@life2.windowskin = RPG::Cache.windowskin("Paper02")
@life3 = Window_Life.new("items")
@life3.x = 178+64+64
@life3.y = 352
@life3.z = 20
@life3.windowskin = RPG::Cache.windowskin("Paper02")
@life4 = Window_Life.new("skill")
@life4.x = 178+64+64+64
@life4.y = 352
@life4.z = 30
@life4.windowskin = RPG::Cache.windowskin("Paper")
@bars = Window_Bars.new
@bars.x = 0
@bars.y = 352
@bars.z = 100
@bars.windowskin = RPG::Cache.windowskin("legno")
@stats = Window_Stats.new
@stats.x = 480
@stats.y = 0
@stats.z = 100
@stats.windowskin = RPG::Cache.windowskin("legno")
@bar = Sprite.new
@bar.bitmap = RPG::Cache.picture("bar1")
@bar.x = 460
@bar.y = 16
@bar.z = 9999
@block = Sprite.new
@block.bitmap = RPG::Cache.picture("bar2")
@block.x = 462
@block.y = 24
@block.z = 9999
@block.zoom_y = 305.0/(@skill_window.row_max*34)
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
#@gold_window.dispose
@skill_window.dispose
@map.dispose
@life.dispose
@life2.dispose
@life3.dispose
@life4.dispose
@bars.dispose
@stats.dispose
@bar.dispose
@block.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
if @skill_window.row_max <1
@block.zoom_y = 8.9#(305+32)/34
else
@block.y = @skill_window.index*305/@skill_window.row_max + 24
@block.zoom_y = 305.0/(@skill_window.row_max*34)
end
@skill_window.update
@bars.update
update_skill
return
end
#--------------------------------------------------------------------------
def update_skill
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill == nil or not @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
used = @actor.skill_effect(@actor, @skill)
if used
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@bars.refresh
@skill_window.refresh
@stats.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
return
end
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
if Input.trigger?(Input::Y)
$game_system.se_play($data_system.decision_se)
$scene = Scene_State.new
return
end
if Input.trigger?(Input::X)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Items.new
return
end
end
#--------------------------------------------------------------------------
end
class Scene_Map
alias main_oblivion_menu main
def main
@bars = Window_Bars.new
@bars.y = 352
@bars.opacity=0
@bars.z = 9999
unless BAR_ON_MAPS
@bars.visible = false
end
main_oblivion_menu
@bars.dispose
end
alias update_oblivion_menu update
def update
update_oblivion_menu
@bars.update
end
def call_menu
$game_temp.menu_calling = false
if $game_temp.menu_beep
$game_system.se_play($data_system.decision_se)
$game_temp.menu_beep = false
end
$game_player.straighten
$scene = Scene_State.new
end
end
#THE CODE OF MINE ENDS HERE. WHAT FOLLOWS IS CREDITED TO OTHER PEOPLE
# HP/SP/EXPゲージ表示スクリプト Ver 1.00
# 配布元・サポートURL
# http://members.jcom.home.ne.jp/cogwheel/
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
# の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
#==============================================================================
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# ゲーム中のすべてのウィンドウのスーパークラスです。
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● HP ゲージの描画
#--------------------------------------------------------------------------
# オリジナルのHP描画を draw_actor_hp_hpsp と名前変更
alias :draw_actor_hp_hpsp :draw_actor_hp
def draw_actor_hp(actor, x, y, width = 144)
# 変数rateに 現在のHP/MHPを代入
if actor.maxhp != 0
rate = actor.hp.to_f / actor.maxhp
else
rate = 0
end
# plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
# plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
# align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
# align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
# align3:ゲージタイプ 0:左詰め 1:右詰め
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# グラデーション設定 grade1:空ゲージ grade2:実ゲージ
# (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
grade1 = 1
grade2 = 0
# 色設定。color1:外枠,color2:中枠
# color3:空ゲージダークカラー,color4:空ゲージライトカラー
# color5:実ゲージダークカラー,color6:実ゲージライトカラー
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
# 変数spに描画するゲージの幅を代入
if actor.maxhp != 0
hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
else
hp = 0
end
# ゲージの描画
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, hp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# オリジナルのHP描画処理を呼び出し
draw_actor_hp_hpsp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# ● SP ゲージの描画
#--------------------------------------------------------------------------
# オリジナルのSP描画を draw_actor_sp_hpsp と名前変更
alias :draw_actor_sp_hpsp :draw_actor_sp
def draw_actor_sp(actor, x, y, width = 144)
# 変数rateに 現在のSP/MSPを代入
if actor.maxsp != 0
rate = actor.sp.to_f / actor.maxsp
else
rate = 1
end
# plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
# plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
# align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
# align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
# align3:ゲージタイプ 0:左詰め 1:右詰め
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# グラデーション設定 grade1:空ゲージ grade2:実ゲージ
# (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
grade1 = 1
grade2 = 0
# 色設定。color1:外枠,color2:中枠
# color3:空ゲージダークカラー,color4:空ゲージライトカラー
# color5:実ゲージダークカラー,color6:実ゲージライトカラー
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(0, 64, 0, 192)
color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
# 変数spに描画するゲージの幅を代入
if actor.maxsp != 0
sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
else
sp = (width + plus_width) * rate_width / 100
end
# ゲージの描画
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, sp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# オリジナルのSP描画処理を呼び出し
draw_actor_sp_hpsp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# ● EXP ゲージの描画
#--------------------------------------------------------------------------
# オリジナルのEXP描画を draw_actor_sp_hpsp と名前変更
alias :draw_actor_exp_hpsp :draw_actor_exp
def draw_actor_exp(actor, x, y, width=144)
# 変数rateに 現在のexp/nextexpを代入
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
# plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
# plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
# align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
# align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
# align3:ゲージタイプ 0:左詰め 1:右詰め
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
# グラデーション設定 grade1:空ゲージ grade2:実ゲージ
# (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
grade1 = 1
grade2 = 0
# 色設定。color1:外枠,color2:中枠
# color3:空ゲージダークカラー,color4:空ゲージライトカラー
# color5:実ゲージダークカラー,color6:実ゲージライトカラー
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
# 変数expに描画するゲージの幅を代入
if actor.next_exp != 0
exp = (width + plus_width) * actor.now_exp * rate_width /
100 / actor.next_exp
else
exp = (width + plus_width) * rate_width / 100
end
# ゲージの描画
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, exp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# オリジナルのEXP描画処理を呼び出し
draw_actor_exp_hpsp(actor, x, y)
end
#--------------------------------------------------------------------------
# ● ゲージの描画
#--------------------------------------------------------------------------
def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
case align1
when 1
x += (rect_width - width) / 2
when 2
x += rect_width - width
end
case align2
when 1
y -= height / 2
when 2
y -= height
end
# 枠描画
self.contents.fill_rect(x, y, width, height, color1)
self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
if align3 == 0
if grade1 == 2
grade1 = 3
end
if grade2 == 2
grade2 = 3
end
end
if (align3 == 1 and grade1 == 0) or grade1 > 0
color = color3
color3 = color4
color4 = color
end
if (align3 == 1 and grade2 == 0) or grade2 > 0
color = color5
color5 = color6
color6 = color
end
# 空ゲージの描画
self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
color3, color4, grade1)
if align3 == 1
x += width - gauge
end
# 実ゲージの描画
self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
color5, color6, grade2)
end
end
#------------------------------------------------------------------------------
# Bitmapクラスに新たな機能を追加します。
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# ● 矩形をグラデーション表示
# color1 : スタートカラー
# color2 : エンドカラー
# align : 0:横にグラデーション
# 1:縦にグラデーション
# 2:斜めにグラデーション(激重につき注意)
#--------------------------------------------------------------------------
def gradation_rect(x, y, width, height, color1, color2, align = 0)
if align == 0
for i in x...x + width
red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
green = color1.green +
(color2.green - color1.green) * (i - x) / (width - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - x) / (width - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color1.red +
(color2.red - color1.red) * (i - y) / (height - 1)
green = color1.green +
(color2.green - color1.green) * (i - y) / (height - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - y) / (height - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
end
Customization
This section is open to advice of yours.
Compatibility
Compatible with any battle system and most other scripts.
Screenshot
Parameter Screen
Equip Screen
Items Screen
Skills Screen
DEMO
You can find the demo link (including all the graphical files required to work)
HERE
Installation
Just copy the code in your project.
Files Required to work (you can find them in the demo)
Pictures:
bar1
bar2
hero (Use the one you wish, requires 96x96)
rect
life2 (Use the one you wish, requires 96x96)
weapons2 (Use the one you wish, requires 96x96)
items (Use the one you wish, requires 96x96)
skill (Use the one you wish, requires 96x96)
Windowskins:
legno
Paper
Paper02
Terms and Conditions
Feel free to use it, just do not claim as your own
Credits
cogwheel for HP/SP/XP bars



