I'm having a problem with a menu script. It seems I get to a part in my project near the beginning where the actor finds a new helm. Once you change the helm to the new helm, and go into the item menu you get this error:
---------------------------
Æsir
---------------------------
Script ' Menu' line 1404: NoMethodError occurred.
undefined method `icon_name' for nil:NilClass
---------------------------
OK
---------------------------
I am completly dreadful when it comes to scripting so i have no idea what the error is or means D:
I probs need to post the script eh?
#==============================================================================
# ** Custom Menu System
#------------------------------------------------------------------------------
# * Created by: albertfish
# * Version: 1.0
# * Last edited: September 5, 2009
#------------------------------------------------------------------------------
# Description:
# This is a complete redesign of the default menu system redesigned for
# a 14 player party.
#------------------------------------------------------------------------------
# Features:
# - Handles large parties
# - Allow to change the order of the members in the party
# - This is done via FOMAR1053 script
# - Handles character faces
# - Easy to set up
# - Easy to change during the game
# - Organized items menu system
# - Includes 9 different categories to sort items
# - Easy to set up items to be sorted
# - Easy to customize appearance
#------------------------------------------------------------------------------
# Item Setup Instructions:
# This script sorts items automatically based on certain aspects of the
# item. To set up items to be sorted into correct categories follow this
# guide.
#
# Consumable Items - Must have Consumable flag set to yes
# - Must have Occasion flag set to anything other than
# never.
# Weapons - All items in Weapons tab in the database
# Body Equipment - Must be under Armors tab
# - Kind must be Body Armor
# Head Equipment - Must be under Armors tab
# - Kind must be Helmet
# Arm Equipment - Must be under Armors tab
# - Kind must be Shield
# Accessory - Must be under Armors tab
# - Kind must be Accessory
# Raw Materials - Must be consumable
# - Must have occasion of never
# Story Items - Must be non consumable
#------------------------------------------------------------------------------
# Face Setup Instructions:
# To set up faces for the actors, create a folder inside the Pictures
# folder and name if Faces. Inside this folder is where you place all of
# the faces. The initial face must have the same name as the actor.
# For example Aluxes' face graphic has the name Aluxes.
# During the game if you wish to change an actor's face graphic, execute
# this script command:
# $change_face.new("name", "image name")
# Where "name" is the name of the actor (eg. "Aluxes") and "image name" is
# the name of the face graphic you want (eg. "Aluxes2"). You must keep the
# quotation marks.
#------------------------------------------------------------------------------
# Install Instructions:
# Place this script above the main script and below the default scripts.
#==============================================================================
#==============================================================================
# ** CMS_Config
#------------------------------------------------------------------------------
# This module contains the configuration data of the menu.
#------------------------------------------------------------------------------
# Begin Editable Area.
#==============================================================================
module CMS_Config
# Game title that is displayed in the menu.
TITLE = "Æsir"
# Set the menu item icons. These must be size 24px by 24px.
# The icons must be placed in the icons folder in the games directory
# and the file name of the icons must be placed between the quotation
# marks.
SKILL_ICON = "skill"
ITEM_ICON = "item"
EQUIP_ICON = "equip"
STATUS_ICON = "status"
FORMATION_ICON = "formation"
DATA_ICON = "data"
SYSTEM_ICON = "system"
# Set the menu item terms. These are the words that appear in the left menu
# box in the main menu screen.
STATUS_TERM = "Status"
FORMATION_TERM = "Formation"
DATA_TERM = "Bestiary"
SYSTEM_TERM = "System"
# Set the menu item icons. These must be size 24px by 24px.
# The icons must be placed in the icons folder in the games directory
# and the file name of the icons must be placed between the quotation
# marks.
ITEMS_MENU_ICONS = []
ITEMS_MENU_ICONS[0] = "MenuRecent"
ITEMS_MENU_ICONS[1] = "MenuPotions"
ITEMS_MENU_ICONS[2] = "MenuWeapons"
ITEMS_MENU_ICONS[3] = "MenuBody"
ITEMS_MENU_ICONS[4] = "MenuHead"
ITEMS_MENU_ICONS[5] = "MenuShield"
ITEMS_MENU_ICONS[6] = "MenuAcc"
ITEMS_MENU_ICONS[7] = "MenuCraft"
ITEMS_MENU_ICONS[8] = "MenuQuest"
# Set the menu item text. This is the text that will display at the bottom
# informing the player what each category is.
ITEMS_MENU_TEXT = []
ITEMS_MENU_TEXT[0] = "Recent Items"
ITEMS_MENU_TEXT[1] = "Potions"
ITEMS_MENU_TEXT[2] = "Weapons"
ITEMS_MENU_TEXT[3] = "Body Armour"
ITEMS_MENU_TEXT[4] = "Head Armour"
ITEMS_MENU_TEXT[5] = "Shields"
ITEMS_MENU_TEXT[6] = "Accessories"
ITEMS_MENU_TEXT[7] = "Craft Material"
ITEMS_MENU_TEXT[8] = "Quest Items"
# Set up the status menu hp and sp bar images. The images must be 146px wide
# by 8px height.
# The images must be placed in the pictures folder in the games directory
# and the file name of the images must be placed between the quotation
# marks.
SM_BARBACK = "sm_barback"
SM_HPBAR = "sm_hpbar"
SM_SPBAR = "sm_spbar"
# If true then the battler image will be double sized.
LARGE_BATTLER = false
# Actory Element Icons. This is where you set which element icon will be
# displayed for each player. These must be size 24px by 24px.
ELEMENT_ICON = []
ELEMENT_ICON[0] = "windicon" # First actor in the database
ELEMENT_ICON[1] = "windicon" # Second actor in the database
ELEMENT_ICON[2] = "thundericon" # Third actor in the database
ELEMENT_ICON[3] = "fireicon" # Just keep adding these following
ELEMENT_ICON[4] = "fireicon" # the pattern for as many actors
ELEMENT_ICON[5] = "fireicon" # as you have in the database.
ELEMENT_ICON[6] = "fireicon" # Put "" for no icon.
ELEMENT_ICON[7] = "fireicon"
ELEMENT_ICON[8] = "fireicon"
ELEMENT_ICON[9] = "fireicon"
ELEMENT_ICON[10] = "fireicon"
ELEMENT_ICON[11] = "fireicon"
ELEMENT_ICON[12] = "fireicon"
ELEMENT_ICON[13] = "fireicon"
ELEMENT_ICON[14] = "fireicon"
# Set the default font. The menu was designed with the settings:
# Font.default_name = "Comic Sans MS"
# Font.default_size = 24
# Changing the fonts may cause misalignments.
Font.default_name = "Arial"
Font.default_size = 24
end
#==============================================================================
# End Editable Area.
#------------------------------------------------------------------------------
# Warning! Do not edit beyond this point unless you know what you are doing!
#==============================================================================
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * include the CMS_Config module
#--------------------------------------------------------------------------
include CMS_Config
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(-12, -12, 492, 428)
@item_max = $game_party.actors.size
self.contents = Bitmap.new(width - 32, @item_max * 100 - 4)
self.opacity = 0
@winlist = []
for i in 0...4
@winlist[i] = Window_Blank.new(160, i * 100, 480, 100)
end
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 94 + 12
y = i * 100 + 6
# Draw all the infomation for the player
actor = $game_party.actors[i]
face = RPG::Cache.picture("Faces/" + $change_face.face(actor.id))
src_rect = Rect.new(0, 0, face.width, face.height)
self.contents.blt(12, y, face, src_rect)
#draw_actor_graphic(actor, x - 94, y + 72)
draw_actor_name(actor, x, y + 12)
draw_actor_class(actor, x, y + 32)
draw_actor_level(actor, x, y - 8)
draw_actor_state(actor, x, y + 52)
draw_actor_hp(actor, x + 204, y - 4)
draw_actor_sp(actor, x + 204, y + 24)
self.contents.font.color = system_color
self.contents.draw_text(x + 204, y + 52, 100, 32, "NEXT")
self.contents.font.color = normal_color
self.contents.draw_text(348, y + 52, 100, 32, actor.next_rest_exp_s, 2)
element = RPG::Cache.icon(ELEMENT_ICON[actor.id])
src_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(0, i*100, element, src_rect)
# Draw the hp and sp bars
# Initialize the image variables
bar_back = RPG::Cache.picture(SM_BARBACK)
hp_bar = RPG::Cache.picture(SM_HPBAR)
sp_bar = RPG::Cache.picture(SM_SPBAR)
# Bar background
width = bar_back.width
height = bar_back.height
src_rect = Rect.new(0, 0, width, height)
self.contents.blt(x + 204, y + 20, bar_back, src_rect)
self.contents.blt(x + 204, y + 48, bar_back, src_rect)
# Heath bar
width = hp_bar.width * actor.hp / actor.maxhp
height = hp_bar.height
src_rect = Rect.new(0, 0, width, height)
self.contents.blt(x + 204, y + 20, hp_bar, src_rect)
# Magic bar
width = sp_bar.width * actor.sp / actor.maxsp
height = sp_bar.height
src_rect = Rect.new(0, 0, width, height)
self.contents.blt(x + 204, y + 48, sp_bar, src_rect)
end
end
#--------------------------------------------------------------------------
# * Get Top Row
#--------------------------------------------------------------------------
def top_row
# Divide y-coordinate of window contents transfer origin by 1 row
# height of 100
return self.oy / 100
end
#--------------------------------------------------------------------------
# * Set Top Row
# row : row shown on top
#--------------------------------------------------------------------------
def top_row=(row)
# If row is less than 0, change it to 0
if row < 0
row = 0
end
# If row exceeds row_max - 1, change it to row_max - 1
if row > row_max - 1
row = row_max - 1
end
# Multiply 1 row height by 100 for y-coordinate of window contents
# transfer origin
self.oy = row * 100
end
#--------------------------------------------------------------------------
# * Get Number of Rows Displayable on 1 Page
#--------------------------------------------------------------------------
def page_row_max
# Only allow 4 rows to be displayed at a time
return 4
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @index < 0
self.cursor_rect.empty
return
end
# Get current row
row = @index / @column_max
# If current row is before top row
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = self.width / @column_max - 32
# Calculate cursor coordinates
x = 6
y = @index / @column_max * 100 - self.oy+4
# Update cursor rectangle
self.cursor_rect.set(x, y, cursor_width, 84)
end
#--------------------------------------------------------------------------
# * Dispose all of the windows
#--------------------------------------------------------------------------
def remove
self.dispose
for i in 0...4
@winlist[i].dispose
end
end
end
#==============================================================================
# ** Window_MenuCommand
#------------------------------------------------------------------------------
# This window deals with menu command choices.
#==============================================================================
class Window_MenuCommand < Window_Selectable
#--------------------------------------------------------------------------
# * include the CMS_Config module
#--------------------------------------------------------------------------
include CMS_Config
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(width, commands)
# Compute window height from command quantity
super(0, -4, width, commands.size * 48 + 36)
@item_max = commands.size
@commands = commands
# Create the seperate windows for each command
@winlist = []
for i in 0...@item_max
@winlist[i] = Window_Blank.new(0, i * 48, 160, 48)
end
self.opacity = 0
self.contents = Bitmap.new(width - 32, @item_max * 48)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
src_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(0,0, RPG::Cache.icon(SKILL_ICON), Rect.new(0, 0, 24, 24))
self.contents.blt(0,48, RPG::Cache.icon(ITEM_ICON), Rect.new(0, 0, 24, 24))
self.contents.blt(0,96, RPG::Cache.icon(EQUIP_ICON), Rect.new(0, 0, 24, 24))
self.contents.blt(0,144, RPG::Cache.icon(STATUS_ICON), Rect.new(0, 0, 24, 24))
self.contents.blt(0,192, RPG::Cache.icon(FORMATION_ICON), Rect.new(0, 0, 24, 24))
self.contents.blt(0,240, RPG::Cache.icon(DATA_ICON), Rect.new(0, 0, 24, 24))
self.contents.blt(0,288, RPG::Cache.icon(SYSTEM_ICON), Rect.new(0, 0, 24, 24))
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(32, 48 * index - 4, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @index < 0
self.cursor_rect.empty
return
end # if
# Get current row
row = @index
# If current row is before top row
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end # if
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end # if
# Calculate cursor coordinates
x = 0 #112
y = @index * 48 + 4
self.cursor_rect.set(-8, -8 + y, 144, 32)
end # def
#--------------------------------------------------------------------------
# * Dispose all of the windows
#--------------------------------------------------------------------------
def remove
self.dispose
for i in 0...@item_max
@winlist[i].dispose
end
end
end
#==============================================================================
# ** Window_Blank
#------------------------------------------------------------------------------
# This window deals with blank window backgrounds.
#==============================================================================
class Window_Blank < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x coordinate
# y : window y coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
end
end
#==============================================================================
# ** Window_MenuInfo
#------------------------------------------------------------------------------
# This window shows time played, steps taken, current map and game title.
#==============================================================================
class Window_MenuInfo < Window_Base
#--------------------------------------------------------------------------
# * include the CMS_Config module
#--------------------------------------------------------------------------
include CMS_Config
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 384, 640, 112)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@window = Window_Blank.new(0, 400, 640, 80)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(280, 4, 120, 32, "Step Count ")
self.contents.draw_text(280, 42, 120, 32, TITLE)
self.contents.draw_text(4, 4, 120, 32, "Play Time ")
@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.draw_text(4, 42, 240, 32, "Location: ")
self.contents.font.color = normal_color
self.contents.draw_text(320, 4, 120, 32, $game_party.steps.to_s, 2)
self.contents.draw_text(64, 4, 120, 32, text, 2)
self.contents.draw_text(0, 14, 640, 32, "_________________________________________________________")
self.contents.draw_text(86, 42, 240, 32, $game_map.name.to_s)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
#--------------------------------------------------------------------------
# * Dispose all of the windows
#--------------------------------------------------------------------------
def remove
self.contents.dispose
@window.dispose
end
end
#==============================================================================
# ** Window_TargetMenu
#------------------------------------------------------------------------------
# This window selects a use target for the actor on item and skill screens.
#==============================================================================
class Window_TargetMenu < Window_Selectable
#--------------------------------------------------------------------------
# * include the CMS_Config module
#--------------------------------------------------------------------------
include CMS_Config
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 336, 480)
@item_max = $game_party.actors.size
self.contents = Bitmap.new(width - 32, @item_max * 120 - 32)
self.z += 10
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 4
y = i * 116
actor = $game_party.actors[i]
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 144, y)
draw_actor_level(actor, x + 8, y + 32)
draw_actor_state(actor, x + 8, y + 64)
draw_actor_hp(actor, x + 152, y + 32)
draw_actor_sp(actor, x + 152, y + 60)
# Draw the hp and sp bars
# Initialize the image variables
bar_back = RPG::Cache.picture(SM_BARBACK)
hp_bar = RPG::Cache.picture(SM_HPBAR)
sp_bar = RPG::Cache.picture(SM_SPBAR)
# Bar background
width = bar_back.width
height = bar_back.height
src_rect = Rect.new(0, 0, width, height)
self.contents.blt(x + 140, y + 56, bar_back, src_rect)
self.contents.blt(x + 140, y + 84, bar_back, src_rect)
# Heath bar
width = hp_bar.width * actor.hp / actor.maxhp
height = hp_bar.height
src_rect = Rect.new(0, 0, width, height)
self.contents.blt(x + 140, y + 56, hp_bar, src_rect)
# Magic bar
width = sp_bar.width * actor.sp / actor.maxsp
height = sp_bar.height
src_rect = Rect.new(0, 0, width, height)
self.contents.blt(x + 140, y + 84, sp_bar, src_rect)
end
end
#--------------------------------------------------------------------------
# * Get Top Row
#--------------------------------------------------------------------------
def top_row
# Divide y-coordinate of window contents transfer origin by 1 row
# height of 120
return self.oy / 116
end
#--------------------------------------------------------------------------
# * Set Top Row
# row : row shown on top
#--------------------------------------------------------------------------
def top_row=(row)
# If row is less than 0, change it to 0
if row < 0
row = 0
end
# If row exceeds row_max - 1, change it to row_max - 1
if row > row_max - 1
row = row_max - 1
end
# Multiply 1 row height by 120 for y-coordinate of window contents
# transfer origin
self.oy = row * 116
end
#--------------------------------------------------------------------------
# * Get Number of Rows Displayable on 1 Page
#--------------------------------------------------------------------------
def page_row_max
# Only allow 4 rows to be displayed at a time
return 4
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @index < 0
self.cursor_rect.empty
return
end
# Get current row
row = @index / @column_max
# If current row is before top row
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = self.width / @column_max - 32
# Calculate cursor coordinates
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 116 - self.oy
# Update cursor rectangle
self.cursor_rect.set(x, y, cursor_width, 96)
end
end
#==============================================================================
# ** Window_EquipCurrent
#------------------------------------------------------------------------------
# This window displays items the actor is currently equipped with on the
# equipment screen.
#==============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 192, 320, 192)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@actor = actor
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description, item)
end
end
#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
# This window displays choices when opting to change equipment on the
# equipment screen.
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
# equip_type : equip region (0-3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(320, 0, 320, 384)
@actor = actor
@equip_type = equip_type
@column_max = 1
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Item Acquisition
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Add equippable weapons
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons[i])
end
end
end
# Add equippable armor
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
@data.push($data_armors[i])
end
end
end
end
# Add blank page
@data.push(nil)
# Make a bit map and draw all items
@item_max = @data.size
self.contents = Bitmap.new(width - 32, @item_max * 32)
for i in 0...@item_max-1
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4
y = index * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description, item)
end
end
#==============================================================================
# ** Window_EquipLeft
#------------------------------------------------------------------------------
# This window displays actor parameter changes on the equipment screen.
#==============================================================================
class Window_EquipLeft < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 320, 384)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
x = 16
y = 24
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(x+4, y+0, 120, 32, "HP")
self.contents.draw_text(x+4, y+32, 120, 32, "MP")
self.contents.font.color = normal_color
self.contents.draw_text(x+124, y+0, 36, 32, @actor.maxhp.to_s, 2)
self.contents.draw_text(x+124, y+32, 36, 32, @actor.maxsp.to_s, 2)
draw_actor_parameter(@actor, x+4, y+64, 0)
draw_actor_parameter(@actor, x+4, y+96, 1)
draw_actor_parameter(@actor, x+4, y+128, 2)
draw_actor_parameter(@actor, x+4, y+160, 3)
draw_actor_parameter(@actor, x+4, y+192, 4)
draw_actor_parameter(@actor, x+4, y+224, 5)
draw_actor_parameter(@actor, x+4, y+256, 6)
if @new_maxhp != nil
self.contents.font.color = system_color
self.contents.draw_text(x+160, y+0, 40, 32, "->", 1)
if @new_maxhp > @actor.maxhp
self.contents.font.color = text_color(3)
elsif @new_maxhp < @actor.maxhp
self.contents.font.color = text_color(2)
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x+200, y+0, 36, 32, @new_maxhp.to_s, 2)
end
if @new_maxsp != nil
self.contents.font.color = system_color
self.contents.draw_text(x+160, y+32, 40, 32, "->", 1)
if @new_maxsp > @actor.maxsp
self.contents.font.color = text_color(3)
elsif @new_maxsp < @actor.maxsp
self.contents.font.color = text_color(2)
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x+200, y+32, 36, 32, @new_maxsp.to_s, 2)
end
if @new_atk != nil
self.contents.font.color = system_color
self.contents.draw_text(x+160, y+64, 40, 32, "->", 1)
if @new_atk > @actor.atk
self.contents.font.color = text_color(3)
elsif @new_atk < @actor.atk
self.contents.font.color = text_color(2)
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x+200, y+64, 36, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil
self.contents.font.color = system_color
self.contents.draw_text(x+160, y+96, 40, 32, "->", 1)
if @new_pdef > @actor.pdef
self.contents.font.color = text_color(3)
elsif @new_pdef < @actor.pdef
self.contents.font.color = text_color(2)
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x+200, y+96, 36, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil
self.contents.font.color = system_color
self.contents.draw_text(x+160, y+128, 40, 32, "->", 1)
if @new_mdef > @actor.mdef
self.contents.font.color = text_color(3)
elsif @new_mdef < @actor.mdef
self.contents.font.color = text_color(2)
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x+200, y+128, 36, 32, @new_mdef.to_s, 2)
end
if @new_str != nil
self.contents.font.color = system_color
self.contents.draw_text(x+160, y+160, 40, 32, "->", 1)
if @new_str > @actor.str
self.contents.font.color = text_color(3)
elsif @new_str < @actor.str
self.contents.font.color = text_color(2)
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x+200, y+160, 36, 32, @new_str.to_s, 2)
end
if @new_dex != nil
self.contents.font.color = system_color
self.contents.draw_text(x+160, y+192, 40, 32, "->", 1)
if @new_dex > @actor.dex
self.contents.font.color = text_color(3)
elsif @new_dex < @actor.dex
self.contents.font.color = text_color(2)
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x+200, y+192, 36, 32, @new_dex.to_s, 2)
end
if @new_agi != nil
self.contents.font.color = system_color
self.contents.draw_text(x+160, y+224, 40, 32, "->", 1)
if @new_agi > @actor.agi
self.contents.font.color = text_color(3)
elsif @new_agi < @actor.agi
self.contents.font.color = text_color(2)
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x+200, y+224, 36, 32, @new_agi.to_s, 2)
end
if @new_int != nil
self.contents.font.color = system_color
self.contents.draw_text(x+160, y+256, 40, 32, "->", 1)
if @new_int > @actor.int
self.contents.font.color = text_color(3)
elsif @new_int < @actor.int
self.contents.font.color = text_color(2)
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x+200, y+256, 36, 32, @new_int.to_s, 2)
end
end
#--------------------------------------------------------------------------
# * Set parameters after changing equipment
# new_atk : attack power after changing equipment
# new_pdef : physical defense after changing equipment
# new_mdef : magic defense after changing equipment
#--------------------------------------------------------------------------
def set_new_parameters(new_atk, new_pdef, new_mdef, new_maxhp, new_maxsp, new_str, new_dex, new_agi, new_int)
if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or @new_maxhp != new_maxhp or @new_maxsp != new_maxsp or @new_str != new_str or @new_dex != new_dex or @new_agi != new_agi or @new_int != new_int
@new_maxhp = new_maxhp
@new_maxsp = new_maxsp
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
refresh
end
end
end
#==============================================================================
# ** Window_EquipStatus
#------------------------------------------------------------------------------
# This window shows the actors status.
#==============================================================================
class Window_EquipStatus < Window_Base
include CMS_Config
def initialize(actor)
super(0, 0, 320, 384)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
x = 4
# Draw all the infomation for the player
face = RPG::Cache.picture("Faces/" + $change_face.face(@actor.id))
src_rect = Rect.new(0, 0, face.width, face.height)
self.contents.blt(64 - face.width/2, 32, face, src_rect)
draw_actor_name(@actor, x + 96, 0)
draw_actor_class(@actor, x + 128, 32)
draw_actor_level(@actor, x + 204, 0)
draw_actor_hp(@actor, x + 128, 64)
draw_actor_sp(@actor, x + 128, 108)
# Draw the hp and sp bars
# Initialize the image variables
bar_back = RPG::Cache.picture(SM_BARBACK)
hp_bar = RPG::Cache.picture(SM_HPBAR)
sp_bar = RPG::Cache.picture(SM_SPBAR)
# Bar background
width = bar_back.width
height = bar_back.height
src_rect = Rect.new(0, 0, width, height)
self.contents.blt(x + 128, 88, bar_back, src_rect)
self.contents.blt(x + 128, 132, bar_back, src_rect)
# Heath bar
width = hp_bar.width * @actor.hp / @actor.maxhp
height = hp_bar.height
src_rect = Rect.new(0, 0, width, height)
self.contents.blt(x + 128, 88, hp_bar, src_rect)
# Magic bar
width = sp_bar.width * @actor.sp / @actor.maxsp
height = sp_bar.height
src_rect = Rect.new(0, 0, width, height)
self.contents.blt(x + 128, 132, sp_bar, src_rect)
end
end
#==============================================================================
# ** Window_EquipHelp
#------------------------------------------------------------------------------
# This window shows item explanations along with the icon.
#==============================================================================
class Window_EquipHelp < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 384, 640, 96)
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# * Set Text
# text : text string displayed in window
# align : alignment (0..flush left, 1..center, 2..flush right)
#--------------------------------------------------------------------------
def set_text(text, item, align = 0)
# If at least one part of text and alignment differ from last time
if text != @text or align != @align
# Redraw text
self.contents.clear
# Redraw icon
if item
bitmap = RPG::Cache.icon(item.icon_name)
width = bitmap.width
height = bitmap.height
src_rect = Rect.new(0, 0, width, height)
dest_rect = Rect.new(0, 8, width * 2, height * 2)
self.contents.stretch_blt(dest_rect, bitmap, src_rect)
else
width = 0
end
self.contents.font.color = normal_color
self.contents.draw_text(4 + width * 2, 16, self.width - 40, 32, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end
#--------------------------------------------------------------------------
# * Set Actor
# actor : status displaying actor
#--------------------------------------------------------------------------
def set_actor(actor)
if actor != @actor
self.contents.clear
draw_actor_name(actor, 4, 0)
draw_actor_state(actor, 140, 0)
draw_actor_hp(actor, 284, 0)
draw_actor_sp(actor, 460, 0)
@actor = actor
@text = nil
self.visible = true
end
end
#--------------------------------------------------------------------------
# * Set Enemy
# enemy : name and status displaying enemy
#--------------------------------------------------------------------------
def set_enemy(enemy)
text = enemy.name
state_text = make_battler_state_text(enemy, 112, false)
if state_text != ""
text += " " + state_text
end
set_text(text, 1, 1)
end
end
#==============================================================================
# ** Window_SaveFile
#------------------------------------------------------------------------------
# This window displays save files on the save and load screens.
#==============================================================================
class Window_SaveFile < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :filename # file name
attr_reader :selected # selected
#--------------------------------------------------------------------------
# * Object Initialization
# file_index : save file index (0-3)
# filename : file name
#--------------------------------------------------------------------------
def initialize(file_index, filename)
super(0, 64 + file_index % 4 * 104, 640, 104)
self.contents = Bitmap.new(width - 32, height - 32)
@file_index = file_index
@filename = "Save#{@file_index + 1}.rxdata"
@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
@time_stamp = file.mtime
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@game_system = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
@game_self_switches = Marshal.load(file)
@game_screen = Marshal.load(file)
@game_actors = Marshal.load(file)
@game_party = Marshal.load(file)
@game_troop = Marshal.load(file)
@game_map = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
file.close
end
refresh
@selected = false
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# Draw file number
self.contents.font.color = normal_color
name = "File#{@file_index + 1}"
self.contents.draw_text(4, 0, 600, 32, name)
@name_width = contents.text_size(name).width
# If save file exists
if @file_exist
# Draw character
for i in 0...@characters.size
bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
cw = bitmap.rect.width / 4
ch = bitmap.rect.height / 4
src_rect = Rect.new(0, 0, cw, ch)
x = 320 - @characters.size * 16 + i * 32 - cw / 2
self.contents.blt(x, 52 - ch, bitmap, src_rect)
end
# Draw play time
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(48, 44, 512, 32, time_string)
self.contents.draw_text(48, 44, 512, 32, "Location: " + @game_map.name.to_s, 2)
self.contents.draw_text(48, 44, 412, 32, @game_party.gold.to_s + " " + $data_system.words.gold, 1)
end
end
#--------------------------------------------------------------------------
# * Set Selected
# selected : new selected (true = selected, false = unselected)
#--------------------------------------------------------------------------
def selected=(selected)
@selected = selected
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @selected
self.cursor_rect.set(0, 0, @name_width + 8, 32)
else
self.cursor_rect.empty
end
end
end
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays items in possession on the item and battle screens.
#==============================================================================
class Window_ItemMenu < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 352)
@column_max = 2
@category = 0
refresh
self.index = -1
@category_select = true
# If in battle, move window to center of screen
# and make it semi-transparent
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
case @category
when 0
if @item_max > 20
return @recent[self.index + (@item_max - 20)]
else
return @recent[self.index]
end
when 1
return @consumable[self.index]
when 2
return @weapon[self.index]
when 3
return @body[self.index]
when 4
return @head[self.index]
when 5
return @arm[self.index]
when 6
return @accessory[self.index]
when 7
return @raw[self.index]
when 8
return @quest[self.index]
end
end
#--------------------------------------------------------------------------
# * Set Category
#--------------------------------------------------------------------------
def category(index)
@category = index
end
#--------------------------------------------------------------------------
# * Repaint
#--------------------------------------------------------------------------
def repaint
refresh
if @category == 0
@item_max = @recent.size
elsif @category == 1
@item_max = @consumable.size
elsif @category == 2
@item_max = @weapon.size
elsif @category == 3
@item_max = @body.size
elsif @category == 4
@item_max = @head.size
elsif @category == 5
@item_max = @arm.size
elsif @category == 6
@item_max = @accessory.size
elsif @category == 7
@item_max = @raw.size
elsif @category == 8
@item_max = @quest.size
end
if @item_max == 0
self.contents.dispose if self.contents != nil
self.contents = Bitmap.new(width - 32, height - 32)
end
if @item_max > 20 && @category == 0
self.contents = Bitmap.new(width - 32, height - 32)
for i in @item_max-20...@item_max
draw_item(i)
end
elsif @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@recent = []
@consumable = []
@weapon = []
@body = []
@head = []
@arm = []
@accessory = []
@raw = []
@quest = []
# Add item
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
# Add recent items
if $recent_items.size < 20
for u in 0...$recent_items.size
if $data_items[i].id == $recent_items[u].id && $recent_items[u].is_a?(RPG::Item)
@recent[($recent_items.size - 1) - u] = ($data_items[i])
end
end
else
for u in $recent_items.size-20...$recent_items.size
if $data_items[i].id == $recent_items[u].id && $recent_items[u].is_a?(RPG::Item)
@recent[21 - (u - ($recent_items.size-20))] = ($data_items[i])
end
end
end
# Add consumable, raw and quest items
if $data_items[i].consumable
if $data_items[i].occasion == 3
@raw.push($data_items[i])
else
@consumable.push($data_items[i])
end
else
@quest.push($data_items[i])
end
end
end
# Also add weapons and armors if outside of battle
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
# Add recent items
if $recent_items.size < 20
for u in 0...$recent_items.size
if $data_weapons[i].id == $recent_items[u].id && $recent_items[u].is_a?(RPG::Weapon)
@recent[($recent_items.size - 1) - u] = ($data_weapons[i])
end
end
else
for u in $recent_items.size-20...$recent_items.size
if $data_weapons[i].id == $recent_items[u].id && $recent_items[u].is_a?(RPG::Weapon)
@recent[21 - (u - ($recent_items.size-20))] = ($data_weapons[i])
end
end
end
# Add weapons
@weapon.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
# Add recent armors
if $recent_items.size < 20
for u in 0...$recent_items.size
if $data_armors[i].id == $recent_items[u].id && $recent_items[u].is_a?(RPG::Armor)
@recent[($recent_items.size - 1) - u] = ($data_armors[i])
end
end
else
for u in $recent_items.size-20...$recent_items.size
if $data_armors[i].id == $recent_items[u].id && $recent_items[u].is_a?(RPG::Armor)
@recent[21 - (u - ($recent_items.size-20))] = ($data_armors[i])
end
end
end
# Add armors
if $data_armors[i].kind == 2 # Body Armor
@body.push($data_armors[i])
elsif $data_armors[i].kind == 1 # Head Armor
@head.push($data_armors[i])
elsif $data_armors[i].kind == 0 # Arm Armor
@arm.push($data_armors[i])
elsif $data_armors[i].kind == 3 # Accessories
@accessory.push($data_armors[i])
end
end
end
end
#repaint
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
case @category
when 0
item = @recent[index]
when 1
item = @consumable[index]
when 2
item = @weapon[index]
when 3
item = @body[index]
when 4
item = @head[index]
when 5
item = @arm[index]
when 6
item = @accessory[index]
when 7
item = @raw[index]
when 8
item = @quest[index]
end
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$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 * (288 + 32)
if @item_max > 20 && @category == 0
y = (index - (@item_max - 20)) / 2 * 32
else
y = index / 2 * 32
end
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, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
if @index >= 0
@help_window.set_text(self.item == nil ? "" : self.item.description, self.item)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
if self.active and @item_max >= 0 and @index >= 0
if Input.trigger?(Input::UP) && @index <= 1
@index = -1
end
end
super
end
def cat_select(tf)
@category_select = tf
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @index < 0 || @category_select
self.cursor_rect.empty
return
end
# Get current row
row = @index / @column_max
# If current row is before top row
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = self.width / @column_max - 32
# Calculate cursor coordinates
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 32 - self.oy
# Update cursor rectangle
self.cursor_rect.set(x, y, cursor_width, 32)
end
#--------------------------------------------------------------------------
# * Draw Items after use
#--------------------------------------------------------------------------
def draw_items(index)
if @category == 0 && @recent.size > 20
draw_item(index + (@item_max - 20))
else
draw_item(index)
end
end
end
#==============================================================================
# ** Window_Category
#------------------------------------------------------------------------------
# This window deals with item category command choices.
#==============================================================================
class Window_Category < Window_Selectable
#--------------------------------------------------------------------------
# * include the CMS_Config module
#--------------------------------------------------------------------------
include CMS_Config
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(width, commands)
# Compute window height from command quantity
super(200, 0, width, 64)
@column_max = 9
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.index = 0
self.opacity = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(76+ 32 * index,0, 32, 32)
self.contents.fill_rect(rect, color)
rect = Rect.new(77+ 32 * index,1, 30, 30)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(0,0,100,32,@selection.to_s)
rect = Rect.new(0, 0, 24, 24)
bitmap = RPG::Cache.icon(ITEMS_MENU_ICONS[index])
self.contents.blt(80 + 32 * index, 4, bitmap, rect)
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @index < 0
self.cursor_rect.empty
return
end
# Update cursor rectangle
self.cursor_rect.set(76+@index*32, 0, 32, 32)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_display(ITEMS_MENU_TEXT[self.index], ITEMS_MENU_ICONS[self.index])
end
end
#==============================================================================
# ** Window_ItemTop
#------------------------------------------------------------------------------
# This window shows top bar with the title "Items" on it.
#==============================================================================
class Window_ItemTop < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.font.size = 32
self.contents.draw_text(0, 0, 100, 32, "Items")
self.contents.font.size = 24
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
self.contents.clear
self.contents.font.color = system_color
self.contents.font.size = 32
self.contents.draw_text(0, 0, 100, 32, "Items")
self.contents.font.size = 24
end
end
#==============================================================================
# ** Window_ItemHelp
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class Window_ItemHelp < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 128)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
end
#--------------------------------------------------------------------------
# * Set Text
# text : text string displayed in window
# align : alignment (0..flush left, 1..center, 2..flush right)
#--------------------------------------------------------------------------
def set_text(text, item, align = 0)
# If at least one part of text and alignment differ from last time
if text != @text or align != @align
# Redraw text
self.contents.clear
# Redraw icon
if item
bitmap = RPG::Cache.icon(item.icon_name)
width = bitmap.width
height = bitmap.height
src_rect = Rect.new(0, 0, width, height)
dest_rect = Rect.new(0, 24, width * 2, height * 2)
self.contents.stretch_blt(dest_rect, bitmap, src_rect)
else
width = 0
end
self.contents.font.color = normal_color
self.contents.draw_text(4 + width * 2, 32, self.width - 40, 32, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end
#--------------------------------------------------------------------------
# * Set Display
# text : text string displayed in window
# align : alignment (0..flush left, 1..center, 2..flush right)
#--------------------------------------------------------------------------
def set_display(text, icon, align = 0)
# If at least one part of text and alignment differ from last time
if text != @text or align != @align
# Redraw text
self.contents.clear
# Redraw icon
if icon
bitmap = RPG::Cache.icon(icon)
width = bitmap.width
height = bitmap.height
src_rect = Rect.new(0, 0, width, height)
dest_rect = Rect.new(0, 24, width * 2, height * 2)
self.contents.stretch_blt(dest_rect, bitmap, src_rect)
else
width = 0
end
self.contents.font.color = normal_color
self.contents.draw_text(4 + width * 2, 32, self.width - 40, 32, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end
#--------------------------------------------------------------------------
# * Set Actor
# actor : status displaying actor
#--------------------------------------------------------------------------
def set_actor(actor)
if actor != @actor
self.contents.clear
draw_actor_name(actor, 4, 0)
draw_actor_state(actor, 140, 0)
draw_actor_hp(actor, 284, 0)
draw_actor_sp(actor, 460, 0)
@actor = actor
@text = nil
self.visible = true
end
end
#--------------------------------------------------------------------------
# * Set Enemy
# enemy : name and status displaying enemy
#--------------------------------------------------------------------------
def set_enemy(enemy)
text = enemy.name
state_text = make_battler_state_text(enemy, 112, false)
if state_text != ""
text += " " + state_text
end
set_text(text, 1, 1)
end
end
#==============================================================================
# ** Window_Status
#------------------------------------------------------------------------------
# This window displays full status specs on the status screen.
#==============================================================================
class Window_Status < Window_Base
#--------------------------------------------------------------------------
# * include the CMS_Config module
#--------------------------------------------------------------------------
include CMS_Config
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.fill_rect(0, 28, 320, 392, normal_color)
self.contents.fill_rect(1, 29, 318, 390, Color.new(0, 0, 0, 0))
face = RPG::Cache.picture("Faces/" + $change_face.face(@actor.id))
src_rect = Rect.new(0, 0, face.width, face.height)
self.contents.blt(240 - face.width/2, 32, face, src_rect)
# Draw the battler
battler = RPG::Cache.picture(@actor.battler_name + "status.png")
src_rect = Rect.new(0, 0, battler.width, battler.height)
if LARGE_BATTLER
dest_rect = Rect.new(464 - battler.width, 224 - battler.height, battler.width*2, battler.height*2)
self.contents.stretch_blt(dest_rect, battler, src_rect)
else
self.contents.blt(464 - battler.width/2, 224 - battler.height/2, battler, src_rect)
end
draw_actor_name(@actor, 12, 32)
draw_actor_class(@actor, 12, 56)
draw_actor_level(@actor, 96, 56)
draw_actor_state(@actor, 48, 80)
draw_actor_hp(@actor, 4, 160, 158)
draw_actor_sp(@actor, 162, 160, 158)
draw_actor_parameter(@actor, 4, 192, 0)
draw_actor_parameter(@actor, 162, 192, 1)
draw_actor_parameter(@actor, 4, 224, 2)
draw_actor_parameter(@actor, 4, 256, 3)
draw_actor_parameter(@actor, 4, 288, 5)
draw_actor_parameter(@actor, 162, 256, 4)
draw_actor_parameter(@actor, 162, 288, 6)
self.contents.font.color = system_color
self.contents.draw_text(160, 128, 60, 32, "EXP")
self.contents.draw_text(4, 128, 60, 32, "NEXT")
self.contents.font.color = normal_color
self.contents.draw_text(220, 128, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(64, 128, 84, 32, @actor.next_rest_exp_s, 2)
self.contents.font.color = system_color
self.contents.font.size = 32
self.contents.draw_text(0, 0, 160, 32, "Status")
self.contents.font.size = 24
draw_item_name($data_weapons[@actor.weapon_id], 4, 320)
draw_item_name($data_armors[@actor.armor1_id], 160, 320)
draw_item_name($data_armors[@actor.armor2_id], 4, 356)
draw_item_name($data_armors[@actor.armor3_id], 160, 356)
draw_item_name($data_armors[@actor.armor4_id], 80, 388)
element = RPG::Cache.icon(ELEMENT_ICON[@actor.id])
src_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(132, 32, element, src_rect)
# Draw the hp and sp bars
# Initialize the image variables
bar_back = RPG::Cache.picture(SM_BARBACK)
hp_bar = RPG::Cache.picture(SM_HPBAR)
sp_bar = RPG::Cache.picture(SM_SPBAR)
# Bar background
width = bar_back.width
height = bar_back.height
src_rect = Rect.new(0, 0, width, height)
self.contents.blt(4, 184, bar_back, src_rect)
self.contents.blt(162, 184, bar_back, src_rect)
# Heath bar
width = hp_bar.width * @actor.hp / @actor.maxhp
height = hp_bar.height
src_rect = Rect.new(0, 0, width, height)
self.contents.blt(4, 184, hp_bar, src_rect)
# Magic bar
width = sp_bar.width * @actor.sp / @actor.maxsp
height = sp_bar.height
src_rect = Rect.new(0, 0, width, height)
self.contents.blt(162, 184, sp_bar, src_rect)
end
#--------------------------------------------------------------------------
# * Draw Parameter
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : parameter type (0-6)
#--------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 80, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 80, y, 36, 32, parameter_value.to_s, 2)
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * include the CMS_Config module
#--------------------------------------------------------------------------
include CMS_Config
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
if $game_variables[1] != 0
$recent_items = $game_variables[1]
end
# Make command window
s1 = $data_system.words.skill
s2 = $data_system.words.item
s3 = $data_system.words.equip
s4 = STATUS_TERM
s5 = FORMATION_TERM
s6 = DATA_TERM
s7 = SYSTEM_TERM
@command_window = Window_MenuCommand.new(160, [s1, s2, s3, s4, s5, s6, s7])
@command_window.index = @menu_index
# 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)
@command_window.disable_item(3)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(4)
end
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 336
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 160 - 12
@status_window.y = -12
# Make system window
s1 = "Save"
s2 = "Load"
s3 = "Title"
s4 = "Exit"
@system_window = Window_Command.new(172, [s1, s2, s3, s4])
@system_window.x = 160
@system_window.y = 288
@system_window.z = 210
@system_window.visible = false
@system_window.active = false
# Make bottom info bar
@menuinfo_window = Window_MenuInfo.new
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@command_window.remove
@gold_window.dispose
@system_window.dispose
@menuinfo_window.remove
@status_window.remove
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@command_window.update
@gold_window.update
@system_window.update
@menuinfo_window.update
@status_window.update
$game_variables[1] = $recent_items
# 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
# If system window is active: call update_system
if @system_window.active
update_system
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)
# 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
# Branch by command window cursor position
case @command_window.index
when 0 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 1 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Item.new
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 # formation
$game_system.se_play($data_system.cursor_se)
@command_window.index = -1
@command_window.active = false
@status_window.active = true
@status_window.index = @status_window.top_row
when 5 # data
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to monster book screen
$scene = Scene_Bestiary.new
when 6 # system
# Play decision SE
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@system_window.visible = true
@system_window.active = true
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # skill
# If this actor's action limit is 2 or more
if $game_party.actors[@status_window.index].restriction >= 2
# 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 skill screen
$scene = Scene_Skill.new(@status_window.index)
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to equipment screen
$scene = Scene_Equip.new(@status_window.index)
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to status screen
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when system window is active)
#--------------------------------------------------------------------------
def update_system
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@command_window.active = true
@system_window.active = false
@system_window.visible = false
@system_window.index = 0
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @system_window.index
when 0 # 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 1 # load
# Continue enabled determinant
# Check if at least one save file exists
# If enabled, make @continue_enabled true; if disabled, make it false
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
# If continue is disabled
unless @continue_enabled
# 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 load screen
$scene = Scene_MenuLoad.new
when 2 # return to title
$recent_items = []
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Switch to title screen
$scene = Scene_Title.new
when 3 # shutdown
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = nil
end
return
end
end
end
#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
# This class performs skill screen processing.
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.actors[@actor_index]
# Make help window, status window, and skill window
@help_window = Window_Help.new
@help_window.y = 416
@status_window = Window_SkillStatus.new(@actor)
@status_window.y = 0
@skill_window = Window_Skill.new(@actor)
@skill_window.y = 64
# Associate help window
@skill_window.help_window = @help_window
# Make target window (set to invisible / inactive)
@target_window = Window_TargetMenu.new
@target_window.visible = false
@target_window.active = false
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@status_window.dispose
@skill_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update (if skill window is active)
#--------------------------------------------------------------------------
def update_skill
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(0)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the skill window
@skill = @skill_window.skill
# If unable to use
if @skill == nil or not @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If effect scope is ally
if @skill.scope >= 3
# Activate target window
@skill_window.active = false
@target_window.x = (@skill_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# Set cursor position to effect scope (single / all)
if @skill.scope == 4 || @skill.scope == 6
@target_window.index = -1
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
# If effect scope is other than ally
else
# If common event ID is valid
if @skill.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Play use skill SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# Remake each window content
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# Switch to map screen
$scene = Scene_Map.new
return
end
end
return
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_Skill.new(@actor_index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_Skill.new(@actor_index)
return
end
end
end
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# This class performs item screen processing.
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make help window, item window
@help_window = Window_ItemHelp.new
@itemtop_window = Window_ItemTop.new
@help_windowback = Window_Blank.new(0, 416, 640, 64)
@help_window.y = 384
@item_window = Window_ItemMenu.new
@item_window.active = false
# Associate help window
@item_window.help_window = @help_window
# Make target window (set to active)
@category_window = Window_Category.new(440, ["1","2","3","4","5","6","7","8","9"])
@category_window.active = true
@category_window.help_window = @help_window
# Execute transition
# Make target window (set to invisible / inactive)
@target_window = Window_TargetMenu.new
@target_window.visible = false
@target_window.active = false
@item_window.repaint
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@item_window.dispose
@target_window.dispose
@help_windowback.dispose
@category_window.dispose
@itemtop_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@help_window.update
@item_window.update
@target_window.update
@help_windowback.update
@category_window.update
@itemtop_window.update
# If item window is active: call update_item
if @item_window.active
update_item
return
end
# If target window is active: call update_target
if @target_window.active
update_target
return
end
# If target window is active: call update_target
if @category_window.active
update_category
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
def update_item
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(1)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the item window
@item = @item_window.item
# If not a use item
unless @item.is_a?(RPG::Item)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If it can't be used
unless $game_party.item_can_use?(@item.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If effect scope is an ally
if @item.scope >= 3
# Activate target window
@item_window.active = false
@target_window.x = (@item_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# Set cursor position to effect scope (single / all)
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
# If effect scope is other than an ally
else
# If command event ID is valid
if @item.common_event_id > 0
# Command event call reservation
$game_temp.common_event_id = @item.common_event_id
# Play item use SE
$game_system.se_play(@item.menu_se)
# If consumable
if @item.consumable
# Decrease used items by 1
$game_party.lose_item(@item.id, 1)
# Draw item window item
@item_window.draw_item(@item_window.index)
end
# Switch to map screen
$scene = Scene_Map.new
return
end
end
return
end
# If UP button was pressed
if Input.trigger?(Input::UP) && @item_window.index == -1
# Set category window active
@item_window.active = false
@item_window.cat_select(true)
@category_window.active = true
#@item_window.index = 0
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
def update_target
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If unable to use because items ran out
unless $game_party.item_can_use?(@item.id)
# Remake item window contents
@item_window.refresh
end
# Erase target window
@item_window.active = true
@target_window.visible = false
@target_window.active = false
@item_window.repaint
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If items are used up
if $game_party.item_number(@item.id) == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If target is all
if @target_window.index == -1
# Apply item effects to entire party
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# If single target
if @target_window.index >= 0
# Apply item use effects to target actor
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
# If an item was used
if used
# Play item use SE
$game_system.se_play(@item.menu_se)
# If consumable
if @item.consumable
# Decrease used items by 1
$game_party.lose_item(@item.id, 1)
# Redraw item window item
@item_window.draw_items(@item_window.index)
end
# Remake target window contents
@target_window.refresh
# If all party members are dead
if $game_party.all_dead?
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If common event ID is valid
if @item.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @item.common_event_id
# Switch to map screen
$scene = Scene_Map.new
return
end
end
# If item wasn't used
unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when category window is active)
#--------------------------------------------------------------------------
def update_category
@item_window.category(@category_window.index)
@item_window.cat_select(true)
if Input.repeat? (Input::RIGHT) || Input.repeat? (Input::LEFT)
@item_window.repaint
end
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(1)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the item window
@item = @category_window.index
# Play decision SE
$game_system.se_play($data_system.decision_se)
return
end
# If DOWN button was pressed
if Input.trigger?(Input::DOWN)
# Set item window active
@item_window.active = true
@item_window.index = 0
@category_window.active = false
@item_window.cat_select(false)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
return
end
end
end
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs equipment screen processing.
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
# equip_index : equipment index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.actors[@actor_index]
# Make windows
@help_window = Window_EquipHelp.new
@status_window = Window_EquipStatus.new(@actor)
@right_window = Window_EquipRight.new(@actor)
@left_window = Window_EquipLeft.new(@actor)
@left_window.z = 210
@left_window.visible = false
@item_window1 = Window_EquipItem.new(@actor, 0)
@item_window2 = Window_EquipItem.new(@actor, 1)
@item_window3 = Window_EquipItem.new(@actor, 2)
@item_window4 = Window_EquipItem.new(@actor, 3)
@item_window5 = Window_EquipItem.new(@actor, 4)
# Associate help window
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
# Set cursor position
@right_window.index = @equip_index
refresh
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@status_window.dispose
@left_window.dispose
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Set item window to visible
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
# Get currently equipped item
item1 = @right_window.item
# Set current item window to @item_window
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
# If right window is active
if @right_window.active
# Erase parameters for after equipment change
@left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil, nil)
end
# If item window is active
if @item_window.active
# Get currently selected item
item2 = @item_window.item
# Change equipment
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
# Get parameters for after equipment change
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
new_str = @actor.str
new_dex = @actor.dex
new_agi = @actor.agi
new_int = @actor.int
new_maxhp = @actor.maxhp
new_maxsp = @actor.maxsp
# Return equipment
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# Draw in left window
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_maxhp, new_maxsp, new_str, new_dex, new_agi, new_int)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@status_window.update
# Update windows
@left_window.update
@right_window.update
@item_window.update
refresh
@left_window.visible = false
# If right window is active: call update_right
if @right_window.active
update_right
return
end
# If item window is active: call update_item
if @item_window.active
update_item
@left_window.visible = true
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when right window is active)
#--------------------------------------------------------------------------
def update_right
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(2)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If equipment is fixed
if @actor.equip_fix?(@right_window.index)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Activate item window
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different equipment screen
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different equipment screen
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
def update_item
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Activate right window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play equip SE
$game_system.se_play($data_system.equip_se)
# Get currently selected data on the item window
item = @item_window.item
# Change equipment
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
# Activate right window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# Remake right window and item window contents
@right_window.refresh
@item_window.refresh
return
end
end
end
#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
# This class performs load screen processing.
#==============================================================================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
def read_save_data(file)
# Read character data for drawing save file
characters = Marshal.load(file)
# Read frame count for measuring play time
Graphics.frame_count = Marshal.load(file)
# Read each type of game object
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$recent_items = Marshal.load(file)
# If magic number is different from when saving
# (if editing was added with editor)
if $game_system.magic_number != $data_system.magic_number
# Load map
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# Refresh party members
$game_party.refresh
end
end
#==============================================================================
# ** Scene_MenuLoad
#------------------------------------------------------------------------------
# This class performs load screen processing.
#==============================================================================
class Scene_MenuLoad < Scene_File
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Remake temporary object
$game_temp = Game_Temp.new
# Timestamp selects new file
$game_temp.last_file_index = 0
latest_time = Time.at(0)
for i in 0..3
filename = make_filename(i)
if FileTest.exist?(filename)
file = File.open(filename, "r")
if file.mtime > latest_time
latest_time = file.mtime
$game_temp.last_file_index = i
end
file.close
end
end
super("Which file would you like to load?")
end
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
# If file doesn't exist
unless FileTest.exist?(filename)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Make system object
$game_system = Game_System.new
# Play load SE
$game_system.se_play($data_system.load_se)
# Read save data
file = File.open(filename, "rb")
read_save_data(file)
file.close
# Restore BGM and BGS
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to title screen
$scene = Scene_Menu.new(6)
end
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
def read_save_data(file)
# Read character data for drawing save file
characters = Marshal.load(file)
# Read frame count for measuring play time
Graphics.frame_count = Marshal.load(file)
# Read each type of game object
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$recent_items = Marshal.load(file)
# If magic number is different from when saving
# (if editing was added with editor)
if $game_system.magic_number != $data_system.magic_number
# Load map
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# Refresh party members
$game_party.refresh
end
end
#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
# This class performs save screen processing.
#==============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
# Play save SE
$game_system.se_play($data_system.save_se)
# Write save data
file = File.open(filename, "wb")
write_save_data(file)
file.close
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to menu screen
$scene = Scene_Menu.new(6)
end
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to menu screen
$scene = Scene_Menu.new(6)
end
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
def write_save_data(file)
# Make character data for drawing save file
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
# Write character data for drawing save file
Marshal.dump(characters, file)
# Wrire frame count for measuring play time
Marshal.dump(Graphics.frame_count, file)
# Increase save count by 1
$game_system.save_count += 1
# Save magic number
# (A random value will be written each time saving with editor)
$game_system.magic_number = $data_system.magic_number
# Write each type of game object
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
Marshal.dump($recent_items, file)
end
end
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs title screen processing.
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# If battle test
if $BTEST
battle_test
return
end
# Load database
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
# Make system object
$game_system = Game_System.new
# Make the actor face variable
$change_face = Change_Face.new
# Make title graphic
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# Make command window
s1 = "New Game"
s2 = "Continue"
s3 = "Quit"
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
# Continue enabled determinant
# Check if at least one save file exists
# If enabled, make @continue_enabled true; if disabled, make it false
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
# If continue is enabled, move cursor to "Continue"
# If disabled, display "Continue" text in gray
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
# Play title BGM
$game_system.bgm_play($data_system.title_bgm)
# Stop playing ME and BGS
Audio.me_stop
Audio.bgs_stop
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of command window
@command_window.dispose
# Dispose of title graphic
@sprite.bitmap.dispose
@sprite.dispose
end
alias cms_cmdng_title command_new_game
def command_new_game
$recent_items = []
cms_cmdng_title
end
#--------------------------------------------------------------------------
# * Create the global variable that will hold the current map name
#--------------------------------------------------------------------------
$map_location = load_data("Data/MapInfos.rxdata")
for key in $map_location.keys
$map_location[key] = $map_location[key].name
end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles the map. It includes scrolling and passable determining
# functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Getting the Name of the Map
#--------------------------------------------------------------------------
def name
$map_location[@map_id]
end
end
#==============================================================================
# ** Change_Face
#------------------------------------------------------------------------------
# This class allows you to change an actors face throughout the game using
# a simple script.
#==============================================================================
class Change_Face
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@actor = []
@actor_face = []
# Load the actors data for every actor into @actors
for i in 1...$data_actors.size
@actor[i] = $data_actors[i]
end
# Set the actors face graphic file name to the name of the actor
for i in 1...$data_actors.size
@actor_face[i] = @actor[i].name
end
end
#--------------------------------------------------------------------------
# * New face graphic
# name : the name of the actor
# face : the name of the new face file
#--------------------------------------------------------------------------
def new(name, face)
for i in 1...@actor.size
if @actor[i].name == name
@actor_face[i] = face
end
end
end
#--------------------------------------------------------------------------
# * Face of the Actor
# id : the id of the actor
#--------------------------------------------------------------------------
def face(id)
return @actor_face[id]
end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Gain Items (or lose)
# item_id : item ID
# n : quantity
#--------------------------------------------------------------------------
def gain_item(item_id, n)
# Update quantity data in the hash.
if item_id > 0
@items[item_id] = [[item_number(item_id) + n, 0].max, 99].min
gain_recent_item(item_id) if n >= 0
end
end
#--------------------------------------------------------------------------
# * Gain Weapons (or lose)
# weapon_id : weapon ID
# n : quantity
#--------------------------------------------------------------------------
def gain_weapon(weapon_id, n)
# Update quantity data in the hash.
if weapon_id > 0
@weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
gain_recent_weapon(weapon_id) if n >= 0
end
end
#--------------------------------------------------------------------------
# * Gain Armor (or lose)
# armor_id : armor ID
# n : quantity
#--------------------------------------------------------------------------
def gain_armor(armor_id, n)
# Update quantity data in the hash.
if armor_id > 0
@armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
gain_recent_armor(armor_id) if n >= 0
end
end
#--------------------------------------------------------------------------
# * Lose Items
# item_id : item ID
# n : quantity
#--------------------------------------------------------------------------
def lose_item(item_id, n)
# Reverse the numerical value and call it gain_item
gain_item(item_id, -n)
for i in 0...$recent_items.size
if $game_party.item_number($recent_items[i].id) == 0 && $recent_items[i].is_a?(RPG::Item) && $recent_items[i].id == item_id
$recent_items.delete_at(i)
end
end
end
#--------------------------------------------------------------------------
# * Lose Weapons
# weapon_id : weapon ID
# n : quantity
#--------------------------------------------------------------------------
def lose_weapon(weapon_id, n)
# Reverse the numerical value and call it gain_weapon
gain_weapon(weapon_id, -n)
for i in 0...$recent_items.size
if $game_party.item_number($recent_items[i].id) == 0 && $recent_items[i].is_a?(RPG::Weapon) && $recent_items[i].id == weapon_id
$recent_items.delete_at(i)
end
end
end
#--------------------------------------------------------------------------
# * Lose Armor
# armor_id : armor ID
# n : quantity
#--------------------------------------------------------------------------
def lose_armor(armor_id, n)
# Reverse the numerical value and call it gain_armor
gain_armor(armor_id, -n)
if $game_party.item_number(armor_id) <= 0
for i in 0...$recent_items.size
if $game_party.item_number($recent_items[i].id) == 0 && $recent_items[i].is_a?(RPG::Armor) && $recent_items[i].id == armor_id
$recent_items.delete_at(i)
end
end
end
end
#--------------------------------------------------------------------------
# * Gain Recent Items
# item_id : item ID
#--------------------------------------------------------------------------
def gain_recent_item(item_id)
for i in 0...$recent_items.size
if $recent_items[i].id == $data_items[item_id].id && $recent_items[i].is_a?(RPG::Item)
$recent_items.delete_at(i)
end
end
$recent_items.push($data_items[item_id])
if $recent_items.size > 40
$recent_items.delete_at(0)
end
end
#--------------------------------------------------------------------------
# * Gain Recent Weapons
# weapon_id : weapon ID
#--------------------------------------------------------------------------
def gain_recent_weapon(weapon_id)
for i in 0...$recent_items.size
if $recent_items[i].id == $data_weapons[weapon_id].id && $recent_items[i].is_a?(RPG::Weapon)
$recent_items.delete_at(i)
end
end
$recent_items.push($data_weapons[weapon_id])
if $recent_items.size > 40
$recent_items.delete_at(0)
end
end
#--------------------------------------------------------------------------
# * Gain Recent Armor
# armor_id : armor ID
#--------------------------------------------------------------------------
def gain_recent_armor(armor_id)
for i in 0...$recent_items.size
if $recent_items[i].id == $data_armors[armor_id].id && $recent_items[i].is_a?(RPG::Armor)
$recent_items.delete_at(i)
end
end
$recent_items.push($data_armors[armor_id])
if $recent_items.size > 40
$recent_items.delete_at(0)
end
end
#--------------------------------------------------------------------------
# * Gain Items (or lose)
# item_id : item ID
# n : quantity
#--------------------------------------------------------------------------
def equip_item(item_id, n)
# Update quantity data in the hash.
if item_id > 0
@items[item_id] = [[item_number(item_id) + n, 0].max, 99].min
end
end
#--------------------------------------------------------------------------
# * Gain Weapons (or lose)
# weapon_id : weapon ID
# n : quantity
#--------------------------------------------------------------------------
def equip_weapon(weapon_id, n)
# Update quantity data in the hash.
if weapon_id > 0
@weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
end
end
#--------------------------------------------------------------------------
# * Gain Armor (or lose)
# armor_id : armor ID
# n : quantity
#--------------------------------------------------------------------------
def equip_armor(armor_id, n)
# Update quantity data in the hash.
if armor_id > 0
@armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
end
end
end
class Game_Actor
#--------------------------------------------------------------------------
# * Change Equipment
# equip_type : type of equipment
# id : weapon or armor ID (If 0, remove equipment)
#--------------------------------------------------------------------------
def equip(equip_type, id)
case equip_type
when 0 # Weapon
if id == 0 or $game_party.weapon_number(id) > 0
$game_party.equip_weapon(@weapon_id, 1)
@weapon_id = id
$game_party.lose_weapon(id, 1)
end
when 1 # Shield
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor1_id], $data_armors[id])
$game_party.equip_armor(@armor1_id, 1)
@armor1_id = id
$game_party.lose_armor(id, 1)
end
when 2 # Head
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor2_id], $data_armors[id])
$game_party.equip_armor(@armor2_id, 1)
@armor2_id = id
$game_party.lose_armor(id, 1)
end
when 3 # Body
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor3_id], $data_armors[id])
$game_party.equip_armor(@armor3_id, 1)
@armor3_id = id
$game_party.lose_armor(id, 1)
end
when 4 # Accessory
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor4_id], $data_armors[id])
$game_party.equip_armor(@armor4_id, 1)
@armor4_id = id
$game_party.lose_armor(id, 1)
end
end
end
end
#==============================================================================
# ** Arrow_Actor
#------------------------------------------------------------------------------
# This arrow cursor is used to choose an actor. This class inherits from the
# Arrow_Base class.
#==============================================================================
class Arrow_Actor < Arrow_Base
#--------------------------------------------------------------------------
# * Get Actor Indicated by Cursor
#--------------------------------------------------------------------------
def actor
return $game_party.actors[@index]
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# Cursor right
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@index += 1
if $game_party.actors.size <= 4
@index %= $game_party.actors.size
else
@index %= 4
end
end
# Cursor left
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
if $game_party.actors.size <= 4
@index += $game_party.actors.size - 1
@index %= $game_party.actors.size
else
@index += 3
@index %= 4
end
end
# Set sprite coordinates
if self.actor != nil
self.x = self.actor.screen_x
self.y = self.actor.screen_y
end
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
# Display actor status in help window
@help_window.set_actor(self.actor)
end
end
I'm having a problem with a menu script. It seems I get to a part in my project near the beginning where the actor finds a new helm. Once you change the helm to the new helm, and go into the item menu you get this error:
I am completly dreadful when it comes to scripting so i have no idea what the error is or means D:
I probs need to post the script eh?
any help here would be hot D:
Edited by RamenuzumakiShare this post
Link to post
Share on other sites