Taiine's Solo Player Custom Menu System
Author Taiine
Version 0.6
Updated Nov, 13th, 10
First Release Date Sep 30th, 10
Updates
Corrected a big that caused an error if player saving was disabled.
Fixed EXP Value alignment, it now centers like HP/SP
Window now properly shifts over to center if you select Icons Only.
(Demo is Properly Updated with these fix's)
Known Bugs
None Reported for current version.
Introduction
This Custom Menu System can be used if your game is planed to have no additional party members but the main hero. It displays all of the players Information on the first screen, eliminating the need for the old 'statis' screen.
This however does not prevent you from having a party, and there is an addishenal script command that can allow you to show the info of another party member in game. This does not truly 'switch' players, just what players info is shown. To truly switch between party members, you can use a party switch script along with this to achive that goal.
Features
Removes the 'Status' window and places all information on the main window.
Displays the players portrate.
Ingame Script call to change witch party members info is shown (does not acually switch player)
Option to change the menu to use Text + Icons, or Icons only
Script
[hide]CODE
#==============================================================================
# ** Solo Player Custom Menu System v0.6
# * by Taiine
# * Updated: Nov, 13th, 10
#------------------------------------------------------------------------------
# This Custom Menu System can be used if your game is planed to have no
# additional party members but the main hero. It displays all of the players
# Information on the first screen, eliminating the need for the old 'statis'.
#
# This however does not prevent you from having a party, and there is an
# addishenal script command that can allow you to show the info of another
# party member in game. This does not truly 'switch' players, just what players
# info is shown. To truly switch between party members, you can use a party
# switch script along with this to achive that goal.
#
#------------------------------------------------------------------------------
# Requires the following images to be in the Pictures Folder of your project
#
# Player Portrait: 96x96 File name of the player ID Example: 1.png
# Gold Coin Icon: 24x24 Gold.png
#
# Requires the following images to be in the Icons Folder of your project
#
# Menu Icons: 24x24
#
# Menu0.png (Inventory)
# Menu1.png (Abilities)
# Menu2.png (Equipment)
# Menu3.png (Save Game)
# Menu4.png (Quit Game)
#
#------------------------------------------------------------------------------
# * Credit:
# The Law G14 - Player Portrait, Gold & Menu Icons
# Night_Runner - General Godliness :P
#==============================================================================
#==============================================================================
# * Menu Status bar configuration
#==============================================================================
module Taiine_CMS
Main_player_id = 1
# ID Of the player as it is in the Database
# To change in game use call script and place Taiine_CMS::Main_player_id = ID
# Where ID is the ID of the player as it is in the Database
Menu_style = true
# Sets rather to have the Menu be icons only or Icons and Text
# Icons Only: true
# Icons & Text: false
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# Edited to have the name of the map.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :name
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
alias taiine_soloMenu_setup setup unless $@
def setup(*args)
# Run the normal setup
returnValue = taiine_soloMenu_setup(*args)
# Get the name of the map
@name = load_data("Data/MapInfos.rxdata")[@map_id].name
# Returnt the original raturnValue
return returnValue
end
end
#==============================================================================
# ** Window Base
#------------------------------------------------------------------------------
# Edited to draw the actors face.
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# * Draw EXP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def write_actor_exp(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 24, 32, "EXP")
self.contents.font.color = normal_color
self.contents.draw_text(x + -2, y, 84, 32, actor.exp_s, 2)
self.contents.draw_text(x + 82, y, 12, 32, "/", 1)
self.contents.draw_text(x + 95, y, 84, 32, actor.next_exp_s)
end
#--------------------------------------------------------------------------
# * Alias draw_actor_exp
#--------------------------------------------------------------------------
# If BlizzABS is active
if method_defined?(:draw_actor_exp_original)
# Do the preceeding code instead of draw_actor_exp_original
alias draw_actor_exp_original write_actor_exp unless $@
# If BlizzABS is not active
else
# Do the preceeding code instead of draw_actor_exp
alias draw_actor_exp write_actor_exp unless $@
end
#--------------------------------------------------------------------------
# * Draw Face Graphic
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_face_graphic(actor, x, y)
bitmap = RPG::Cache.picture(actor.id.to_s)
self.contents.blt(x, y, bitmap, Rect.new(0, 0, 96, 96))
end
#--------------------------------------------------------------------------
# * Draw Picture
#--------------------------------------------------------------------------
def draw_picture(picture_name, x, y)
bitmap = RPG::Cache.picture(picture_name)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x, y, bitmap, src_rect)
end
end
#===============================================================================
# ** Window_Command_Taiine_CMS
#-------------------------------------------------------------------------------
# This code allows the command window in the menu to display icons.
#===============================================================================
class Window_Command_Taiine_CMS < Window_Selectable
#-----------------------------------------------------------------------------
# * Public Instance Variables
#-----------------------------------------------------------------------------
attr_reader :continue
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize(index, continue)
# Icons only?
@icons_only = Taiine_CMS::Menu_style
# If @icons_only is true: set the width to 64, otherwise, set the width
# to 160
width = @icons_only ? 64 : 160
commands = ['Inventory' , 'Abilities', 'Equipment', 'Save', 'End Game']
super(0, 0, width, commands.size * 32 + 32) # window size
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
self.index = 0
end
#-----------------------------------------------------------------------------
# * Draw Item
#-----------------------------------------------------------------------------
def draw_item(i, color)
self.contents.fill_rect(0, i*32, 148, 32, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon("Menu#{i}")
opacity = (color == normal_color ? 255 : 128)
# Set the x offset of the icons based on the @icons_only
# If the @icons_only is true, set the x of the icons to 5
# Otherwise, set the x of the icons to 104
x_icons = @icons_only ? 5 : 104
self.contents.blt(x_icons, 4 + i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
# Skip the rest of it if it is in @icons_only mode
return if @icons_only
self.contents.font.color = color
self.contents.draw_text(-49, i*32, 148, 32, @commands, 2)
end
#-----------------------------------------------------------------------------
# * Refresh
#-----------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end
#==============================================================================
# * Window_PlayTime
#------------------------------------------------------------------------------
# Edited to right-align the text "Play Time".
#==============================================================================
class Window_PlayTime
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Play Time", 2)
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, text, 2)
end
end
#==============================================================================
# * Window MenuStatus
#------------------------------------------------------------------------------
# Edited to be ubiquitous for the menu.
#==============================================================================
class Window_MenuStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(20, 0, 440, 480) #left, top, right, bottom
self.z = 6000
self.contents = Bitmap.new(width - 32, height - 32)
@playtime_sprite = Sprite.new()
@playtime_sprite.bitmap = Bitmap.new(120, 32)
@total_sec = 0
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
actor = $game_actors[Taiine_CMS::Main_player_id]
# If Taiine_CMS::Main_player_id is to a actor that doesn't exist
if actor.nil?
# Tell the developer
p "Your Taiine_CMS::Main_player_id (#{Taiine_CMS::Main_player_id}) actor does not exist."
# Set the main actor the the 1st player in the party.
actor = $game_party.actors[0]
end
# Draw the actors face/battler
draw_actor(actor, 0, 10)
# Draw the actors name (with shadow)
draw_actor_name(actor, 100, 0)
# Draw the actors level
draw_actor_level(actor, 100, 40)
# Draw the actors class
draw_actor_class(actor, 100, 60)
# Draw the actors state
draw_actor_status(actor, 100, 80)
# Draw the actors vitality & experience
draw_actor_vitality(actor, 240, 8)
# Draw the actors equipment
draw_actor_equipment(actor, 5, 130)
# Draw the actors parameters
self.contents.font.size = 16
for i in 0..6
draw_actor_parameter(actor, 240, 130 + 32 * i, i)
end
self.contents.font.size = 22
# Draw location, Gold & Playtime
draw_location(0, 384)
draw_gold(150, 384)
draw_playtime(300, 384)
end
#--------------------------------------------------------------------------
# * Draw Actor Graphic (Face / Battler)
#--------------------------------------------------------------------------
def draw_actor(actor, x, y)
draw_actor_face_graphic(actor, x, y)
end
#--------------------------------------------------------------------------
# * Draw Actor Name
#--------------------------------------------------------------------------
def draw_actor_name(actor, x, y)
self.contents.font.size = 30
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(x + 1, y, 110, 40, actor.name)
self.contents.font.color = normal_color
self.contents.draw_text(x, y + 1, 110, 40, actor.name)
self.contents.font.size = 22
end
#--------------------------------------------------------------------------
# * Draw Actor Level
#--------------------------------------------------------------------------
def draw_actor_level(actor, x, y)
self.contents.font.size = 16
self.contents.font.color = system_color
self.contents.draw_text(x, y, 96, 32, "Level:")
self.contents.font.color = normal_color
self.contents.draw_text(x + 40, y, 24, 32, actor.level.to_s, 0)
self.contents.font.size = 22
end
#--------------------------------------------------------------------------
# * Draw Actor Class
#--------------------------------------------------------------------------
def draw_actor_class(actor, x, y)
self.contents.font.size = 16
self.contents.font.color = system_color
self.contents.draw_text(x, y, 96, 32, "Class:")
self.contents.font.color = normal_color
# Call Window_Base's draw_actor_class to draw the text for the class naem
super(actor, x + 40, y)
self.contents.font.size = 22
end
#--------------------------------------------------------------------------
# * Draw Actor Status
#--------------------------------------------------------------------------
def draw_actor_status(actor, x, y)
self.contents.font.size = 16
self.contents.font.color = system_color
self.contents.draw_text(x, y, 96, 32, "State:")
self.contents.font.color = normal_color
draw_actor_state(actor, x + 40, y)
self.contents.font.size = 22
end
#--------------------------------------------------------------------------
# * Draw Actor Vitality
#--------------------------------------------------------------------------
def draw_actor_vitality(actor, x, y)
self.contents.font.size = 16
draw_actor_hp(actor, x, y)
draw_actor_sp(actor, x, y + 32)
draw_actor_exp(actor, x, y + 64)
self.contents.font.size = 22
end
#--------------------------------------------------------------------------
# * Draw Actor Equipment
#--------------------------------------------------------------------------
def draw_actor_equipment(actor, x, y)
dy = 32
self.contents.font.size = 22
self.contents.font.color = system_color
self.contents.draw_text(x + 35, y, 96, 32, "Equipment")
self.contents.font.color = normal_color
draw_item_name($data_weapons[actor.weapon_id], x, y + 1 * dy)
draw_item_name($data_armors[actor.armor1_id], x, y + 2 * dy)
draw_item_name($data_armors[actor.armor2_id], x, y + 3 * dy)
draw_item_name($data_armors[actor.armor3_id], x, y + 4 * dy)
draw_item_name($data_armors[actor.armor4_id], x, y + 5 * dy)
end
#--------------------------------------------------------------------------
# * Draw Location
#--------------------------------------------------------------------------
def draw_location(x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, "Location", 1)
self.contents.font.color = normal_color
self.contents.draw_text(x, y + 32, 150, 32, $game_map.name, 1)
end
#--------------------------------------------------------------------------
# * Draw Gold
#--------------------------------------------------------------------------
def draw_gold(x, y)
self.contents.font.color = system_color
# Set the width of the gold word & gold_amount texts
text_width = 120
# Set the name of the picture to use for the gold icon
gold_icon_name = 'Gold'
# Draw the text for the word for gold
self.contents.draw_text(x, y, text_width, 32, $data_system.words.gold, 1)
self.contents.font.color = normal_color
# Get the string for the amount of gold
gold_amount = $game_party.gold.to_s
wg = contents.text_size(gold_amount).width
# Get the width of the icon
wi = RPG::Cache.picture(gold_icon_name).width
# Calculate the starting x of the text
st_x = x + text_width / 2 - wi / 2 - wg / 2 # Used hand calculations!
# Draw the gold
self.contents.draw_text(st_x, y + 32, 120, 32, gold_amount)
# Draw the icon next to the text
draw_picture(gold_icon_name, st_x + wg, y + 37)
end
#--------------------------------------------------------------------------
# * Draw Playtime
#--------------------------------------------------------------------------
def draw_playtime(x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, "Play Time", 1)
@playtime_sprite.x = x + self.x + 16
@playtime_sprite.y = y + 32 + self.y + 16
@playtime_sprite.z = self.z
redraw_playtime
end
#--------------------------------------------------------------------------
# * Redraw Playtime
#--------------------------------------------------------------------------
def redraw_playtime
@playtime_sprite.bitmap.clear
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
@playtime_sprite.bitmap.font.color = normal_color
@playtime_sprite.bitmap.draw_text(0, 0, 120, 32, text, 1)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If the playtime needs to be updated
if @total_sec != Graphics.frame_count / Graphics.frame_rate
redraw_playtime
end
super
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def x=(val)
# Move the @playtime_sprite
@playtime_sprite.x += (val - self.x) unless @playtime_sprite.nil?
# Run the super
super(val)
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
@playtime_sprite.bitmap.dispose
@playtime_sprite.dispose
super
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# Edited.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Classwide Variables
#--------------------------------------------------------------------------
@@menu_index = 0
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = $scene.is_a?(Scene_Map) ? menu_index : @@menu_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
Graphics.freeze
# Makes the Map appear in the background
@spriteset = Spriteset_Map.new
# Navigation
s1 = "Inventory"
s2 = "Abilities"
s3 = "Equipment"
s4 = "Save Game"
s5 = "Quit Game"
@command_window = Window_Command_Taiine_CMS.new(180, [s1, s2, s3, s4, s5,])
@command_window.index = @menu_index
@command_window.y = 140 - @command_window.height / 2 #Height
@command_window.x = 450 #Left-Right placement
@command_window.z = 6000
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(3)
end
# Make status window
@status_window = Window_MenuStatus.new
# Move the windows if the menu is in icon only mode
if Taiine_CMS::Menu_style == true
@command_window.x += 53
@status_window.x += 53
end
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Store the menu index
@@menu_index = @command_window.index
# Dispose of windows
@command_window.dispose
@spriteset.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@command_window.update
@status_window.update
@spriteset.update
# If command window is active: call update_command
if @command_window.active
update_command
return
end
# If status window is active: call update_status
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Get the index in the party of teh leading actor
actor_index = $game_party.actors.index($game_actors[Taiine_CMS::Main_player_id])
# If the Taiine_CMS::Main_player_id is not in the party
if actor_index.nil?
# Tell the developer
p "Your Taiine_CMS::Main_player_id (#{Taiine_CMS::Main_player_id}) actor is not in the party."
# Set the actor_id to the first player in the party so it doesn't error
actor_index = 0
end
# Branch by command window cursor position
case @command_window.index
when 0 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Item.new
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
# Switch to skill screen
$scene = Scene_Skill.new(actor_index)
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
# Switch to equip screen
$scene = Scene_Equip.new(actor_index)
when 3 # save
# If saving is forbidden
if $game_system.save_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to save screen
$scene = Scene_Save.new
when 4 # end game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
end
return
end
end
end
[/hide]
Customization
Requires the following images to be in the Pictures Folder of your project
Player Portrait: 96x96 File name of the player ID Example: 1.png
Gold Coin Icon: 24x24 Gold.png
Requires the following images to be in the Icons Folder of your project
Menu Icons: 24x24
Menu0.png (Inventory)
Menu1.png (Abilities)
Menu2.png (Equipment)
Menu3.png (Save Game)
Menu4.png (Quit Game)
* Note: The icons used in the demo (not seen in the screenshot) are quick and rather 'ugly' this is to encourage YOU to pick your own rather then use the ones supplied in the demo. :3
Compatibility
Not compatible with other Scripts that modify the main window (Scene_Menu).
Can be used with other CMS's that do not modify the 'main' window.
Screenshot
DEMO
[hide]File Download[/hide]
Installation
Paste the Script above Main.
Place the images as mentioned under Customization
Terms and Conditions
Can be used in Commercial & Non Commercial Games
Credit MUST be given, not just in a forum topic but in the game as well (as all credits should be shown)
Credits
The Law G14 - Player Portrait, Gold & Menu Icons
Night_Runner - General Godliness :P
Taiine's Solo Player Custom Menu System
ผมไม่อัพ อะไรทั้งสิ้นแล้วนะครับ ติดใจกระทู้ไหนก็ขอโทษครับ ขอไม่ตอบ ขอเป้นฝ่ายดูอย่างเดียว
### โหลดโดจินฟรี ที่นี้ คลิก ๆ ###
### โหลดโดจินฟรี ที่นี้ คลิก ๆ ###
[IMG]
[IMG]
[IMG]
[IMG]
[IMG]