Simple Formation Menu
By: FamilyGamer7
By: FamilyGamer7
Introduction
Features
Screenshot(s)
Script
Ruby:
#==============================================================================
# Title: Simple Formation Menu
# Author: FamilyGamer7 (FG7)
# Version: 1.0
# Engine: RPG Maker VX Ace
#==============================================================================
# ** Change Log |
# ---------------
# 1.0 => Created Script
#==============================================================================
# ** Description |
# ----------------
# A simple way to make the formation it's own scene and with unique formatting.
#==============================================================================
# ** Terms of Use |
# -----------------
# * Free to use in non-commercial projects and commercial projects
# * Feel free to modify and improve the script. Credit is still required.
# * Credit FamilyGamer7
#==============================================================================
# ** Usage |
# ---------
# Plug & Play (With some customization in module section)
#
# -----------------------------------------------------------------------------
#
# For the module section, you can use a value like "30" or "-30" which is to
# add/subtract to the existing "x" coordinate placement of the scene. The same
# applies for the "y" coordinate placement. See examples below.
#
# - Ex: Scene_X_Horizontal = 30 - moves everything to the right
# - Ex: Scene_X_Horizontal = -30 - moves everything to the left
#
# - Ex: Scene_Y_Vertical = 30 - moves everything to the bottom
# - Ex: Scene_Y_Vertical = -30 - moves everything to the top
#==============================================================================
# ** Important Note |
# ------------------
# This script only supports up to 6 actors at a time to function properly.
#==============================================================================
#==============================================================================
# ** Module: FG7::Simple_Formation_Menu
#------------------------------------------------------------------------------
# This modules creates a static variable to be used within the script.
#==============================================================================
module FG7
module Simple_Formation_Menu
#==============================================================================
# -------------------- ALLOWED TO EDIT BELOW THIS LINE ---------------------- #
#==============================================================================
# Sets the value to change the "x" coordinates of the formation scene.
# (This is needed if screen is resized higher - For flexibility)
Scene_X_Horizontal = 0
# Sets the value to change the "y" coordinates of the formation scene.
# (This is needed if screen is resized higher - For flexibility)
Scene_Y_Vertical = 0
#==============================================================================
# ---------- DO NOT EDIT BELOW THIS LINE (FOR ADVANCED USERS) --------------- #
#==============================================================================
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This is a super class of all windows within the game.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * New Method: Draw Simple Status [Formation]
#--------------------------------------------------------------------------
def draw_actor_formation_status(actor, x, y)
draw_actor_name(actor, x, y - 5)
draw_actor_level(actor, x, y - 14 + line_height * 2.2)
draw_actor_icons(actor, x + 122, y + line_height * 1 - 37)
draw_actor_hp(actor, x, y - 9 + line_height * 1)
end
end
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Added Method: Object Initialization
#--------------------------------------------------------------------------
alias :fg7_simple_formation_menu_initialize :initialize
def initialize(x, y)
fg7_simple_formation_menu_initialize(x, y)
# Set window opacity to "0" if on Formation scene
self.opacity = 0 if SceneManager.scene_is?(Scene_Formation)
end
#--------------------------------------------------------------------------
# * Added/Override Method: Get Rectangle for Drawing Items
#--------------------------------------------------------------------------
def item_rect(index)
# Checks if on the Formation scene - draw new rect placement
if SceneManager.scene_is?(Scene_Formation)
rect = Rect.new
rect.width = 135
rect.height = 67
rect.x = index % col_max * (item_width + spacing)
rect.y = 106 + index / col_max * item_height
rect
# Since not on Formation scene - draw original rect placement.
else
rect = Rect.new
rect.width = item_width
rect.height = item_height
rect.x = index % col_max * (item_width + spacing)
rect.y = index / col_max * item_height
rect
end
end
#--------------------------------------------------------------------------
# * Alias Method: Get Column Max
#--------------------------------------------------------------------------
alias :fg7_simple_formation_menu_col_max :col_max
def col_max
return 3 if SceneManager.scene_is?(Scene_Formation)
fg7_simple_formation_menu_col_max
end
#--------------------------------------------------------------------------
# * Alias Method: Get Window Width
#--------------------------------------------------------------------------
alias :fg7_simple_formation_menu_window_width :window_width
def window_width
return 620 if SceneManager.scene_is?(Scene_Formation)
fg7_simple_formation_menu_window_width
end
#--------------------------------------------------------------------------
# * Alias Method: Get Window Height
#--------------------------------------------------------------------------
alias :fg7_simple_formation_menu_window_height :window_height
def window_height
return Graphics.height + 300 if SceneManager.scene_is?(Scene_Formation)
fg7_simple_formation_menu_window_height
end
#--------------------------------------------------------------------------
# * Alias Method: Get Number of Items
#--------------------------------------------------------------------------
alias :fg7_simple_formation_menu_item_max :item_max
def item_max
return 6 if SceneManager.scene_is?(Scene_Formation)
fg7_simple_formation_menu_item_max
end
#--------------------------------------------------------------------------
# * Alias Method: Get Item Height
#--------------------------------------------------------------------------
alias :fg7_simple_formation_menu_item_height :item_height
def item_height
return 188 if SceneManager.scene_is?(Scene_Formation)
fg7_simple_formation_menu_item_height
end
#--------------------------------------------------------------------------
# * Alias Method: Get Item Width
#--------------------------------------------------------------------------
alias :fg7_simple_formation_menu_item_width :item_width
def item_width
return 140 if SceneManager.scene_is?(Scene_Formation)
fg7_simple_formation_menu_item_width
end
#--------------------------------------------------------------------------
# * Override Method: Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
# Checks if on the Formation scene - draw new placement
if SceneManager.scene_is?(Scene_Formation)
actor = $game_party.members[index]
enabled = $game_party.battle_members.include?(actor)
rect = item_rect(index)
draw_item_background(index)
draw_actor_face(actor, rect.x + 7, rect.y - 110 + line_height / 2)
draw_actor_formation_status(actor, rect.x + 5, rect.y - 7 + line_height / 2)
# Since not on Formation scene - draw original placement.
else
actor = $game_party.members[index]
enabled = $game_party.battle_members.include?(actor)
rect = item_rect(index)
draw_item_background(index)
draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)
draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
end
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# * Override Method: [Formation] Command
#--------------------------------------------------------------------------
def command_formation
# Calls the new Formation scene
SceneManager.call(Scene_Formation)
end
end
#==============================================================================
# ** Scene_Formation
#------------------------------------------------------------------------------
# This class performs the item screen processing.
#==============================================================================
class Scene_Formation < Scene_MenuBase
#--------------------------------------------------------------------------
# * New Method: Start Processing
#--------------------------------------------------------------------------
def start
super
create_menustatus_bg_partymember1
create_menustatus_bg_partymember2
create_menustatus_bg_partymember3
create_menustatus_bg_partymember4
create_menustatus_bg_partymember5
create_menustatus_bg_partymember6
create_status_window
end
#--------------------------------------------------------------------------
# * Added/Edited Method: Create Status Window
#--------------------------------------------------------------------------
def create_status_window
x = 21 + FG7::Simple_Formation_Menu::Scene_X_Horizontal
y = 9 + FG7::Simple_Formation_Menu::Scene_Y_Vertical
@status_window = Window_MenuStatus.new(x, y)
@status_window.select_last
@status_window.activate
@status_window.set_handler(:ok, method(:on_formation_ok))
@status_window.set_handler(:cancel, method(:on_formation_cancel))
end
#--------------------------------------------------------------------------
# * New Method: Create MenuStatus Party Member 1 Background Window (Formation)
#--------------------------------------------------------------------------
def create_menustatus_bg_partymember1
x = 24 + FG7::Simple_Formation_Menu::Scene_X_Horizontal
y = 118 + FG7::Simple_Formation_Menu::Scene_Y_Vertical
@menustatus_bg_window_partymember1 = Window_Base.new(x, y, 153, 85)
end
#--------------------------------------------------------------------------
# * New Method: Create MenuStatus Party Member 2 Background Window (Formation)
#--------------------------------------------------------------------------
def create_menustatus_bg_partymember2
x = 196 + FG7::Simple_Formation_Menu::Scene_X_Horizontal
y = 118 + FG7::Simple_Formation_Menu::Scene_Y_Vertical
@menustatus_bg_window_partymember2 = Window_Base.new(x, y, 153, 85)
end
#--------------------------------------------------------------------------
# * New Method: Create MenuStatus Party Member 3 Background Window (Formation)
#--------------------------------------------------------------------------
def create_menustatus_bg_partymember3
x = 368 + FG7::Simple_Formation_Menu::Scene_X_Horizontal
y = 118 + FG7::Simple_Formation_Menu::Scene_Y_Vertical
@menustatus_bg_window_partymember3 = Window_Base.new(x, y, 153, 85)
end
#--------------------------------------------------------------------------
# * New Method: Create MenuStatus Party Member 4 Background Window (Formation)
#--------------------------------------------------------------------------
def create_menustatus_bg_partymember4
x = 24 + FG7::Simple_Formation_Menu::Scene_X_Horizontal
y = 306 + FG7::Simple_Formation_Menu::Scene_Y_Vertical
@menustatus_bg_window_partymember4 = Window_Base.new(x, y, 153, 85)
end
#--------------------------------------------------------------------------
# * New Method: Create MenuStatus Party Member 5 Background Window (Formation)
#--------------------------------------------------------------------------
def create_menustatus_bg_partymember5
x = 196 + FG7::Simple_Formation_Menu::Scene_X_Horizontal
y = 306 + FG7::Simple_Formation_Menu::Scene_Y_Vertical
@menustatus_bg_window_partymember5 = Window_Base.new(x, y, 153, 85)
end
#--------------------------------------------------------------------------
# * New Method: Create MenuStatus Party Member 6 Background Window (Formation)
#--------------------------------------------------------------------------
def create_menustatus_bg_partymember6
x = 368 + FG7::Simple_Formation_Menu::Scene_X_Horizontal
y = 306 + FG7::Simple_Formation_Menu::Scene_Y_Vertical
@menustatus_bg_window_partymember6 = Window_Base.new(x, y, 153, 85)
end
#--------------------------------------------------------------------------
# * Added Method: Formation [OK]
#--------------------------------------------------------------------------
def on_formation_ok
if @status_window.pending_index >= 0
$game_party.swap_order(@status_window.index,
@status_window.pending_index)
@status_window.pending_index = -1
@status_window.redraw_item(@status_window.index)
@status_window.refresh
else
@status_window.pending_index = @status_window.index
end
@status_window.activate
end
#--------------------------------------------------------------------------
# * Added Method: Formation [Cancel]
#--------------------------------------------------------------------------
def on_formation_cancel
if @status_window.pending_index >= 0
@status_window.pending_index = -1
@status_window.activate
else
SceneManager.return
end
end
end
How to Use
Terms of Use