Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
- # #
- # V's Progression Window #
- # Version v1.5 #
- # #
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
- # Written By: V #
- # Last Edited: June 29, 2013 #
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
- # #
- # #
- #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
- #==============================================================================#
- #------------------------------------------------------------------------------#
- # ** Disclaimer #
- #------------------------------------------------------------------------------#
- # #
- # I do not mind sharing credit for this script if alterations to the script #
- # are made. I am not making this script for commercial uses. If anyone wants #
- # to use this script in one there games just give credit to any and everyone #
- # who took part in creating it. #
- # #
- #------------------------------------------------------------------------------#
- # ** How To Use #
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
- # * Use anyone of these commands in a script call to change the data #
- # * Remember to use "" before and after your text, bg, or chapt_name. #
- #------------------------------------------------------------------------------#
- # #
- # To access this window use SceneManager.call(Prog_Scene) #
- # To add a new entry use add_chapt_info(page, bg, chapt_name, text) #
- # To change the font use change_prog_text_font(text) #
- # To change the text size use change_prog_text_size(text) #
- # To change the text x position use change_prog_text_x(integer) #
- # To change the text y position use change_prog_text_y(integer) #
- # To toggle the menu command use menu_command(true or false) #
- # To add to the game progress gauge use add_progress(integer) #
- # To remove from the game progress gauge use remove_progress(integer) #
- # #
- #------------------------------------------------------------------------------#
- # ** Description #
- #------------------------------------------------------------------------------#
- # #
- # v1.0 #
- # ~=~=~=~ #
- # #
- # In v1.0, this script creates a game progress window that dispalys a gauge, #
- # the current chapter(or whatever you want to call it.) and a discription of #
- # the chapter so far. If you choose not to use the menu command then the script#
- # call for the window is SceneManager.call(Prog_Scene) you must set the value #
- # of the max game variable at the start of the game. #
- # #
- # v1.1 #
- # ~=~=~=~ #
- # #
- # In v1.1, I've taken out the variable controll and set it all on script calls.#
- # I've also added two more commands.One allows you to toggle the menu command, #
- # the othe is to add progress to the gauge. #
- # #
- # v1.2 #
- # ~=~=~=~ #
- # #
- # In v1.2, I added the game_variable option to fill the gauge again. I also #
- # added some options for the x and y values as well as font and font size. #
- # Also new to the script is a scroll feature to view the progress text. #
- # #
- # v1.3 #
- # ~=~=~=~ #
- # #
- # In v1.3, I added a command to change the color of the gauge in game via #
- # script call change_gauge_color(V's_Color_ID). I have also fixed a bug with #
- # with the add_progress script call and I added a script call to #
- # remove_progress. #
- # #
- # v1.4 #
- # ~=~=~=~ #
- # #
- # In v1.4, I've combined the change_prog_bg, change_prog_chapt, and #
- # change_prog_text script calls and made it so you can add new entries with #
- # one command instead of three. With that said, I have also added a left/right #
- # page control to veiw the other chapters. #
- # #
- # v1.5 #
- # ~=~=~=~ #
- # #
- # In v1.5, I fixed the issue with the chapter info not saving and loading #
- # properly, and resulting in a crash. #
- # #
- #------------------------------------------------------------------------------#
- #==============================================================================#
- #==============================================================================
- # ** V's Progression Window Module
- #------------------------------------------------------------------------------
- # This module manages customizable features and methods.
- #==============================================================================
- module V_Progress
- module Specs
- #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
- # #
- # Start Customizable Area. #
- # #
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
- # #
- # ONLY EDIT AFTER THE EQUALS SYMBOL. #
- # #
- #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
- #--------------------------------------------------------------------------
- # * What To Call The Game Chapters
- #--------------------------------------------------------------------------
- Page_Title = ""
- #--------------------------------------------------------------------------
- # * Default Window Contents At Start Of Game.
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- # * Customization For Gauge Used To Track Game Progress.
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- #
- # ** If you do not want to use the script calls you can fill the gauge
- # by adding to the "Game_Variable_For_Filling" below.
- #
- # ** If you dont want to use the game variables method just set it to an
- # unused variable.
- #
- # ** There are 9 gauge colors so far they are as follows:
- # 1 = hp_gauge_colors 1 & 2
- # 2 = mp_gauge_colors 1 & 2
- # 3 = tp_gauge_colors 1 & 2
- # 4 = hp_gauge_color1 & mp_gauge_color1
- # 5 = hp_gauge_color1 & tp_gauge_color1
- # 6 = mp_gauge_color1 & tp_gauge_color1
- # 7 = Love Theme
- # 8 = Ice Theme
- # 9 = Circuit Board Theme#
- #
- #--------------------------------------------------------------------------
- Game_Progress_Gauge_Max = 28 # Total number of quests, tasks, or whatever
- Game_Prog_Gauge_Color = 1
- Game_Variable_For_Filling = 6
- #--------------------------------------------------------------------------
- # * Customization For The Menu Command.
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- #
- # ** If you want to enable the menu command via script call set
- # Use_Menu_Command = false
- #
- # ** If You Choose Not To Use The Menu Command, You Can Still
- # Access The Window By Using SceneManager.call(Prog_Scene)
- # In A Script Call.
- #--------------------------------------------------------------------------
- Use_Menu_Command = true
- Command_Name = "Game Progress"
- #--------------------------------------------------------------------------
- # * Current Text Options
- #--------------------------------------------------------------------------
- Text_Font = "Times New Roman"
- Text_Size = 24
- Text_X = 38
- Text_Y = 15
- #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
- # #
- # End Customizable Area. #
- # #
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
- # #
- # DO NOT EDIT PAST THIS POINT UNLESS YOU KNOW WHAT YOUR DOING. #
- # #
- #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
- end
- end
- #==============================================================================
- # ** Window_Base
- #------------------------------------------------------------------------------
- # This is a super class of all windows within the game.
- #==============================================================================
- class Prog_Window < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 544, 120)
- gaugevar = $game_variables[V_Progress::Specs::Game_Variable_For_Filling]
- maxvarnum = $game_system.progress_gauge_max
- rate = gaugevar.to_f / maxvarnum * 100
- draw_face($game_party.members[0].face_name, $game_party.members[0].face_index, 0, 0, enabled = true)
- contents.font.size = 25
- draw_actor_name($game_party.members[0], 115, line_height * 2)
- contents.font.size = 16
- draw_text((Graphics.width / 9) + 80, 0, 544, line_height * 7 - 5, "Game Progress", 1)
- draw_text((Graphics.width / 9) - 115, 0, 544, line_height * 7 - 5, rate.to_i, 2)
- draw_text((Graphics.width / 9) + 160, 0, 544, line_height * 7 - 5, "%", 1)
- make_font_bigger
- contents.font.size = 18
- draw_actor_level($game_party.members[0], 115, line_height * 3)
- draw_prog_gauge()
- end
- #--------------------------------------------------------------------------
- # * Draw Window Contents
- # args : Same as Bitmap#draw_text.
- #--------------------------------------------------------------------------
- def draw_prog_gauge()
- x = 255
- y = line_height * 3
- gaugevar = $game_variables[V_Progress::Specs::Game_Variable_For_Filling]
- maxvarnum = $game_system.progress_gauge_max
- rate = gaugevar.to_f / maxvarnum
- if $game_system.progress_gauge_color == 1
- draw_gauge(x, y, (Graphics.width / 9 * 4), rate, mp_gauge_color1, mp_gauge_color2)
- elsif $game_system.progress_gauge_color == 2
- draw_gauge(x, y, (Graphics.width / 9 * 4), rate, hp_gauge_color1, hp_gauge_color2)
- elsif $game_system.progress_gauge_color == 3
- draw_gauge(x, y, (Graphics.width / 9 * 4), rate, tp_gauge_color1, tp_gauge_color2)
- elsif $game_system.progress_gauge_color == 4
- draw_gauge(x, y, (Graphics.width / 9 * 4), rate, hp_gauge_color1, mp_gauge_color1)
- elsif $game_system.progress_gauge_color == 5
- draw_gauge(x, y, (Graphics.width / 9 * 4), rate, hp_gauge_color1, tp_gauge_color1)
- elsif $game_system.progress_gauge_color == 6
- draw_gauge(x, y, (Graphics.width / 9 * 4), rate, mp_gauge_color1, tp_gauge_color1)
- elsif $game_system.progress_gauge_color == 7
- draw_gauge(x, y, (Graphics.width / 9 * 4), rate, normal_color, knockout_color)
- elsif $game_system.progress_gauge_color == 8
- draw_gauge(x, y, (Graphics.width / 9 * 4), rate, normal_color, mp_cost_color)
- elsif $game_system.progress_gauge_color == 9
- draw_gauge(x, y, (Graphics.width / 9 * 4), rate, tp_cost_color, normal_color)
- end
- end
- end
- #==============================================================================
- # ** Window_Base
- #------------------------------------------------------------------------------
- # This is a super class of all windows within the game.
- #==============================================================================
- class Chapt_Window < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 544, line_height * 17)
- end
- #--------------------------------------------------------------------------
- # * Draw Horz. Lines
- #--------------------------------------------------------------------------
- def draw_horz_lines
- draw_horz_line(line_height * 4)
- draw_horz_line(line_height * 6)
- end
- #--------------------------------------------------------------------------
- # * Draw Chapter Title
- #--------------------------------------------------------------------------
- def draw_chapt_title
- contents.font.size = 16
- chaptname = V_Progress::Specs::Page_Title
- draw_text(-270, 0, 544, line_height * 11, *chaptname, 2)
- end
- #--------------------------------------------------------------------------
- # * Draw Chapter Name
- #--------------------------------------------------------------------------
- def draw_chapt_name
- contents.font.size = 16
- @current_chapt = $game_system.chapter_info[$game_system.current_page][1]
- draw_text(280, 0, 544, line_height * 11, *@current_chapt, 0)
- end
- #--------------------------------------------------------------------------
- # * Draw Horizontal Line
- #--------------------------------------------------------------------------
- def draw_horz_line(y)
- line_y = y + line_height / 2 - 1
- contents.fill_rect(0, line_y, contents_width, 2, line_color)
- end
- #--------------------------------------------------------------------------
- # * Get Color of Horizontal Line
- #--------------------------------------------------------------------------
- def line_color
- color = normal_color
- color.alpha = 48
- color
- end
- #=============================================================================
- # * Update
- #=============================================================================
- def update
- super
- current_chapt = @current_chapt
- if $game_system.current_page != current_chapt
- contents.clear
- draw_horz_lines
- draw_chapt_title
- draw_chapt_name
- end
- end
- end
- #==============================================================================
- # ** Window_Base
- #------------------------------------------------------------------------------
- # This is a super class of all windows within the game.
- #==============================================================================
- class Context_Window < Window_ScrollText
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super()
- self.y = 175
- self.height = (Graphics.height * 0.7)
- self.opacity = 0
- show
- @last_page = ($game_system.chapter_info.size - 1)
- @first_page = 1
- create_context
- end
- #--------------------------------------------------------------------------
- # * Create Text
- #--------------------------------------------------------------------------
- def create_context
- curtextpos = 0
- text = $game_system.chapter_info[$game_system.current_page][2]
- for i in 0..(text.length - 1)
- if text[i] == "\n"
- curtextpos = 0
- next
- end
- curtextpos += text_size(text[i]).width
- if curtextpos > self.width
- curelem = i
- while(text[curelem]) != " "
- break if curelem == 0
- curelem -= 1
- end
- temptext = ""
- for j in 0..(text.length - 1)
- temptext += text[j]
- temptext += "\n" if j == curelem
- end
- text = temptext
- i = curelem
- curtextpos = 0
- end
- end
- fs = Font.default_size
- Font.default_size = $game_system.progress_current_text_size
- x = $game_system.progress_current_text_x
- y = $game_system.progress_current_text_y
- fn = Font.default_name
- Font.default_name = $game_system.progress_current_text_font
- draw_text_ex(x, y, text)
- Font.default_size = fs
- Font.default_name = fn
- end
- #=============================================================================
- # * Update
- #=============================================================================
- def update
- super
- page = $game_system.current_page
- $game_system.current_page -= 1 if Input.trigger?(:LEFT) && $game_system.current_page > @first_page
- $game_system.current_page += 1 if Input.trigger?(:RIGHT) && $game_system.current_page < @last_page
- $game_system.scroll_position -= 1 if Input.press?(:UP)
- $game_system.scroll_position += 1 if Input.press?(:DOWN)
- self.oy = $game_system.scroll_position
- if $game_system.current_page != page
- contents.clear
- $game_system.scroll_position = 0
- create_context
- end
- end
- end
- #==============================================================================
- # ** Window_MenuCommand
- #------------------------------------------------------------------------------
- # This command window appears on the menu screen.
- #==============================================================================
- class Window_MenuCommand < Window_Command
- #--------------------------------------------------------------------------
- # * For Creating An Alias
- #--------------------------------------------------------------------------
- alias v_prog_winmenucmmd_addorigcmmd_885 add_original_commands
- #--------------------------------------------------------------------------
- # * For Adding Original Commands
- #--------------------------------------------------------------------------
- def add_original_commands
- v_prog_winmenucmmd_addorigcmmd_885()
- progname = V_Progress::Specs::Command_Name
- if V_Progress::Specs::Use_Menu_Command || $game_system.progress_menu_command
- then
- add_command(*progname, :prog_scene, true)
- end
- end
- end
- #==============================================================================
- # ** Scene_Menu
- #------------------------------------------------------------------------------
- # This class performs the menu screen processing.
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
- #--------------------------------------------------------------------------
- # * For Creating An Alias
- #--------------------------------------------------------------------------
- alias v_prog_scenemenu_createcmmdwin_9874 create_command_window
- #--------------------------------------------------------------------------
- # * Create Command Window
- #--------------------------------------------------------------------------
- def create_command_window
- v_prog_scenemenu_createcmmdwin_9874()
- if V_Progress::Specs::Use_Menu_Command || $game_system.progress_menu_command
- then
- @command_window.set_handler(:prog_scene, method(:command_prog_scene))
- end
- end
- #--------------------------------------------------------------------------
- # * Create VGW Scene
- #--------------------------------------------------------------------------
- def command_prog_scene
- SceneManager.call(Prog_Scene)
- end
- end
- #==============================================================================
- # ** Variable Gauge Window Scene
- #------------------------------------------------------------------------------
- # This Class Performs The Variable Gauge Window Screen Processing.
- #==============================================================================
- class Prog_Scene < Scene_Base
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super()
- #--------------------------------------------------------------------------
- # * Background Processing
- #--------------------------------------------------------------------------
- @bg_image = $game_system.chapter_info[$game_system.current_page][0]
- @prog_bg = Sprite.new
- @prog_bg.bitmap = Cache.picture(*@bg_image)
- @prog_bg.x= 0
- @prog_bg.y = 0
- @prog_bg.zoom_x = ( Graphics.width.to_f / 544 )
- @prog_bg.zoom_y = ( Graphics.height.to_f / 416 )
- @prog_bg.opacity = 180
- @prog_bg.visible = true
- #--------------------------------------------------------------------------
- # * Window Processing
- #--------------------------------------------------------------------------
- @prog_window = Prog_Window.new
- @prog_window.opacity = 0
- @chapt_window = Chapt_Window.new
- @chapt_window.opacity = 0
- @context_window = Context_Window.new
- @context_window.opacity = 0
- end
- #--------------------------------------------------------------------------
- # * Post-Start Processing
- #--------------------------------------------------------------------------
- def post_start
- super()
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super()
- return_scene() if Input.trigger?(:B)
- end
- #--------------------------------------------------------------------------
- # * Pre-Termination Processing
- #--------------------------------------------------------------------------
- def pre_terminate
- end
- #--------------------------------------------------------------------------
- # * Termination Processing
- #--------------------------------------------------------------------------
- def terminate
- super()
- if @prog_bg
- @prog_bg.dispose
- @prog_bg.bitmap.dispose
- end
- end
- end
- #==============================================================================
- # ** Game_System
- #------------------------------------------------------------------------------
- # This class handles system data. It saves the disable state of saving and
- # menus. Instances of this class are referenced by $game_system.
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :chapter_info
- attr_accessor :progress_current_text
- attr_accessor :progress_current_text_x
- attr_accessor :progress_current_text_y
- attr_accessor :progress_current_text_size
- attr_accessor :progress_current_text_font
- attr_accessor :progress_current_chapt
- attr_accessor :progress_current_bg
- attr_accessor :progress_menu_command
- attr_accessor :progress_gauge_max
- attr_accessor :progress_gauge_color
- attr_accessor :current_page
- attr_accessor :scroll_position
- #--------------------------------------------------------------------------
- # * For Creating An Alias
- #--------------------------------------------------------------------------
- alias v_prog_gamesys_init_654885 initialize
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- @chapter_info = []
- @scroll_position = 0
- @current_page = 0
- @progress_gauge_max = V_Progress::Specs::Game_Progress_Gauge_Max
- @progress_menu_command = V_Progress::Specs::Use_Menu_Command
- @progress_current_text_x = V_Progress::Specs::Text_X
- @progress_current_text_y = V_Progress::Specs::Text_Y
- @progress_current_text_size = V_Progress::Specs::Text_Size
- @progress_current_text_font = V_Progress::Specs::Text_Font
- @progress_gauge_color = V_Progress::Specs::Game_Prog_Gauge_Color
- v_prog_gamesys_init_654885()
- end
- end
- #==============================================================================
- # ** Game_Interpreter
- #------------------------------------------------------------------------------
- # An interpreter for executing event commands. This class is used within the
- # Game_Map, Game_Troop, and Game_Event classes.
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- def add_chapt_info( page, bg, chapt_name, text )
- return unless page.is_a?(Integer)
- return unless bg.is_a?(String)
- return unless chapt_name.is_a?(String)
- return unless text.is_a?(String)
- $game_system.chapter_info[page] = [*bg, *chapt_name, *text]
- $game_system.current_page = page
- end
- def change_prog_text_size( integer )
- return unless integer.is_a?(Integer)
- $game_system.progress_current_text_size = integer
- end
- def change_prog_text_x( integer )
- return unless integer.is_a?(Integer)
- $game_system.progress_current_text_x = integer
- end
- def change_prog_text_y( integer )
- return unless integer.is_a?(Integer)
- $game_system.progress_current_text_y = integer
- end
- def change_prog_text_font( text )
- return unless text.is_a?(String)
- $game_system.progress_current_text_font = text
- end
- def menu_command( text )
- $game_system.progress_menu_command = text
- end
- def add_progress( integer )
- return unless integer.is_a?(Integer)
- if $game_variables[V_Progress::Specs::Game_Variable_For_Filling] < $game_system.progress_gauge_max
- $game_variables[V_Progress::Specs::Game_Variable_For_Filling] += integer
- end
- end
- def remove_progress( integer )
- return unless integer.is_a?(Integer)
- if $game_variables[V_Progress::Specs::Game_Variable_For_Filling] < $game_system.progress_gauge_max
- $game_variables[V_Progress::Specs::Game_Variable_For_Filling] -= integer
- end
- end
- def change_gauge_color( integer )
- return unless integer.is_a?(Integer)
- $game_system.progress_gauge_color = integer
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement