Menu Phantasia

Embed Size (px)

Citation preview

  • 8/6/2019 Menu Phantasia

    1/16

    #==============================================================================# Phantasia-esque CMS# Version: 1.0# Author: modern algebra (rmrk.net)# Date: October 6, 2009#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# Description:

    ## This script gives you a menu design that is inspired by a mix between# Tales of Phantasia and my own Full Status CMS. Like Tales of Phantasia,# each actor gets their own window and their sprite is shown walking in the# top right corner. Like FSCMS, the command window and optional windows are# hugely customizable, allowing you to relatively easily add new scripts to# be accessible from the menu (with an automatic index finder so that you# don't need to modify the return_scene methods of the respective scripts# that you add to the menu), call common events from the menu (including# the ability to select an actor and have your common event operate only on# the actor chosen) and you can use any of the five optional windows that# are in the FSCMS - Location, Playtime, Gold, Steps, and Variable.

    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# Instructions:## Place this script below any scripts you intend to add to the menu, but# still above Main.## Please see Editable Region A at line 58 for configuration options and see# Editable Region B at line 107 for instructions on adding scenes (or common# events) to the menu and other configuration options.## Note that you can alter the composition of the menu or the optional# windows in-game with the following script calls:#

    # add_custom_command (command_id)# remove_custom_command (command_id)# command_id : ID of the command being added/removed from the commands# These are defined by you - see Editable Region B at line 107# add_optional_window (window_id)# remove_optional_window (window_id)# window_id : ID of the window being added/removed from the menu# 0 => Gold Window :shows amount of party gold# 1 => PlayTime Window :shows current playtime# 2 => Steps Window :shows number of steps party has taken# 3 => Location Window :shows name of the current map# 4 => Variable Window :shows the value of a designated variable

    #==============================================================================

    #==============================================================================# *** Phantasia CMS#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# This module holds configuration data for Phantasia CMS#==============================================================================

    module Phantasia_CMS#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# ** CONSTANTS#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

    # EDITABLE REGION A#``````````````````````````````````````````````````````````````````````````# Here is where all configuration data is setup. Please read the comments

  • 8/6/2019 Menu Phantasia

    2/16

    # adjacent to each comment to discover what it does.## SPRITE_X_ and SPRITE_Y_POSITION constants determine the position of the# sprites as they appear in the menu. Default of 0, 0, they will be placed# at -32, 64 in reference to the upper right corner of their box. They will# need to be altered when using larger sprites than RTPSPRITE_X_OFFSET = 0

    SPRITE_Y_OFFSET = 0# The number of frames before the sprites in the menu change direction.# 60 Frames = 1 secondSPRITE_DIRECTION_FRAMES = 60# Each of the following color options refer to the windowskin palette.# So 0 is normal_color, 16 is system_color, etc.. You can use any of the# colours from the palette, from 0 - 31. If you wish to set it directly by# rgb values, then you can use an array like [red, green, blue].EXP_BAR_COLOR1 = 28 # First Gradient ShadeEXP_BAR_COLOR2 = 29 # Second Gradient ShadeACTOR_NAME_COLOR = 16 # The color of the name of the actor in the menuVOCAB_EXP = "EXP" # The vocabulary for representing Experience

    # If you wish to use an image for your background in the menu rather than# the default blur and darken effect, place the image you want to use in# your System folder and put its name between quotes. If you do not wish to# use this feature, leave it as "" and it will default to blur and darken.MENU_BACKDROP = ""# Boolean on whether to show the windows even when the party is less than# 4 members. When true, all four windows will always be shown, but where you# are missing an actor it will be blank. When false, only windows for which# there is an actor will be shown.EMPTY_WINDOWS_SHOWN = false# For common event commands that require actor selection, this is the ID of# the variable that will hold the chosen actor's ID.CE_ACTOR_VARIABLE_ID = 1

    # If you decide to show a Variable optional window, this is the ID of the# variable that will be shown in the menu.VARWINDOW_VARIABLE_ID = 3# Optional Window Icons. For all icons, # -1 => no icon. >0 => icon indexVARWINDOW_VARIABLE_ICON = 141 # Icon of variable windowGOLD_ICON = 2644 # Icon of gold windowPLAYTIME_ICON = 11480 # Icon of playtime windowSTEPS_ICON = 48 # Icon of steps windowLOCATION_ICON = 10773 # Icon of location window## END EDITABLE REGION A#//////////////////////////////////////////////////////////////////////////CUSTOM_COMMANDS = {#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\# EDITABLE REGION B#``````````````````````````````````````````````````````````````````````````# This is where you can configure the initial composition of the menu;# the order of optional windows, the order of the command list, and setting# up commands that can be included in the command list - all of that is# done here.## Command Setup# Inspired by Yanfly's Scene Menu Redux## Each command can be set up in the following format:

    ## CommandID => ["Name", IconID, DisableCondition, ActorSelect?,# SceneName, SceneArguments],

  • 8/6/2019 Menu Phantasia

    3/16

    ## CommandID : this is the ID that this command is represented by. It is# used in denoting the order in which it appears in the command list# at line 194. This MUST be unique for each command# Name : This is how the command appears in the list. If it is represented# by a method or value included in Vocab, then you can input its# call. Otherwise, write it exactly as it should appear.

    # IconID : The ID of the icon that will appear next to the name of the# command in the command window.# DisableCondition : if this is put as a string, it will evaluate the# string as code and use it's an integer, then the command will be# disabled if the switch with that ID is ON. If it is a string, it# will evaluate the string as code. This is useful for scripts that# have disable conditions updated through event-inaccessible booleans.# If this is set to -1, it will never be disabled# ActorSelect? : Truth value of whether or not actor should be selected.# If true, the first argument sent to the scene will always be# @target_window.index. If true when the command calls a common event,# then the ID of the actor chosen will be saved to a variable as

    # designated by CE_ACTOR_VARIABLE_ID at line 78# SceneName : This is the class name of the scene being called once this# command is selected. You MUST know this data from whatever script you# are trying to add. If you want this command to call a common event,# place the ID of the catalogue you wish to call instead. If there is# more than one command that calls the same scene, then there will# need to be some manual index setting when returning to the menu# from that scene.# SceneArguments : a String of the arguments to be passed to the scene# when it is called. This too must be known from the script you are# trying to add.## Note that the comma after the last square bracket must be excluded if you

    # are not adding any more commands after it. If you receive a syntax error# after configuring this script, then it is likely a missing comma or bracket# or, as noted, there is a comma after the last command.# Be sure to check your commas before reporting the error.## EXAMPLE 1:## 7 => ["Quests", 178, "$game_system.quest_disabled $game_party.quests.l

    ist.empty?",# false, Scene_Quest, "1"],## This will create a command called Quests that is represented by the# icon with index 178. It does not require actor selection and calls:# $scene = Scene_Quest.new (1)# when selected. The option is disabled if:# $game_system.quest_disabled $game_party.quests.list.empty?# returns true. It's ID is 7, so when setting up your command list, this# command will show up wherever you set 7 in the list## EXAMPLE 2:## 15 => ["Vocab::escape", 134, 5, false, 4]# }## This will create a command that is called whatever you have labelled

    # the escape option in the Terms section of the database. It is# represented by the icon with index 134. It is disabled if the switch# with ID 5 is ON; it does not require actor selection, and it calls

  • 8/6/2019 Menu Phantasia

    4/16

    # the common event with ID 40 => ["Vocab::item", 2246, "$game_party.members.empty?", false, Scene_Item],1 => ["Vocab::skill", 2248, "$game_party.members.empty?", true, Scene_Skill]

    ,2 => ["Vocab::equip", 2247, "$game_party.members.empty?", true, Scene_Equip]

    ,3 => ["Vocab::status", 2249, "$game_party.members.empty?", true, Scene_Statu

    s],4 => ["Vocab::save", 2250, "$game_system.save_disabled", false, Scene_File,

    "true, false, false"],5 => ["Vocab::game_end", 2251, -1, false, Scene_End],

    }# This is where you setup the order that commands appear in the command# window of the menu. List them by their command ID, as it is explained# above. The default commands are:# 0 => Item# 1 => Skill# 2 => Equip# 3 => Status

    # 4 => Save# 5 => End Game# Those can be changed by you above, if you desire, and you can always add# more commands with whatever IDs you want. Note, however, that those# command IDs must appear in the array below or they will NOT appear in the# initial menu. This array can be modified in-game by the following script# calls:## add_custom_command (command_id)# remove_custom_command (command_id)# command_id : ID of the command being added/removed from the commandsCOMMANDLIST = [0, 1, 2, 3, 4, 5]# Which optional windows ought to be created, from bottom to top?

    # 0 => Gold Window# 1 => PlayTime Window# 2 => Steps Window# 3 => Location Window# 4 => Variable Window# This array can be modified in-game by the following script calls:## add_optional_window (window_id)# remove_optional_window (window_id)# window_id : ID of the window being added/removed from the menuOPTIONAL_WINDOWS = [0, 1, 3]## END EDITABLE REGION B#//////////////////////////////////////////////////////////////////////////

    end

    #==============================================================================# ** Game System#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# Summary of Changes:# new instance variables - phancms_custom_commands, phancms_optional_windows# aliased method - initialize#==============================================================================

    class Game_System

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Public Instance Variables#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  • 8/6/2019 Menu Phantasia

    5/16

    attr_reader :tpcms_command_list # Holds current array of commands in menuattr_reader :tpcms_optional_windows # Holds current array of optional windows#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Object Initialization#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~alias ma_phancms_intz_cstmcmmns_6hj2 initializedef initialize (*args)

    # Initialize new variables@tpcms_command_list = Phantasia_CMS::COMMANDLIST@tpcms_optional_windows = Phantasia_CMS::OPTIONAL_WINDOWSma_phancms_intz_cstmcmmns_6hj2 (*args) # Run Original Method

    endend

    #==============================================================================# ** Game Actor#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# Summary of Changes:# new method - get_exp_progress

    #==============================================================================

    class Game_Actor#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Get Exp Progress#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def exp_progressreturn @exp - @exp_list[@level]

    endend

    #==============================================================================# ** Game Interpreter

    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# Summary of Changes:# new methods - add_custom_command; add_optional_window;# remove_custom_command; remove_optional_window#==============================================================================

    class Game_Interpreter#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Custom Commands Add/Remove# id : Command ID to add or remove#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def add_custom_command (id)$game_system.tpcms_command_list.push (id) unless $game_system.tpcms_command_

    list.include? (id)enddef remove_custom_command (id)$game_system.tpcms_command_list.delete (id)

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Optional Windows Add/Remove# id : window ID to add or remove#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def add_optional_window (id)$game_system.tpcms_optional_windows.push (id) unless $game_system.tpcms_opti

    onal_windows.include? (id)

    enddef remove_optional_window (id)$game_system.tpcms_optional_windows.delete (id)

  • 8/6/2019 Menu Phantasia

    6/16

    endend

    #==============================================================================# ** Sprite_MenuActor#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# This window displays the walking sprite of an actor.

    #==============================================================================

    class Sprite_MenuActor < Sprite_Character#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Object Initialization#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def initialize (party_id, x, y, viewport = nil)actor = $game_party.members[party_id]character = Game_Character.new@frame_count = 0character.set_graphic (actor.character_name, actor.character_index)super (viewport, character)

    self.x, self.y, self.z = x, y, 200case party_idwhen 1 then @character.turn_leftwhen 2 then @character.turn_upwhen 3 then @character.turn_rightendupdate_bitmapupdate

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Frame Update#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def update

    # Turn at user-specified intervalsif @frame_count == Phantasia_CMS::[email protected]_right_90@frame_count = 0

    [email protected][email protected]_animationupdate_src_rect@frame_count += 1

    endend

    #==============================================================================# ** Window_Gold#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# Summary of Changes:# overwritten super method - draw_currency_value#==============================================================================

    class Window_Gold#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Draw Currency Value# value : amount to draw# x, y : coordinates to draw at# width : amount of room to draw

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def draw_currency_value (value, x, y, width, *args)if Phantasia_CMS::GOLD_ICON >= 0

  • 8/6/2019 Menu Phantasia

    7/16

    draw_icon (Phantasia_CMS::GOLD_ICON, x, y)x += 24width -= 24

    end# Run Original Methodsuper (value, x, y, width, *args)

    end

    end

    #==============================================================================# ** Window_TPCMS_MenuActor#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# This window displays basic status information on a party member.#==============================================================================

    class Window_TPCMS_MenuActor < Window_Base#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Object Initialization#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    def initialize (party_id)@party_id = party_id@naming = falsewidth, height = (Graphics.width - 160) / 2, (Graphics.height / 2)x = (party_id % 2)*(width + 160)y = (party_id / 2)*heightsuper (x, y, width, height)refresh

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Dispose#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def dispose

    @actor_sprite.dispose unless @actor_sprite.nil? @actor_sprite.disposed?super

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Frame Update#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def update@actor_sprite.update unless @actor_sprite.nil? @actor_sprite.disposed?super

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Create Sprite#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def create_sprite@actor_sprite.dispose unless @actor_sprite.nil? @actor_sprite.disposed?sprite_x = self.x + self.width - 32 + Phantasia_CMS::SPRITE_X_OFFSETsprite_y = self.y + 64 + Phantasia_CMS::SPRITE_Y_OFFSET@actor_sprite = Sprite_MenuActor.new (@party_id, sprite_x, sprite_y)

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Refresh#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def refreshself.contents.clearreturn if @party_id >= $game_party.members.size

    create_spriteactor = $game_party.members[@party_id]# Draw Actor Stuff

  • 8/6/2019 Menu Phantasia

    8/16

    @naming = truedraw_actor_name(actor, 0, 0)@naming = falsedraw_actor_class(actor, 0, WLH)if contents.height / WLH < 7# Only Draw Leveldraw_actor_level(actor, 0, WLH * 2)

    y = [WLH*3, contents.height - WLH*3].maxelsey = (contents.height - 3*WLH) / 2draw_actor_level(actor, 0, y)draw_actor_exp (actor, 0, y + WLH, contents.width)y *= 2

    enddraw_actor_state(actor, 0, y, contents.width)draw_actor_hp(actor, 0, y + WLH, contents.width)draw_actor_mp(actor, 0, y + WLH*2, contents.width)

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    # * Normal Color#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def normal_colorif @namingif Phantasia_CMS::ACTOR_NAME_COLOR.is_a? (Fixnum)return text_color (Phantasia_CMS::ACTOR_NAME_COLOR)

    elsereturn Color.new (*Phantasia_CMS::ACTOR_NAME_COLOR)

    endendreturn super

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    # * Draw Actor EXP# actor : the actor to draw exp of# x, y : coordinates to start drawing# width : the total width of guage#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def draw_actor_exp (actor, x, y, width = 120)draw_actor_exp_gauge(actor, x, y, width)self.contents.font.color = system_colortw = contents.text_size (Phantasia_CMS::VOCAB_EXP).widthself.contents.draw_text(x, y, tw, WLH, Phantasia_CMS::VOCAB_EXP)self.contents.font.color = normal_colorxr = x + widthroom = width - twtw = contents.text_size (actor.next_exp_s).widthd_room = (room - 11) / 2if tw > d_roomself.contents.draw_text(xr - room, y, room, WLH, actor.exp_s, 2)

    elseself.contents.draw_text(xr - room, y, d_room, WLH, actor.exp_s, 2)self.contents.draw_text(xr - room + d_room, y, 11, WLH, "/", 2)self.contents.draw_text(xr - d_room, y, d_room, WLH, actor.next_exp_s, 2)

    endend#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Draw Actor EXP Gauge

    # actor : the actor to draw exp of# x, y : coordinates to start drawing# width : the total width of guage

  • 8/6/2019 Menu Phantasia

    9/16

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def draw_actor_exp_gauge (actor, x, y, width = 120)gw = width * actor.exp_progress / actor.next_rest_exp_s.to_i# Get colorsif Phantasia_CMS::EXP_BAR_COLOR1.is_a? (Fixnum)gc1 = text_color (Phantasia_CMS::EXP_BAR_COLOR1)

    else

    gc1 = Color.new (*Phantasia_CMS::EXP_BAR_COLOR1)endif Phantasia_CMS::EXP_BAR_COLOR2.is_a? (Fixnum)gc2 = text_color (Phantasia_CMS::EXP_BAR_COLOR2)

    elsegc2 = Color.new (*Phantasia_CMS::EXP_BAR_COLOR2)

    endself.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)

    endend

    #==============================================================================# ** Window_TPCMS_Target#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# This window is a transparent window used for cursor purposes#==============================================================================

    class Window_TPCMS_Target < Window_Selectable#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Object Initialization#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def initializesuper(-16, -16, Graphics.width + 32, Graphics.height + 32, 160)@item_max = $game_party.members.size

    @column_max = 2self.active = falseself.opacity = 0self.z = 250

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Item Rect# index : item number (actor)#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def item_rect (index)rect = super (index)rect.height = contents.height / 2rect.y = (index / @column_max) * rect.heightreturn rect

    endend

    #==============================================================================# ** Window_MenuCommand#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# This window shows commands in the menu# overwritten super methods - draw_item#==============================================================================

    class Window_TPCMS_MenuCommand < Window_Command

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Object Initialization#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  • 8/6/2019 Menu Phantasia

    10/16

    def initialize(*args)super (*args)max_height = Graphics.height - ($game_system.tpcms_optional_windows.size*(WL

    H + 32))if self.height > max_heightself.height = max_heightcreate_contents

    refreshend

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Draw Item#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def draw_item (i, enabled = true)rect = item_rect(i)self.contents.clear_rect(rect)# Draw iconicon = Phantasia_CMS::CUSTOM_COMMANDS[$game_system.tpcms_command_list[i]][1]draw_icon (icon, rect.x + 2, rect.y, enabled)

    rect.x += 28rect.width -= 32self.contents.font.color = normal_colorself.contents.font.color.alpha = enabled ? 255 : 128self.contents.draw_text(rect, @commands[i])

    endend

    #==============================================================================# ** Window Location#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# This window shows the current location#==============================================================================

    class Window_TPCMS_Location < Window_Base#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Object Initialization#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def initialize (x, y)height = 32 + WLHy -= heightsuper (x, y, 160, height)x, tw = 0, contents.widthif Phantasia_CMS::LOCATION_ICON >= 0draw_icon (Phantasia_CMS::LOCATION_ICON, x, 0)x += 24tw -= 24

    endmap_name = load_data ("Data/MapInfos.rvdata")[$game_map.map_id].namecontents.font.color = normal_colorcontents.draw_text (x, 0, tw, WLH, map_name, 2)

    endend

    #==============================================================================# ** Window PlayTime#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# This window shows total playtime

    #==============================================================================

    class Window_TPCMS_PlayTime < Window_Base

  • 8/6/2019 Menu Phantasia

    11/16

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Object Initialization#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def initialize (x, y)super (x, y, 160, 32 + WLH)refresh

    end

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Refresh#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def refreshself.contents.clearx, tw = 0, contents.widthif Phantasia_CMS::PLAYTIME_ICON >= 0draw_icon (Phantasia_CMS::PLAYTIME_ICON, x, 0)x += 24tw -= 24

    end@total_sec = Graphics.frame_count / Graphics.frame_rate

    hour = @total_sec / 60 / 60min = @total_sec / 60 % 60sec = @total_sec % 60text = sprintf("%02d:%02d:%02d", hour, min, sec)self.contents.font.color = normal_colorself.contents.draw_text(x, 0, tw, WLH, text, 2)

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Frame Update#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def updatesuperif Graphics.frame_count / Graphics.frame_rate != @total_sec

    refreshend

    endend

    #==============================================================================# ** Window StepCount#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# This window shows total number of steps party has taken#==============================================================================

    class Window_TPCMS_StepCount < Window_Base#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Object Initialization#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def initialize (x, y)super (x, y, 160, 32 + WLH)x, tw = 0, contents.width# Draw step count iconif Phantasia_CMS::STEPS_ICON >= 0draw_icon (Phantasia_CMS::STEPS_ICON, x, 0)x += 24tw -= 24

    end# Draw Step Count

    contents.font.color = normal_colorcontents.draw_text (x, 0, tw, WLH, $game_party.steps.to_s, 2)

    end

  • 8/6/2019 Menu Phantasia

    12/16

    end

    #==============================================================================# ** Window Variable#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# This window shows the value of a specified variable#==============================================================================

    class Window_TPCMS_Variable < Window_Base#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Object Initialization#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def initialize (x, y)super (x, y, 160, 32 + WLH)refresh

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Refresh#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    def refreshx, tw = 0, contents.width# Draw varibale iconif Phantasia_CMS::VARWINDOW_VARIABLE_ICON >= 0draw_icon (Phantasia_CMS::VARWINDOW_VARIABLE_ICON, x, 0)x += 24tw -= 24

    end# Draw Variabletext = $game_variables[Phantasia_CMS::VARWINDOW_VARIABLE_ID].to_scontents.font.color = normal_colorcontents.draw_text (x, 0, tw, WLH, text, 2)

    end

    end

    #==============================================================================# ** Scene_Menu#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# Summary of Changes:# completely overwritten class#==============================================================================

    class Scene_Menu < Scene_Base#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Object Initialization# menu_index : command cursor's initial position#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def initialize(menu_index = 0, manual = false)if manual@menu_index = menu_indexreturn

    elsif $scene.is_a? (Scene_Map)@menu_index = 0return

    end# Check where it is coming from.$game_system.tpcms_command_list.each_index { ij = $game_system.tpcms_command_list[i]

    # If coming from this designated scenenext if Phantasia_CMS::CUSTOM_COMMANDS[j][4].is_a? (Fixnum)if $scene.is_a? (Phantasia_CMS::CUSTOM_COMMANDS[j][4])

  • 8/6/2019 Menu Phantasia

    13/16

    # Set menu index to its position@menu_index = ireturn

    end}@menu_index = 0

    end

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Start processing#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def startsupercreate_menu_backgroundcreate_command_window@target_window = Window_TPCMS_Target.new@windows = [@command_window, @target_window]for i in 0...4break if !Phantasia_CMS::EMPTY_WINDOWS_SHOWN && i >= $game_party.members.s

    ize

    @windows.push (Window_TPCMS_MenuActor.new (i))endcreate_optional_windows

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Termination Processing#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def [email protected] { window window.dispose }@optional_windows.each { window window.dispose }

    end

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Frame Update#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def updatesuperupdate_menu_background# Update Actor [email protected] { window window.update if window.is_a? (Window_TPCMS_MenuAct

    or) }# Update Playtime if it is shownif $game_system.tpcms_optional_windows.include? (1)@optional_windows[$game_system.tpcms_optional_windows.index (1)].update

    endif @target_window.activeupdate_actor_selectionreturn

    end# Update Command Windowif @command_window.activeupdate_command_selection

    endend#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Create Background for Menu Screen#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    def create_menu_backgroundif Phantasia_CMS::MENU_BACKDROP == ""super

  • 8/6/2019 Menu Phantasia

    14/16

    else@menuback_sprite = Sprite.new@menuback_sprite.bitmap = Cache.system (Phantasia_CMS::MENU_BACKDROP)

    endend#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Create Command Window

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def create_command_window@commands, @disabled_commands, @actor_commands = [], [], []@scene_calls, @scene_arguments = [], []index = 0$game_system.tpcms_command_list.each { icommand = Phantasia_CMS::CUSTOM_COMMANDS[i]name = command[0][/Vocab/i] != nil ? eval (command[0]) : command[0]@commands.push (name)if command[2].is_a? (String)boolean = eval (command[2])@disabled_commands.push (index) if boolean

    else@disabled_commands.push (index) if command[2] > 0 && $game_switches[command[2]]

    end@actor_commands.push (index) if command[3]@scene_calls.push (command[4])@scene_arguments.push (command[5])index += 1

    }@command_window = Window_TPCMS_MenuCommand.new(160, @commands)@command_window.index = @menu_index@command_window.x = (Graphics.width - 160) / 2# Disable commands

    @disabled_commands.each { index @command_window.draw_item (index, false) }end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Create Optional Windows#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def create_optional_windowsy = Graphics.height@optional_windows = []$game_system.tpcms_optional_windows.each { iwindow = optional_window (i)y -= window.heightwindow.y = y@optional_windows.push (window)

    }end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Optional Window# index : index of optional window#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def optional_window (index)x = (Graphics.width - 160) / 2return case indexwhen 0 then Window_Gold.new (x, 0)when 1 then Window_TPCMS_PlayTime.new (x, 0)when 2 then Window_TPCMS_StepCount.new (x, 0)

    when 3 then Window_TPCMS_Location.new (x, 0)when 4 then Window_TPCMS_Variable.new (x, 0)end

  • 8/6/2019 Menu Phantasia

    15/16

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Update Command Selection#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def update_command_selection@command_window.updateif Input.trigger?(Input::B)

    Sound.play_cancel$scene = Scene_Map.new

    elsif Input.trigger?(Input::C)# Return if Disabledif @disabled_commands.include? (@command_window.index)Sound.play_buzzerreturn

    endSound.play_decision# Start Actor Selection if command desires actor selectionif @actor_commands.include? (@command_window.index)start_actor_selection

    elsecall_next_sceneend

    endend#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Start Actor Selection#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def start_actor_selection@command_window.active = false@target_window.active = trueif $game_party.last_actor_index < @target_window.item_max@target_window.index = $game_party.last_actor_index

    else@target_window.index = 0

    endend#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * End Actor Selection#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def end_actor_selection$game_party.last_actor_index = @target_window.index@command_window.active = true@target_window.active = false@target_window.index = -1

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Update Actor Selection#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def update_actor_selection@target_window.updateif Input.trigger?(Input::B)Sound.play_cancelend_actor_selection

    elsif Input.trigger?(Input::C)select_actor

    endend

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Select Actor#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  • 8/6/2019 Menu Phantasia

    16/16

    def select_actor$game_party.last_actor_index = @target_window.indexSound.play_decisioncall_next_scene

    end#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# * Call Next Scene

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~def call_next_scene# Call next sceneif @scene_calls[@command_window.index].is_a? (Fixnum)# If actor selectedif @actor_commands.include? (@command_window.index)var_id = Phantasia_CMS::CE_ACTOR_VARIABLE_ID$game_variables[var_id] = $game_party.members[@target_window.index].id

    end# Run Common Event if Scene call is an integer$game_temp.common_event_id = @scene_calls[@command_window.index]$scene = Scene_Map.new

    else# Call specified sceneargs = []if @scene_arguments[@command_window.index] != nilargs = eval ("[#{@scene_arguments[@command_window.index]}]")

    end# If actor selectedif @actor_commands.include? (@command_window.index)args.unshift (@target_window.index)

    end$scene = @scene_calls[@command_window.index].new (*args)

    endend

    end