Group: Member
Posts: 66
Type: Scripter
RM Skill: Skilled
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
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
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]
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/
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