#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #_/ ◆ Plot Outline - KGC_Outline ◆ VX ◆ #_/ ◇ Last Update: 02/21/2009 #_/ ◇ RPG Maker XP Version by KGC Software/TOMY #_/ ◆ http://ytomy.sakura.ne.jp/ #_/ ◆ RPG Maker VX Version + Additional Features by Mr. Anonymous #_/ ◆ http://anonymouscreations.we.bs/ #_/---------------------------------------------------------------------------- #_/ Provides the function to show a plot summary, quest journal, memos or any #_/ variety of things through use of a selectable menu and window. #_/============================================================================ #_/ ◆ Script Commands #_/ These commands are used in "Script" function in the third page of event #_/ commands under "Advanced". #_/ #_/ * call_outline #_/ Calls the outline scene. #_/ #_/ * set_outline_enabled(outline_index, flag) #_/ Allows you to set a specific outline entry index as enabled or disabled. #_/ #_/ * set_outline_completed(outline_index, flag) #_/ Allows you to set a specific outline entry index as completed or incomplete. #_/ #_/ - Terms #_/ - outline_index : The outline entry index number. Starts at 0. #_/ - flag : A true or false value. #_/============================================================================ #_/ Install: Insert below KGC_CustomMenuCommands if applicable. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #============================================================================== # ★ BEGIN Customization ★ #============================================================================== module KGC module Outline # ◆ Outline Scene Settings # # * Windowskin (frontal) opacity # 0 = Completely transparent, 255 = Completely visible OLINE_OPACITY = 0 # * Windowskin (background) opacity # 0 = Completely transparent, 255 = Completely visible OLINE_BACK_OPACITY = 0 # * Enable/Disable use of background image # Outline window background image located in Graphics\System OLINE_USE_BACK_IMAGE = true # * Outline window background image located in Graphics\System OLINE_BACK_FILENAME = "EnemyGuideBack" # * Use Map Background # This toggle allows you to enable/disable the display of the map (blurred) # behind the windows AND image background if applicable. OLINE_USE_MAP_BACKGROUND = true # ◆ Outline Contents Window Settings # # * Contents window text font name CONTENTS_FONT_NAME = "Arial" # * Contents window text font size CONTENTS_FONT_SIZE = 16 # * Enable/Disable bold contents window font CONTENTS_FONT_BOLD = false # * Enable/Disable bold contents window font CONTENTS_FONT_ITALIC = true # * Contents window text font color # CONTENTS_FONT_COLOR = Color.new(Red, Green, Blue, Alpha) CONTENTS_FONT_COLOR = Color.new(0, 0, 0, 255) # * Disabled title caption OLINE_DISABLED_TITLE = " - - - - - - - - " # * Hide disabled outline title toggle OLINE_HIDE_DISABLED = true # * Completed title symbol OLINE_COMPLETION_SYMBOL = "*" # * Incomplete title symbol OLINE_INCOMPLETION_SYMBOL = "-" # * Contents window text scroll speed OLINE_SCROLL_SPEED = 8 # ◆ Outline Title Window Settings # # * Title window text font name TITLE_FONT_NAME = "Arial" # * Title window text font size TITLE_FONT_SIZE = 24 # * Enable/Disable bold title window font TITLE_FONT_BOLD = true # * Enable/Disable bold title window font TITLE_FONT_ITALIC = false # * Title window text font color # TITLE_FONT_COLOR = Color.new(Red, Green, Blue, Alpha) TITLE_FONT_COLOR = Color.new(0, 0, 0, 255) # ◆ Outline List Window Settings # # * List window text font name LIST_FONT_NAME = "MS PGothic" # * List window text font size LIST_FONT_SIZE = 16 # * Enable/Disable bold list window font LIST_FONT_BOLD = false # * Enable/Disable bold list window font LIST_FONT_ITALIC = false # * List Windowskin Filename # Set this to nil if you desire the system to always handle this as default. LIST_WINDOWSKIN = "Window" # * List windowskin (frontal) opacity # 0 = Completely transparent, 255 = Completely visible LIST_OPACITY = 160 # * List windowskin (background) opacity # 0 = Completely transparent, 255 = Completely visible LIST_BACK_OPACITY = 160 # ◆ Outline Sound Effect Settings # # Use custom sound effects defined below? USE_CUSTOM_SOUNDS = true # Here you may define sound effects played under various actions. # Format: RPG::(SE or ME).new("SoundEffectName", Volume, Pitch) # * Sound effect played when selecting an outline entry TURNPAGE_SE = RPG::SE.new("Book", 80, 100) # * Sound effect played when exiting the outline scene CLOSEBOOK_SE = RPG::SE.new("Knock", 100, 50) # ◆ Close Inactive Windows Toggle # # * Disable/Enable the list window's visibility when inactive. # [true] Window becomes invisible upon becoming inactive # [false] Window remains open after becoming inactive CLOSE_LIST_INACTIVE = true # Disable/Enable the contents (and title) window's visibility when inactive. CLOSE_CONTENTS_INACTIVE = true # ◆ Call Outline Settings # # * Enable/Disable command on the menu that calls Scene_Outline. # Works well with KGC_CustomMenuCommand USE_MENU_OLINE_COMMAND = false # * Sets a caption to the previously mentioned menu command. VOCAB_MENU_OLINE = "Outline" # * Open Outline Scene From Item # Allows you to assign an item (by its ID number in the database) that opens # the Outline scene. Set this as nil to prevent such a feature. CALL_OLINE_ITEM_ID = 22 # ◆ Serial Numbers Display # # * Display serial numbers toggle # Allows you to enable/disable the display of serial numbers, which are # ordered in the same manner as the contents ID (see below). OLINE_SERIAL_NUMBER = false # * Number of digits to use OLINE_SERIAL_NUMBER_DIGITS = 3 # ◆ Outline Contents Format # # OLINE_CONTENTS = [ # ["Contents Title", # ["Contents body text...", # "More Text",]], # ] # # Now I'll try and explain how this works exactly. # # OLINE_CONTENTS = [ <- Begins the the Outline contents array definition # Don't alter or remove this. # # ["Contents Title", <- Define the title of outline here. This shows up on # the outline list menu as well as above the outline # contents defined below. # Also of note is that with each outline and title, # an index is assigned and incremented. # # ["Contents body text",<- Define the body of the outline here. You may enter # "More Text", <- extra lines of text like this. # ]], <- And finally, this ends the outline title and body. # # * Repeat as needed. # # ] <- Ends the Outline contents array definition # Don't alter or remove this. # # * Outline body contents control statements # You may also use control statements in the body of the outline. This is # handled the same way as the Show Message event command, except here, both # backslashes ( \\ ) are required. # # \\G : Party's current gold/money # \\V[VariableID] : Variable by ID in the variables list # \\N[ActorID] : Actor Name by ID in the actors database # \\CN[ActorID] : Actor Class Name by ID in the actors database # \\EN[EnemyID] : Enemy Name by ID in the enemies database # \\TN[TroopID] : Troop Name by ID in the troops database # \\SN[SkillID] : Skill Name by ID in the skills database # \\IN[ItemID] : Item Name by ID in the items database # \\WN[WeaponID] : Weapon Name by ID in the weapons database # \\AN[ArmorID] : Armor Name by ID in the armors database # \\IP[ItemID] : Item Price by ID in the items database # \\ST[StateID] : State name by ID in the states database OLINE_CONTENTS = [ ["Page 1: Credits", # Outline Title, Outline Index No.0 # Outline Body ["KGC Second Software Development Room / TOMY", " http://ytomy.sakura.ne.jp/", "Anonymous Creations / Mr. Anonymous", " http://anonymouscreations.we.bs/", ]], # End Outline No. 0 ["Page 2: Example", # Outline Title, Outline Index No.1 # Outline Body ["This is an example of how the Outline scene is structured.", "With each line of text entered in the body...", "...creates a new line of text in-game. Also note the system automatically adjusts text length.", "This is an example of how control statements may be used.", "I hear \\N[1] really likes \\IN[1]s!", "\\N[1] hates becoming \\ST[1]", "Your quest is to obtain \\IP[10] gold to buy a \\IN[10].", "Right now you have \\G gold.", "\\EN[1] is actually very friendly.", "", ]], # End Outline No. 1 ] # <- End Outline - Don't delete this line! -> end end #============================================================================== # ★ End Customization ★ #============================================================================== #=================================================# # IMPORT # #=================================================# $imported = {} if $imported == nil $imported["Outline"] = true #============================================================================== # ■ Module - KGC::Outline #============================================================================== module KGC::Commands module_function #-------------------------------------------------------------------------- # ● Call Outline Scene #-------------------------------------------------------------------------- def call_outline # Call outline scene method $scene = Scene_Outline.new(true) end #-------------------------------------------------------------------------- # ● Set outline status as enabled # index : Outline Index Number # value : Enabled State (true | false) #-------------------------------------------------------------------------- def set_outline_enabled(index, value = true) if $game_system.outline_enable == nil $game_system.outline_enable = [] end $game_system.outline_enable[index] = value end #-------------------------------------------------------------------------- # ● Set outline status as completed # index : Outline Index Number # value : Complete State (true | false) #-------------------------------------------------------------------------- def set_outline_completed(index, value = true) if $game_system.outline_complete == nil $game_system.outline_complete = [] end $game_system.outline_complete[index] = value end #-------------------------------------------------------------------------- # ● Process control statement # string : String #-------------------------------------------------------------------------- def apply_outline_control_statement(string) # Duplicate string to buffer buf = string.dup # Apply control statements to duplicated string # Gold buf.gsub!(/\\G/i) { $game_party.gold.to_s } # Variable buf.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i].to_s } # Actor name buf.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name } # Actor class name buf.gsub!(/\\CN\[([0-9]+)\]/i) { $data_classes[$game_actors[$1.to_i].class_id].name } # Enemy name buf.gsub!(/\\EN\[([0-9]+)\]/i) { $data_enemies[$1.to_i].name } # Troop name buf.gsub!(/\\TN\[([0-9]+)\]/i) { $data_troops[$1.to_i].name } # Skill name buf.gsub!(/\\SN\[([0-9]+)\]/i) { $data_skills[$1.to_i].name } # Item name buf.gsub!(/\\IN\[([0-9]+)\]/i) { $data_items[$1.to_i].name } # Weapon name buf.gsub!(/\\WN\[([0-9]+)\]/i) { $data_weapons[$1.to_i].name } # Armor name buf.gsub!(/\\AN\[([0-9]+)\]/i) { $data_armors[$1.to_i].name } # State name buf.gsub!(/\\ST\[([0-9]+)\]/i) { $data_states[$1.to_i].name } # Item price buf.gsub!(/\\IP\[([0-9]+)\]/i) { $data_items[$1.to_i].price.to_s } # Return string from buffer in modified form return buf end end #=================================================# # INCLUDE COMMANDS # #=================================================# # Include KGC::Commands in Game_Interpreter # #=================================================# class Game_Interpreter include KGC::Commands end #============================================================================== # ■ Vocab #============================================================================== module Vocab # Set new vocabulary definition for Outline def self.outline return KGC::Outline::VOCAB_MENU_OLINE end end #============================================================================== # ■ Sound #============================================================================== if KGC::Outline::USE_CUSTOM_SOUNDS module Sound # Page Turn def self.play_turnpage KGC::Outline::TURNPAGE_SE.play end # Book Close def self.play_closebook KGC::Outline::CLOSEBOOK_SE.play end end end # if KGC::Outline::OLINE_TURNPAGE_SE #============================================================================== # ■ Game_System #============================================================================== class Game_System #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :outline_enable # Outline enabled flag attr_accessor :outline_complete # Outline completed flag #-------------------------------------------------------------------------- # ● Object initialization #-------------------------------------------------------------------------- alias initialize_KGC_Outline initialize def initialize # Run original process initialize_KGC_Outline # Setup arrays @outline_enable = [] @outline_complete = [] end end #============================================================================== # ■ Window_OutlineList #------------------------------------------------------------------------------ # This window displays currently enabled and completed Outline entries as a # selectable window. #============================================================================== class Window_OutlineList < Window_Selectable #-------------------------------------------------------------------------- # ● Object Initialization #-------------------------------------------------------------------------- def initialize super(72, 16, 382, 382) # Set window opacity self.opacity = KGC::Outline::LIST_OPACITY # Set window background opacity self.back_opacity = KGC::Outline::LIST_BACK_OPACITY # Set windowskin if not nil if KGC::Outline::LIST_WINDOWSKIN != nil self.windowskin = Cache.system(KGC::Outline::LIST_WINDOWSKIN) end # Set list index self.index = 0 # Set window Z coordinate self.z = 1000 # Run refresh method refresh end #-------------------------------------------------------------------------- # ● Select Outline Contents #-------------------------------------------------------------------------- def outline return @data[self.index] end #-------------------------------------------------------------------------- # ● Refresh #-------------------------------------------------------------------------- def refresh self.contents.dispose if self.contents != nil @data = [] @data_index = [] # Lists $game_system.outline_enable = [] if $game_system.outline_enable == nil $game_system.outline_complete = [] if $game_system.outline_complete == nil KGC::Outline::OLINE_CONTENTS.each_with_index { |oline, i| if $game_system.outline_enable[i] @data << OutlineList_Info.new(oline[0], oline[1], i) elsif !KGC::Outline::OLINE_HIDE_DISABLED @data << OutlineList_Info.new(KGC::Outline::OLINE_DISABLED_TITLE, nil, i) end } # Draw List @item_max = [@data.size, 1].max self.contents = Bitmap.new(self.width - 32, 32 * @item_max) if @data.size == 0 @data << OutlineList_Info.new else @data.each_index { |i| draw_item(i) } end end #-------------------------------------------------------------------------- # ● Draw Items #-------------------------------------------------------------------------- def draw_item(index) self.contents.fill_rect(0, 32 * index, self.width - 32, 32, Color.new(0, 0, 0, 0)) # Generate Title text = ($game_system.outline_complete[@data[index].index] ? KGC::Outline::OLINE_COMPLETION_SYMBOL : KGC::Outline::OLINE_INCOMPLETION_SYMBOL) + (KGC::Outline::OLINE_SERIAL_NUMBER ? sprintf("%0*d : ", KGC::Outline::OLINE_SERIAL_NUMBER_DIGITS, @data[index].index + 1) : "") + KGC::Commands.apply_outline_control_statement(@data[index].title) # Set Font Color self.contents.font.color = $game_system.outline_enable[@data[index].index] ? normal_color : normal_color self.contents.font.name = KGC::Outline::LIST_FONT_NAME self.contents.font.size = KGC::Outline::LIST_FONT_SIZE self.contents.font.bold = KGC::Outline::LIST_FONT_BOLD self.contents.font.italic = KGC::Outline::LIST_FONT_ITALIC self.contents.draw_text(0, 24 * index, self.width - 32, 22, text) end end #============================================================================== # ■ OutlineList_Info #------------------------------------------------------------------------------ # This class holds Outline entry list information. #============================================================================== class OutlineList_Info attr_accessor :title, :contents, :index #-------------------------------------------------------------------------- # ● Object Initialization #-------------------------------------------------------------------------- def initialize(title = "", contents = nil, index = 0) @title = title @contents = contents @index = index end end #============================================================================== # ■ Window_OutlineTitle #------------------------------------------------------------------------------ # This window displays a currently selected Outline entry's title. #============================================================================== class Window_OutlineTitle < Window_Base #-------------------------------------------------------------------------- # ● Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0, 544, 64) self.contents = Bitmap.new(width - 32, height - 32) self.opacity = KGC::Outline::OLINE_OPACITY self.back_opacity = KGC::Outline::OLINE_BACK_OPACITY end #-------------------------------------------------------------------------- # ● Refresh # text : Visible Strings #-------------------------------------------------------------------------- def refresh(text) self.contents.clear text2 = KGC::Commands::apply_outline_control_statement(text) self.contents.font.name = KGC::Outline::TITLE_FONT_NAME self.contents.font.size = KGC::Outline::TITLE_FONT_SIZE self.contents.font.bold = KGC::Outline::TITLE_FONT_BOLD self.contents.font.italic = KGC::Outline::TITLE_FONT_ITALIC self.contents.font.color = KGC::Outline::TITLE_FONT_COLOR self.contents.draw_text(0, 0, self.width - 32, 32, text2, 1) end end #============================================================================== # ■ Window_Outline #------------------------------------------------------------------------------ # This window displays a currently selected Outline entry's body, or content. #============================================================================== class Window_Outline < Window_Base #-------------------------------------------------------------------------- # ● Object initialization #-------------------------------------------------------------------------- def initialize super(0, 64, 544, 352) self.opacity = KGC::Outline::OLINE_OPACITY self.back_opacity = KGC::Outline::OLINE_BACK_OPACITY self.active = false refresh end #-------------------------------------------------------------------------- # ● Refresh # oline : Plot #-------------------------------------------------------------------------- def refresh(oline = nil) self.oy = 0 self.contents.dispose if self.contents != nil return if oline == nil # Draw Text self.contents = Bitmap.new(self.width - 32, 32 * oline.size) oline.each_with_index { |l ,i| next if l == nil text = KGC::Commands::apply_outline_control_statement(l) self.contents.font.name = KGC::Outline::CONTENTS_FONT_NAME self.contents.font.size = KGC::Outline::CONTENTS_FONT_SIZE self.contents.font.bold = KGC::Outline::CONTENTS_FONT_BOLD self.contents.font.italic = KGC::Outline::CONTENTS_FONT_ITALIC self.contents.font.color = KGC::Outline::CONTENTS_FONT_COLOR self.contents.draw_text(0, i * 32, self.width - 32, 32, text) } end #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- def update super # Scroll if self.active scroll_max = [self.contents.height - (self.height - 32), 0].max if Input.press?(Input::UP) self.oy = [self.oy - KGC::Outline::OLINE_SCROLL_SPEED, 0].max elsif Input.press?(Input::DOWN) self.oy = [self.oy + KGC::Outline::OLINE_SCROLL_SPEED, scroll_max].min elsif Input.repeat?(Input::L) self.oy = [self.oy - (self.height - 32), 0].max elsif Input.repeat?(Input::R) self.oy = [self.oy + (self.height - 32), scroll_max].min end end end end #============================================================================== # ■ Scene_Outline #------------------------------------------------------------------------------ # This class performs Outline screen processing. #============================================================================== class Scene_Outline #-------------------------------------------------------------------------- # ● Object initialization # map_call : Map call flag #-------------------------------------------------------------------------- def initialize(map_call = false) @map_call = map_call end #-------------------------------------------------------------------------- # ● Main Process #-------------------------------------------------------------------------- def main # Create Spriteset @spriteset = Spriteset_Map.new if KGC::Outline::OLINE_USE_MAP_BACKGROUND # Added by Mr. Anonymous # If constant OLINE_USE_BACK_IMAGE is true if KGC::Outline::OLINE_USE_BACK_IMAGE # Setup background sprite @back_sprite = Sprite.new begin @back_sprite.bitmap = Cache.system(KGC::Outline::OLINE_BACK_FILENAME) rescue @back_sprite.bitmap = Bitmap.new(32, 32) end end # Create Windows @list_window = Window_OutlineList.new @title_window = Window_OutlineTitle.new @content_window = Window_Outline.new # Run Transition Graphics.transition # Loop Main loop { Graphics.update Input.update update if $scene != self break end } # Freeze Graphics Graphics.freeze # Added by Mr. Anonymous # Dispose background sprite if it exists if @back_sprite != nil @back_sprite.bitmap.dispose @back_sprite.dispose end # end addition @list_window.dispose @title_window.dispose @content_window.dispose @spriteset.dispose if KGC::Outline::OLINE_USE_MAP_BACKGROUND end #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- def update # Update Windows @list_window.update @title_window.update @content_window.update # If the list window is currently active if @list_window.active # Update list window update_list # Set the list window as visible @list_window.visible = true else # if the list window isn't active if KGC::Outline::CLOSE_LIST_INACTIVE # Close list window if specified @list_window.visible = false end end # If the contents window is currently active if @content_window.active # Update contents window update_content # Set the contents window as visible @content_window.visible = true # Set the title window as visible @title_window.visible = true else # if the contents window isn't active if KGC::Outline::CLOSE_CONTENTS_INACTIVE # Close contents window if specified @content_window.visible = false # Close title window @title_window.visible = false end end end #-------------------------------------------------------------------------- # ● Update Frame (List) #-------------------------------------------------------------------------- def update_list # If B Button is Pressed if Input.trigger?(Input::B) # Play cancel SE if KGC::Outline::USE_CUSTOM_SOUNDS Sound.play_closebook else Sound.play_cancel end # If called from the map if @map_call # Return to map $scene = Scene_Map.new # Else if called from the menu else # Return to menu $scene = Scene_Menu.new end return end # If C Button is Pressed if Input.trigger?(Input::C) outline = @list_window.outline # If you cannot view... if outline.contents == nil # Play buzzer SE Sound.play_buzzer return end # Play decision SE if KGC::Outline::USE_CUSTOM_SOUNDS Sound.play_turnpage else Sound.play_decision end # Update Outline @title_window.refresh(outline.title) @content_window.refresh(outline.contents) # Switch Window @list_window.active = false @list_window.z = 0 @content_window.active = true @content_window.z = 1000 return end end #-------------------------------------------------------------------------- # ● Frame Update (Text) #-------------------------------------------------------------------------- def update_content # If B Button is Pressed if Input.trigger?(Input::B) # Play cancel SE if KGC::Outline::USE_CUSTOM_SOUNDS Sound.play_turnpage else Sound.play_cancel end # Switch Window @list_window.active = true @list_window.z = 1000 @content_window.active = false @content_window.z = 0 return end end end #============================================================================== # ■ Scene_Item #============================================================================== class Scene_Item < Scene_Base #-------------------------------------------------------------------------- # * Determine Item #-------------------------------------------------------------------------- alias determine_item_KGC_Outline determine_item def determine_item # If the item being used isn't nil and is specified as a call outline item if @item.id != nil && @item.id == KGC::Outline::CALL_OLINE_ITEM_ID # Call Outline $scene = Scene_Outline.new(true) end # Run original process determine_item_KGC_Outline end end #============================================================================== # ■ Scene_Menu #============================================================================== class Scene_Menu < Scene_Base if KGC::Outline::USE_MENU_OLINE_COMMAND #-------------------------------------------------------------------------- # ● Create command window #-------------------------------------------------------------------------- alias create_command_window_KGC_Outline create_command_window def create_command_window create_command_window_KGC_Outline return if $imported["CustomMenuCommand"] @__command_outline_index = @command_window.add_command(Vocab.outline) @command_window.draw_item(@__command_outline_index) if @command_window.oy > 0 @command_window.oy -= Window_Base::WLH end @command_window.index = @menu_index end end #------------------------------------------------------------------------- # ● Update Command Selection #-------------------------------------------------------------------------- alias update_command_selection_KGC_Outline update_command_selection def update_command_selection current_menu_index = @__command_outline_index call_outline_flag = false if Input.trigger?(Input::C) case @command_window.index when @__command_outline_index call_outline_flag = true end end if call_outline_flag Sound.play_decision $scene = Scene_Outline.new(current_menu_index) return end update_command_selection_KGC_Outline end end