fizzycandy 0 Report post Posted June 29, 2010 hello. i am looking for 1 script to put in my rpg maker xp game :) first one is a quest book/menu a script that has a built in quest book to put your main quest in. thankyou :) <3 Share this post Link to post Share on other sites
Broken Messiah 20 Report post Posted June 29, 2010 Next time remember to look in the script section :alright: Leon's Mission Script 1 Kiriashi reacted to this Share this post Link to post Share on other sites
Kiriashi 117 Report post Posted June 29, 2010 Don't just check the Archive, do a complete google search, and look at recent topics in all of our RMXP forums before posting. There was quite recently a topic about this. Here are a few scripts for you to look at. Keep in mind I was able to find these quite easily by using the above method of searching: [click the titles for the discussion topics] Sthrattoff's Quest Log Screen. #============================================================================= # Quest Log Screen #----------------------------------------------------------------------------- # ** Version 2.3 # ** Original by Sthrattoff #============================================================================= # Description : # This script enables the ability to show current active quest. # Features : # EXTREMELY SIMPLIFIED! Now the script is just about 150 lines length including comments. # Unlimited amount of quest can be added. # Use variable to mark quest's progress. # Limitation : # Only can store up to 12 progresses per quest. # History : # Version 1.0 : Initial release. # Version 1.2 : Add "Types" features. # Version 2.0 : Changes in programming style and infinite quest support. # Version 2.2 : Cut the script length to about 150 lines. # Version 2.3 : Add "Quest Progress" bar in exchange of "Types" removal. # Instruction # Just put this script above main. # Configuration : # To add a quest, fill these information by using .push # $names.push "Name" # $types.push "Type" # $description.push (["line1", "line2", ..., "Line5"]) # $objectives.push (["onjective1", ..., "objective12"]) # $var_ID.push ID_NUMBER # $end_val.push END_VALUE # Credits # See the header + Blizzard and Enterbrain #============================================================================= class Scene_Quest # Defines array variables $names = [] $description = [] $objectives = [] $var_ID = [] $end_val = [] # The main process def main @quest_list = Window_Command.new(160, $names) @quest_window = Window_Quest.new @quest_window.x = 160 Graphics.transition loop do Graphics.update Input.update update break if $scene != self end Graphics.freeze @quest_list.dispose @quest_window.dispose end def update @quest_list.update @quest_window.update if @quest_list.active update_quest return end end def update_quest if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new return end $id = @quest_list.index return end end class Window_Quest < Window_Base def initialize super(0, 0, 480, 480) self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear self.contents.font.color = system_color self.contents.draw_text(0, 0, self.width - 32, 32, $names[$id.to_i].to_s, 1) self.contents.draw_text(0, 192, self.width - 32, 32, "Objectives", 1) self.contents.draw_text(0, 416, self.width - 32, 32, "Quest Progress") self.contents.font.color = normal_color for i in 0..4 self.contents.draw_text(0, i * 32 + 32, self.width - 32, 32, $description[$id.to_i][i].to_s) end a = b = $game_variables[$var_ID[$id.to_i]] if a > 5 self.contents.draw_text(240, (a - 6) * 32 + 224, 240, 32, "• " + $objectives[$id.to_i][a].to_s) else self.contents.draw_text(0, a * 32 + 224, 240, 32, "• " + $objectives[$id.to_i][a].to_s) end self.contents.font.color = disabled_color if b > 0 for j in 0..(b - 1) if j > 5 self.contents.draw_text(240, (j - 6) * 32 + 224, 240, 32, "• " + $objectives[$id.to_i][j].to_s) else self.contents.draw_text(0, j * 32 + 224, 240, 32, "• " + $objectives[$id.to_i][j].to_s) end end end draw_quest_progress(96, 428, self.width - 128) end def update refresh end end class Window_Base < Window def draw_quest_progress(x, y, w = 200) current = $game_variables[$var_ID[$id.to_i]] ending = $end_val[$id.to_i] bordercolor = system_color outercolor = Color.new(180, 210, 120, 255) midcolor = Color.new(180, 210, 140, 255) innercolor = Color.new(180, 210, 160, 255) emptycolor = Color.new(0, 0, 0, 255) linewidth = (((current * 1.0) / ending) * (w - 2)) emptywidth = ((w - 1) - linewidth) emptyx = ((x + 1) + linewidth) border = Rect.new(x, y, w, 8) emptyline = Rect.new(x + 1, y + 1, w - 2, 6) outerline = Rect.new(x + 1, y + 1, linewidth, 6) midline = Rect.new(x + 2, y + 2, linewidth - 2, 4) innerline = Rect.new(x + 3, y + 3, linewidth - 4, 2) self.contents.fill_rect(border, bordercolor) self.contents.fill_rect(emptyline, emptycolor) self.contents.fill_rect(outerline, outercolor) self.contents.fill_rect(midline, midcolor) self.contents.fill_rect(innerline, innercolor) end end class Scene_Save < Scene_File alias old_save_data write_save_data def write_save_data(file) old_save_data Marshal.dump($names, file) Marshal.dump($description, file) Marshal.dump($objectives, file) Marshal.dump($var_ID, file) Marshal.dump($end_val, file) end end class Scene_Load < Scene_File alias old_load_data read_save_data def read_save_data(file) old_load_data $names = Marshal.load(file) $description = Marshal.load(file) $objectives = Marshal.load(file) $var_ID = Marshal.load(file) $end_val = Marshal.load(file) end end class Scene_Title alias old_new_game command_new_game def command_new_game old_new_game $names.clear $description.clear $objectives.clear $var_ID.clear $end_val.clear end end class Scene_Menu def initialize(menu_index = 0) @menu_index = menu_index size = $names.size for i in 0..size var = $var_ID[i] ending = $end_val[i] if $game_variables[var.to_i] >= ending.to_i $names.delete_at i $description.delete_at i $objectives.delete_at i $var_ID.delete_at i $end_val.delete_at i end end end end Zeriab's Quest Book. #============================================================================== # ** Questbook #------------------------------------------------------------------------------ # Zeriab # 1.2 # 2007-10-01 (year-month-day) #============================================================================== #============================================================================== # * Window_Base #------------------------------------------------------------------------------ # Defines the draw_quest_icon method in Window_Base #============================================================================== class Window_Base #-------------------------------------------------------------------------- # * Draw Quest Icon # icon_name : filename of the icon # x : draw spot x-coordinate # y : draw spot y-coordinate #-------------------------------------------------------------------------- def draw_quest_icon(icon_name, x, y) begin bitmap = RPG::Cache.picture(icon_name) rescue bitmap = RPG::Cache.picture(Data_Quest::PATH + Data_Quest::DEFAULT_ICON) end cw = 80 ch = 80 src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x, y, bitmap, src_rect) end # def end # class #============================================================================== # ** Data_Quest #------------------------------------------------------------------------------ # A quest object. # Stores information about the particular quest. # All icons are assumed to be stored in the same directory #============================================================================== class Data_Quest # The path in the pictures folder PATH = "Quest/Icons/" # The name of the default icon DEFAULT_ICON = "default_icon.png" # The following are of the String class. attr_reader :owner # Who attr_reader :location # Where attr_reader :goal # What attr_reader :info # details #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize @owner = "" @location = "" @goal = "" @info = "" @icon = DEFAULT_ICON end # def #-------------------------------------------------------------------------- # * Gets the name and location of the icon in the picture folder #-------------------------------------------------------------------------- def get_icon return PATH + @icon end # def #-------------------------------------------------------------------------- # * Set Owner # string : A string containing the owner #-------------------------------------------------------------------------- def owner=(string) if string.is_a?(String) @owner = string end # if end # def #-------------------------------------------------------------------------- # * Set Location # string : A string containing the location #-------------------------------------------------------------------------- def location=(string) if string.is_a?(String) @location = string end # if end # def #-------------------------------------------------------------------------- # * Set Goal # string : A string containing the goal #-------------------------------------------------------------------------- def goal=(string) if string.is_a?(String) @goal = string end # if end # def #-------------------------------------------------------------------------- # * Set Info # string : A string containing the information #-------------------------------------------------------------------------- def info=(string) if string.is_a?(String) @info = string end # if end # def #-------------------------------------------------------------------------- # * Set Info # string : A string containing the filename of the icon # No change is done if the file does not exists #-------------------------------------------------------------------------- def icon=(string) if string.is_a?(String) @icon = string end # if end # def end # class #============================================================================== # ** Quest_Criteria #------------------------------------------------------------------------------ # This class simple gets a criteria and tells if it is fulfilled or not. # Used in Game_Quest to determine how much the quest has progressed # # Variable condition: # ["variable", variable_number, condition, number] # ------------------- # The "variable" just tells the script that you want to check a variable # The variable_number is the number on the variable you want to use. # Condition is which condition you want to check. # "<" - less than # "<=" - less than or equal ("=<" will give you an error) # "==" - equal ("=" is converted to "==") # ">=" - greater than or equal ("=>" will give you an error) # ">" - greater than # "!=" - not equal # The number is the number you want to check with. # For example: # ["variable", 4, ">", 3] - Variable number 4 must be bigger than 3 # ["variable", 2, "==", 5] - Variable number 2 must be equal 5 # # # Switch Condition: # ["switch", switch_number, state] # ------------------------------------- # The "switch" just tells the script that you want to check a switch # The switch_number is the number on the switch you want to use. # The state is what the state of the switch should be for the conditions to # be fulfilled. Write 'true' if the switch must be ON and 'false' if the # switch must be OFF # # For example: # ["switch", 7, true] - Switch number 7 must be true # ["switch", 3, false] - Switch number 3 must be false # # # Use the 'check' method to see if all conditions are met. If they are then # 'true' will be returned, otherwise 'false' #============================================================================== class Quest_Criteria #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(*args) # Each argument is considered as a condition and is stored in @conditions @conditions = args end # def #-------------------------------------------------------------------------- # * Checks the conditions. Returns true if all the conditions are met #-------------------------------------------------------------------------- def check # Goes through the conditions for condition in @conditions # Creates a begin-rescue block to catch errors. begin break if !condition.is_a?(Array) && !condition[0].is_a?(String) case condition[0].downcase # The first field in the array when "variable" # Converts '=' into '==' to avoid changing the variable condition[2] = "==" if condition[2] == "=" command = "$game_variables[#{condition[1]}] #{condition[2]} " + "#{condition[3]}" return false unless eval(command) when "switch" return false unless $game_switches[condition[1]] == condition[2] end rescue Exception => err # Prints an error message if and only if $DEBUG is true # The erroneous condition is considered to be "true" if $DEBUG output = "Quest_Criteria:Check\n\n"+ err.type.to_s + "\n" + err.to_s + "\n\n" + "Backtrace(10):\n\n" + err.backtrace[0...10].join("\n").to_s print output end end # begin end # for # Returns true if no condition is false. return true end # def end # class #============================================================================== # ** Game_Quest #------------------------------------------------------------------------------ # Manages the process in the quests. #============================================================================== class Game_Quest attr_reader :completed attr_reader :active attr_reader :current_quest #-------------------------------------------------------------------------- # * Object Initialization # quest : Must be a Data_Quest #-------------------------------------------------------------------------- def initialize @data = [] # Completed quest @completed_quest = [] # A quest is not completed in the start @completed = false # Neither is it active @active = false # Updates update end # def #-------------------------------------------------------------------------- # * Resets the quest #-------------------------------------------------------------------------- def reset # Remove the current quest @current_quest = nil # A quest is not completed in the start @completed = false # Neither is it active @active = false # Updates update end # def #-------------------------------------------------------------------------- # * Updates the current_quest #-------------------------------------------------------------------------- def update # Return if the quest have completed @completed = false #------------------------------------------------------------------------ # Checks if the quest is completed. Assumes that @completed_quest only has # 2 (or more) elements if the first element is a Data_Quest and the second # is a Quest_Criteria. #------------------------------------------------------------------------ if (@completed_quest.size > 1) && @completed_quest[1].check @completed = true @current_quest = @completed_quest[0] # No need to update the quest further return end # if # Checks the status of the quest for i in 0...@data.size # Runs through the elements backwards. j = @data.size - (i + 1) # Checks if the conditions for the quest part are met if @data[j][1].check # Sets the current_quest to the quest which conditions are met @current_quest = @data[j][0] # Checks if the quest should be considered completed if i == 0 and @completed_quest.size <= 1 @completed = true @completed_quest = @data[j] end # if break end # if end # for # Checks if the quest should be actived if !@active && @current_quest.is_a?(Data_Quest) @active = true # Is actived end end # def #-------------------------------------------------------------------------- # * Add a quest (quest part) # quest : Must be a Data_Quest #-------------------------------------------------------------------------- def add_quest(quest, condition) if quest.is_a?(Data_Quest) && condition.is_a?(Quest_Criteria) @data.push([quest,condition]) end # if end # def #-------------------------------------------------------------------------- # * Set the completed quest part # quest : Must be a Data_Quest #-------------------------------------------------------------------------- def set_completed_quest(quest, condition) if quest.is_a?(Data_Quest) @completed_quest = [quest, condition] end # if end # def #-------------------------------------------------------------------------- # * Error handling # string : A String containing the error message #-------------------------------------------------------------------------- def error(err) # Only prints the error message if the game is played through the editor if $DEBUG print err end # if end # def end # class #============================================================================== # ** Game_Quests #------------------------------------------------------------------------------ # This class handles quests. It's a wrapper for the built-in class "Array." # Refer to "$game_quests" for the instance of this class. # # The quest potion 0 is considered to be the main quest. ($game_quests[0]) #============================================================================== class Game_Quests # Adds a method to read the data attr_reader :data #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize @data = [] end # def #-------------------------------------------------------------------------- # * Get Quest # quest_id : quest ID #-------------------------------------------------------------------------- def [](quest_id) return @data[quest_id] end # def #-------------------------------------------------------------------------- # * Set Quest # quest_id : quest ID # quest : the quest #-------------------------------------------------------------------------- def []=(quest_id, quest) if quest.is_a?(Game_Quest) && quest_id % @data.size == 0 @data[quest_id] = quest end # if end # def #-------------------------------------------------------------------------- # * Add Quest # quest : the quest #-------------------------------------------------------------------------- def add(quest) if quest.is_a?(Game_Quest) @data.push(quest) end # if end # def #-------------------------------------------------------------------------- # * Resets the quests #-------------------------------------------------------------------------- def reset for quest in @data quest.reset end # if end # def #-------------------------------------------------------------------------- # * Gets active quests. Newest will be listed first # Note: The main quest if active will always have position 0. (result[0]) #-------------------------------------------------------------------------- def get_active_quests result = [] # Goes through the quests for i in 1...@data.size element = @data[i] # Updates the element element.update # Checks if element is active and not completed if element.active && !element.completed # Pushes the active element into the results result.push(element) end # if end # for # Checks if the main quest is active and not completed (index 0 in @data) @data[0].update if @data[0].active && !@data[0].completed result.push(@data[0]) end # if # Reverse result so the main quest have index 0 followed by the newest # quest at index 1, the second newest at index 2 and so on. result.reverse! # Returns the resulting array return result end # def #-------------------------------------------------------------------------- # * Gets completed quests. Newest will be listed first # Note: The main quest will always be on position 0. (result[0]) #-------------------------------------------------------------------------- def get_completed_quests result = [] # Goes through the quests for i in 1...@data.size element = @data[i] # Updates the element element.update # Checks if element is completed. if element.completed # Pushes the active element into the results result.push(element) end # if end # for # Checks if the main quest is active and not completed (index 0 in @data) if @data[0].completed result.push(@data[0]) end # if # Reverse result so the main quest have index 0 followed by the newest # quest at index 1, the second newest at index 2 and so on. result.reverse! # Returns the resulting array return result end # def end # class # The global variable used for storing quests $game_quests = Game_Quests.new #============================================================================== # ** Window_Questbook_Header #------------------------------------------------------------------------------ # This window designates quest information in the header of the questbook. #============================================================================== class Window_Questbook_Header < Window_Base #-------------------------------------------------------------------------- # * Object Initialization # quest : The quest which information will be used #-------------------------------------------------------------------------- def initialize(quest) super(0, 0, 640, 128) # Creates the Bitmap self.contents = Bitmap.new(width - 32, height - 32) # Draws the header refresh(quest) end # def #-------------------------------------------------------------------------- # * Refresh # quest : The quest which information will be used #-------------------------------------------------------------------------- def refresh(quest) # Redraw text self.contents.clear # checks if the quest is a Game_Quest. if quest.is_a?(Game_Quest) # Gets the current quest part current_quest = quest.current_quest else if quest.is_a?(Integer) # Draws the no completed quest header draw_noquest_header else # Draws the mainmenu header draw_mainmenu_header end # Stops processing this method (Refresh) return end # Changes the color of the text to Teal self.contents.font.color = text_color(4) # Bolds the text self.contents.font.bold = true # Draws the non-changing text in bold self.contents.draw_text(4, 0, 80, 32, "Who:") self.contents.draw_text(4, 32, 80, 32, "Where:") self.contents.draw_text(4, 64, 80, 32, "What:") # Unbolds the text self.contents.font.bold = false # Draws the owner of the quest next to "Who:" in gray self.contents.font.color = text_color(7) self.contents.draw_text(80, 0, 540, 32, current_quest.owner) # Draws the location of the quest next to "Where:" in blue self.contents.font.color = text_color(1) self.contents.draw_text(80, 32, 540, 32, current_quest.location) # Draws the goal of the quest next to "What:" in yellow self.contents.font.color = text_color(6) self.contents.draw_text(80, 64, 540, 32, current_quest.goal) end # def #-------------------------------------------------------------------------- # * Draws the header in the case where no quests have been completed #-------------------------------------------------------------------------- def draw_noquest_header # Changes the color of the text to Gray self.contents.font.color = text_color(7) # Draws the text centered in the window self.contents.draw_text(0, 32, 608, 32, "No quests have been completed", 1) end # def #-------------------------------------------------------------------------- # * Draws the header in the case where the main menu icon is selected #-------------------------------------------------------------------------- def draw_mainmenu_header # Changes the color of the text to Teal self.contents.font.color = text_color(4) # Draws the text centered in the window self.contents.draw_text(0, 32, 608, 32, "Return to the main menu", 1) end # def end # class #============================================================================== # ** Window_Questbook_Header #------------------------------------------------------------------------------ # This window designates quest information in the questbook. #============================================================================== class Window_Questbook_Info < Window_Base #============================================================================ # ** Details #---------------------------------------------------------------------------- # This window contains the details of the quest. # Only the text are show. (No window) # Provides scrolling to the details only. (Not the header) #============================================================================ class Details < Window_Base #------------------------------------------------------------------------ # * Object Initialization #------------------------------------------------------------------------ def initialize super(80, 130, 480, 290) # Must be higher than the parent window or the details will not be shown self.z = 210 # No window, only text is shown self.opacity = 0 # Creates the Bitmap self.contents = Bitmap.new(width - 32, height - 32) end # def #------------------------------------------------------------------------ # * Refresh # quest : The quest which information will be drawn #------------------------------------------------------------------------ def refresh(quest) # Resets the position of the bitmap self.oy = 0 # Splits the info into lines info = quest.info.split(/\n/) # Disposes of the old bitmap self.contents.dispose # Creates an appropriately big bitmap self.contents = Bitmap.new(width - 32, info.size*32+16) # Clears the bitmap self.contents.clear # Sets the text color to the standard color (White) self.contents.font.color = text_color(0) # Draws all the lines except the last on for i in 0...info.size - 1 text = info[i].dup text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] } self.contents.draw_text(0, i*32, 480, 32, text) end # for # Sets the text color to yellow self.contents.font.color = text_color(6) # Only prints the last info if there actually are something to print if info[-1].is_a?(String) text = info[-1].dup text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] } # The last line of the info (if any is present) is consider as the # goal and positioned a bit different, centered and drawn in yellow. self.contents.draw_text(0, info.size*32-22, 440, 32, text, 1) end # if end # def #------------------------------------------------------------------------ # * Update #------------------------------------------------------------------------ def update # Calls the parent method super # Checks if the text is big enough for scrolling to be necessary if self.contents.height > height # Moves the text up if the UP key is pressed. (Warps) if Input.repeat?(Input::UP) self.oy = (self.oy - 10) % (self.contents.height - height + 64) end # if # Moves the text down if the DOWN key is pressed. (Warps) if Input.repeat?(Input::DOWN) self.oy = (self.oy + 10) % (self.contents.height - height + 64) end # if end # if end # def end # class #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(80, 60, 480, 360) # Puts this on top of the other windoes self.z = 200 # Creates the Bitmap self.contents = Bitmap.new(width - 32, height - 32) # Creates the detail part. @details = Details.new # The details window is by standard not immediately visible @details.visible = false end # def #-------------------------------------------------------------------------- # * Refresh # quest : The quest which information will be drawn (Game_Quest) #-------------------------------------------------------------------------- def refresh(quest) return unless quest.is_a?(Game_Quest) # Gets the current_quest part current_quest = quest.current_quest # Redraw text (the top part) self.contents.clear # Draws who gave the current quest part self.contents.font.color = text_color(7) self.contents.font.bold = false self.contents.draw_text(0, 0, 440, 32, current_quest.owner, 1) # Draws the area self.contents.font.color = text_color(1) self.contents.draw_text(0, 32, 440, 32, current_quest.location, 1) # Draws a seperator line self.contents.font.color = text_color(0) self.contents.draw_text(0, 8, 480, 32, "__________________________________________", 1) # Refreshes the details. @details.refresh(current_quest) end # def #-------------------------------------------------------------------------- # * Update #-------------------------------------------------------------------------- def update # Calls the parent method super # Updates the details if it is visible @details.visible = self.visible @details.update end # def end # class #============================================================================== # ** Window_Questbook #------------------------------------------------------------------------------ # This window designates the quest selection on the questbook screen. #============================================================================== class Window_Questbook < Window_Selectable # Constants MAIN_MENU_ICON_PATH = "Quest/Icons/mainmenu.png" # Attributes #attr_accessor :active_quests # Tells whether active quests are show or not #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(questset) super(0, 128, 640, 352) # Saves the quest set given @data = questset # Old data (stores refrences to old data) @old_data = {} # Amount of items @item_max = @data.size # The amount of items on each line (Items per row) @column_max = 6 # Starts on index 0 (Top-Left) @index = 0 # Active quests are shown at start up @active_quests = true # Creates Bitmap self.contents = Bitmap.new(width - 32, @item_max / @column_max * 96 + 96) refresh end # def #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh # Redraw text self.contents.clear # Draws the icons for i in 0...@item_max draw_icon(i,@data[i].current_quest.get_icon) end # for # Checks if there is a mainmenu icon if @active_quests # An extra icon is drawn with the main menu icon (Another item) @item_max = @data.size + 1 draw_icon(@item_max - 1, MAIN_MENU_ICON_PATH) else # There are as many items as there are quests in the data @item_max = @data.size end # if # Checks if there are any items if @item_max == 0 # Removes the cursor when there are no item @index = -1 elsif @index == -1 # Sets the cursor to the first element @index = 0 end # if end # def #-------------------------------------------------------------------------- # * Draws the icon of the quest at the i'th space #-------------------------------------------------------------------------- def draw_icon(i, icon_name) # Calculates the x- and y-coordinates x = (i % @column_max) * 99 + 16 y = (i / @column_max) * 96 - 10 # Draws the given quest icon at the given position draw_quest_icon(icon_name, x, y + 18) end # def #-------------------------------------------------------------------------- # * Sets a new set quests as data #-------------------------------------------------------------------------- def set_data(questset, active_quests) if questset == @data && active_quests == @active_quests return end # Stores old data @old_data[[@data,@active_quests]] = self.contents # Sets whether or not the questset is of the active quests @active_quests = active_quests # Sets the questset as data @data = questset # Amount of items @item_max = @data.size # Creates Bitmap if @old_data[[@data,@active_quests]] != nil self.contents = @old_data[[@data,@active_quests]] else self.contents = Bitmap.new(width - 32, @item_max / @column_max * 96 + 96) end # Refreshes (redraws) the window with the new data refresh end #-------------------------------------------------------------------------- # * Update Cursor Rectangle #-------------------------------------------------------------------------- def update_cursor_rect # If cursor position is less than 0 if @index < 0 self.cursor_rect.empty return end # if # Get current row row = @index / @column_max # If current row is before top row if row < self.top_row # Scroll so that current row becomes top row self.top_row = row end # if # If current row is more to back than back row if row > self.top_row + (self.page_row_max - 1) # Scroll so that current row becomes back row self.top_row = row - (self.page_row_max - 1) end # if # Calculate cursor coordinates x = (@index % @column_max) * 99 + 8 #112 y = (@index / @column_max) * 96 - self.oy self.cursor_rect.set(x, y, 96, 96) end # def #-------------------------------------------------------------------------- # * Get Top Row #-------------------------------------------------------------------------- def top_row # Divide y-coordinate of window contents transfer origin by 1 row # height of 96 return self.oy / 96 end # def #-------------------------------------------------------------------------- # * Set Top Row # row : row shown on top #-------------------------------------------------------------------------- def top_row=(row) row = row % row_max self.oy = row * 96 end # def #-------------------------------------------------------------------------- # * Get Number of Rows Displayable on 1 Page #-------------------------------------------------------------------------- def page_row_max # Subtract a frame height of 32 from the window height, and divide it by # 1 row height of 96 return (self.height - 32) / 96 end # def #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def dispose super # Disposes the stored bitmaps @old_data.each_value {|value| value.dispose} end end # class #============================================================================== # ** Questbook #------------------------------------------------------------------------------ # Zeriab # 1.2 # 2007-10-01 (year-month-day) #============================================================================== #============================================================================== # ** Scene_Questbook #------------------------------------------------------------------------------ # This window designates the quest selection on the questbook screen. #============================================================================== class Scene_Questbook #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(scene = Scene_Menu.new) # Gets the active quests @active_questset = $game_quests.get_active_quests # Gets the completed quests @completed_questset = $game_quests.get_completed_quests # Starts at the main_menu @last_index = 0 # The completed quests starts in the top-left corner @other_index = 0 # Active quests are shown when the questlog has opened @active_quests = true # Sets the current quest set @current_questset = @active_questset # The next scene it will skip to is the scene given @next_scene = scene end # def #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # The background image @back_sprite = Sprite.new(Viewport.new(0,0,640,480)) picname = BACK_PICS[$game_variables[bACK_VAR]] unless picname.is_a?(String) picname = BACK_PICS["standard"] end @back_sprite.bitmap = RPG::Cache.picture(BACKGROUND_DIR+picname) # Quest selection window @quest_select = Window_Questbook.new(@current_questset) @quest_select.opacity = WINDOW_OPACITY # Quest info-header window @quest_header = Window_Questbook_Header.new(@current_questset[0]) @quest_header.opacity = WINDOW_OPACITY # Quest information window @quest_info = Window_Questbook_Info.new @quest_info.opacity = WINDOW_OPACITY @quest_info.visible = false # Execute transition Graphics.transition # Scene Objects @scene_objects = [@back_sprite, @quest_select, @quest_header, @quest_info] # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Updates Scene Objects @scene_objects.each { |x| x.update} ## Frame update update # Abort loop if screen is changed break if $scene != self end # loop # Prepare for transition Graphics.freeze # Dispose Scene Objects @scene_objects.each { |x| x.dispose } end # def #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def switch # Switch to the previously remembered index (In case L or R was used) tmp = @quest_select.index @quest_select.index = @other_index @other_index = tmp # Plays the Cursor sound effect $game_system.se_play($data_system.cursor_se) # Checks if there are active quests shown if @active_quests # Completed quests is to be shown. (Active quest NOT shown) @active_quests = false # Sets the current questset to the completed questset @current_questset = @completed_questset else # Active quests is to be shown. @active_quests = true # Sets the current questset to the active questset @current_questset = @active_questset end # if # Sets the data in the selection window @quest_select.set_data(@current_questset, @active_quests) # Checks if there are any fields if @quest_select.index > -1 # Opdates the header @quest_header.refresh(@current_questset[0]) else # Opdates the header @quest_header.refresh(1) end # if end # def #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # If RIGHT Button Is Pressed if Input.trigger?(Input::RIGHT) && !@quest_info.visible # Checks if there are any items to select. if @quest_select.index <= -1 # Switches between active and completed quests switch end # if end # if # If LEFT Button Is Pressed if Input.trigger?(Input::LEFT) && !@quest_info.visible # Checks if the last index is the same as the current. (All left) if @last_index == @quest_select.index || @quest_select.index <= -1 # Switches between active and completed quests switch end # if end # if # Checks if the index in @quest_select have changed if @last_index != @quest_select.index && @quest_select.index > -1 # Updates the last_index @last_index = @quest_select.index # Updates the header @quest_header.refresh(@current_questset[@last_index]) end # if # If C Button Is Pressed if Input.trigger?(Input::C) && @quest_select.index > -1 # Checks if the main menu icon is present if @active_quests # Checks that a quest is not select. (So it must be the main menu) if (@quest_select.index >= $game_quests.get_active_quests.size) # Plays the Cancel sound effect $game_system.se_play($data_system.cancel_se) # Changes the scene to the main menu $scene = Scene_Menu.new # Stops processing this method return end # if end # if # Plays the Decision sound effect $game_system.se_play($data_system.decision_se) # Change the visibility of the quest_info # Visible => Invisible, Invisible => Visible @quest_info.visible = !@quest_info.visible # The quest select is not active if the info is visible, else it is @quest_select.active = !@quest_info.visible # Refreshes the quest info @quest_info.refresh(@current_questset[@quest_select.index]) end # if # If B Button Is Pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Switch to next scene $scene = @next_scene unless @quest_info.visible # Changes the quest info to become invisible @quest_info.visible = false # The quest select is active as the info is not visible @quest_select.active = true # Refreshes the quest info @quest_info.refresh(@current_questset[@quest_select.index]) # Stops processing this method return end # if # If L Button Is Pressed if Input.trigger?(Input::L) switch end # if # If R Button Is Pressed if Input.trigger?(Input::R) switch end # if end # def end # class #============================================================================== # ** Scene_Load #------------------------------------------------------------------------------ # Aliases and uses the on_decision method to reset $game_quests on the proper # time. #============================================================================== class Scene_Load < Scene_File # Check if the alias already exists (To avoid F12 errors) unless self.method_defined?(:zeriab_questbook_scene_load_on_decision) alias zeriab_questbook_scene_load_on_decision :on_decision end def on_decision(*args) # Call the original method zeriab_questbook_scene_load_on_decision(*args) # Check if the scene has changed unless $scene == self # Reset quest data $game_quests.reset end end end Leon's Awesome Mission Script. #=================================== # Leon's Mission Script v2.0 #---------------------------------------------------------------------- # 2006-09-22 #=================================== =begin Description: I did a drastic overhaul on this Mission/Quest script to make it much better and user friendly. Features: There is 2 new features: 1. If the user doesn't know of the mission, it doesn't appear in the list, nor does a slot for it. 2. Completed missions are in green. 3. Number of missions. (X/Y) X is completed missions, Y can be either known missions, or your game's total missions. Set Mission_Setup to 'true' if you want known missions, false for total. Instructions: Put it above main. The instructions have changed alot more than the features. Just go through the short list below, and you'll know. Just remember, go in order, and if you have 10 different missions in 1 spot, you must have the same number in each other segment of the module, with the exception of the lines of text. (Yes, i made that one all the easier.) Changing the status of the missions is different than before as well. $game_party.mission[mission_id] = x Mission ID: The ID of the mission, as defined in the module. In this example, "Lost Cat" would be 0 X: 1 = they do not know the mission exists. This is optional, unless they forget a mission. 2 = they know the mission, but it is incomplete 3 = the mission is complete. BY DEFAULT, ALL MISSIONS ARE UNKNOWN unless specified in the script before the game begins. Do NOT post my work in any other forums without my permission, and NEVER take credit for my work. =end #================================== # ** Mission_Menu #================================== module Mission_Menu #-------------------------------------------------------------------- # * Mission Name- Write the mission number, and the name you want to appear. # ~ mission_id => "mission name" #-------------------------------------------------------------------- Mission_Name = { 0 => "Lost Cat", 1 => "Old Blade", 2 => "Seize Sentries", 3 => "Hidden Heirloom", 4 => "A Gooey Mess.", 5 => "Hidden Horror" } #-------------------------------------------------------------------- # * Mission_Sprite. holds data on the name of the sprite, it's hue, name, locale, and # * reward all in one. # ~ mission_id => ["sprite name", hue, name, location, Reward] #-------------------------------------------------------------------- Mission_Sprite = { 0 => ["113-Civilian13", 330, "Amy", "Logres", "Potion x 3"], 1 => ["005-Fighter05", 0, "L'eric", "Logres", "Rusty Sword"], 2 => ["002-Fighter02", 0, "Wallace", "Resistance H.Q.", "500 Gold"], 3 => ["122-Civilian22", 30, "Old Woman", "Cyris Home", "Sound Effect"], 4 => ["011-Lancer03", 0, "Soldier", "Cyris Barracks", "Kite Shield"], 5 => ["006-Fighter06", 0, "Lady", "Cyris", "Lion's Head Earring"] } #-------------------------------------------------------------------- # * Defines the mission. Remember, if it is too long for 1 line, you can drop it # * down to line 2. # ~ mission_id => "Line One" #-------------------------------------------------------------------- Mission_L1 = { 0 => "Amy has lost her cat and needs help", 1 => "Somebody said they saw L'eric's blade", 2 => "Head north toward enemy territory, and", 3 => "Seek out the caverns south of Cyris. There", 4 => "A monster to the west of the town every", 5 => "Somewhere in the Belin Caverns, there is a" } #-------------------------------------------------------------------- # * Same as the above one. # ~ mission_id => "Line Two" #-------------------------------------------------------------------- Mission_L2 = { 0 => "finding him. He likes to play in the", 1 => "just south of here by the river. He ", 2 => "capture two sentry towers. Be careful ", 3 => "you will find a blue chest. Retrieve its", 4 => "now and then terrorizes the caravans.", 5 => "creature holding an item the lady in" } #-------------------------------------------------------------------- # * Same as the above one. # ~ mission_id => "Line Three" #-------------------------------------------------------------------- Mission_L3 = { 0 => " North East side of Tiberian Plains.", 1 => "wants Will to confirm the story, and", 2 => "and don't get caught. Return to Wallace", 3 => "contents and bring it back to the old", 4 => "A soldier in the barracks has asked you", 5 => "Cyris is looking for. She said the monster" } #-------------------------------------------------------------------- # * Same as the above one. # ~ mission_id => "Line Four" #-------------------------------------------------------------------- Mission_L4 = { 1 => "if it is true, bring back the sword.", 2 => "once this job is complete.", 3 => "woman.", 4 => "to exterminate it.", 5 => "would be hiding." } #-------------------------------------------------------------------- # * Same as the above one. # ~ mission_id => "Line Five" #-------------------------------------------------------------------- Mission_L5 = { } #-------------------------------------------------------------------- # * Same as the above one. # ~ mission_id => "Line Six" #-------------------------------------------------------------------- Mission_L6 = { } #-------------------------------------------------------------------- # * Same as the above one. # ~ mission_id => "Line Seven" #-------------------------------------------------------------------- Mission_L7 = { } #-------------------------------------------------------------------- # * Same as the above one. # ~ mission_id => "Line Eight" #-------------------------------------------------------------------- Mission_L8 = { } #-------------------------------------------------------------------- # * Mission Set-up #-------------------------------------------------------------------- Mission_Setup = true end #---------------------------------------------------------------------- # * Game_Party #---------------------------------------------------------------------- class Game_Party #-------------------------------------------------------------------- # * Attributes #-------------------------------------------------------------------- attr_accessor :mission #-------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------- alias leon_gp_mission_initialize initialize #-------------------------------------------------------------------- # * Object initialization #-------------------------------------------------------------------- # Leon_Edit add an array for each mission in @mission. # [mission_id, 1] #-------------------------------------------------------------------- def initialize leon_gp_mission_initialize @mission = { 0 => 1, 1 => 2, 2 => 3, 3 => 2 } end end #-------------------------------------------------------------------- # * Ends Game_Party #-------------------------------------------------------------------- #---------------------------------------------------------------------- # * Window_Missionhelp #---------------------------------------------------------------------- class Window_Missionhelp < Window_Base #-------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------- def initialize super(0, 0, 400, 60) self.contents = Bitmap.new(width - 32, height - 32) end #-------------------------------------------------------------------- # * Update #-------------------------------------------------------------------- def update(help_text) self.contents.clear self.contents.draw_text(0, 0, 440, 32, help_text) end end #---------------------------------------------------------------------- # * End Window_Missionhelp #---------------------------------------------------------------------- #---------------------------------------------------------------------- # Window_MissionNum #---------------------------------------------------------------------- class Window_MissionNum < Window_Base #-------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------- def initialize super(400, 0, 240, 64) self.contents = Bitmap.new(width - 32, height - 32) refresh end #-------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------- def refresh self.contents.clear mis = Mission_Menu self.contents.font.color = system_color self.contents.draw_text(0, 0, 120, 32, "Missions:") self.contents.font.color = normal_color @mission_comp = [] @mission_know = [] #Calls Mission number of completed missions for i in 0...$game_party.mission.keys.size if $game_party.mission[$game_party.mission.keys[i]] == 3 @mission_comp.push(i) end end #Calls Mission number of missions for j in 0...$game_party.mission.keys.size if $game_party.mission[$game_party.mission.keys[j]] > 1 @mission_know.push(j) end end #if Mission_Setup is false... if mis::Mission_Setup == false if @mission_comp.size == $game_party.mission.size self.contents.font.color = Color.new(40, 250, 40, 255) self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s + "/" + $game_party.mission.size.to_s, 2) self.contents.font.color = normal_color else self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s + "/" + $game_party.mission.size.to_s, 2) end #if Mission_Setup is true... elsif mis::Mission_Setup == true if @mission_comp.size == @mission_know.size self.contents.font.color = Color.new(40, 250, 40, 255) self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s + "/" + @mission_know.size.to_s, 2) self.contents.font.color = normal_color else self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s + "/" + @mission_know.size.to_s, 2) end end end end #---------------------------------------------------------------------- # * End Window_Missionnum #---------------------------------------------------------------------- #---------------------------------------------------------------------- # Window_Missionlist #---------------------------------------------------------------------- class Window_Missionlist < Window_Selectable #-------------------------------------------------------------------- # * Attribute listings #-------------------------------------------------------------------- attr_accessor :mission #-------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------- def initialize super(0, 60, 260, 420) self.contents = Bitmap.new(width - 32, height - 32) self.index = 0 refresh end #-------------------------------------------------------------------- # * Mission #-------------------------------------------------------------------- def mission return @data[self.index] end #-------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end mis = Mission_Menu @data = [] for i in 0...$game_party.mission.keys.size if $game_party.mission[$game_party.mission.keys[i]] > 1 @data.push($game_party.mission.keys[i]) end end @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max draw_item(i) end end end #-------------------------------------------------------------------- # * Draw_Item #-------------------------------------------------------------------- def draw_item(index) mis = Mission_Menu mission_name = @data[index] x = 4 y = index * 32 rect = Rect.new(x, y, self.width - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) if $game_party.mission[mission_name] == 3 self.contents.font.color = Color.new(40, 250, 40, 255) self.contents.draw_text(x, y, 228, 32, mis::Mission_Name[mission_name]) else self.contents.font.color = normal_color self.contents.draw_text(x, y, 228, 32, mis::Mission_Name[mission_name]) end end end #---------------------------------------------------------------------- # * End Window_Missionlist #---------------------------------------------------------------------- #---------------------------------------------------------------------- # Window_Missioncomp #---------------------------------------------------------------------- class Window_Missioncomp < Window_Base #-------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------- def initialize(mission) super(260, 365, 380, 115) self.contents = Bitmap.new(width - 32, height - 32) refresh(mission) end #-------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------- def refresh(mission) self.contents.clear self.contents.font.color = system_color self.contents.draw_text(0, 52, 440, 32, "Status:") self.contents.draw_text(170, 52, 440, 32, "Reward:") self.contents.font.color = normal_color #person place status reward mis = Mission_Menu if mis::Mission_Sprite.has_key?(mission) if $game_party.mission[mission] > 1 self.contents.draw_text(36, 6, 440, 32, mis::Mission_Sprite[mission][2] + ", " + mis::Mission_Sprite[mission][3]) case $game_party.mission[mission] when 1 self.contents.draw_text(62, 52, 400, 32, "") when 2 self.contents.draw_text(62, 52, 400, 32, "Incomplete") self.contents.draw_text(242, 52, 138, 32, "Unknown") when 3 self.contents.font.color = Color.new(40, 250, 40, 255) self.contents.draw_text(62, 52, 400, 32, "Complete") self.contents.draw_text(242, 52, 138, 32, mis::Mission_Sprite[mission][4]) end bitmap = RPG::Cache.character(mis::Mission_Sprite[mission][0], mis::Mission_Sprite[mission][1]) cw = bitmap.width / 4 ch = bitmap.height / 4 facing = 0 src_rect = Rect.new(0, facing * ch, cw, ch) self.contents.blt(0, 0, bitmap, src_rect) end end end def clear self.contents.clear end end #-------------------------------------------------------------------- # * Ends Window_Missioncomp #-------------------------------------------------------------------- #---------------------------------------------------------------------- # Window_Missiondesc #---------------------------------------------------------------------- class Window_Missiondesc < Window_Base #-------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------- def initialize(mission) super(260, 60, 380, 305) self.contents = Bitmap.new(width - 32, height - 32) end #-------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------- def refresh(mission) self.contents.clear mis = Mission_Menu self.contents.draw_text(0, 0, 348, 32, mis::Mission_L1[mission].to_s) self.contents.draw_text(0, 32, 348, 32, mis::Mission_L2[mission].to_s) self.contents.draw_text(0, 64, 348, 32, mis::Mission_L3[mission].to_s) self.contents.draw_text(0, 96, 348, 32, mis::Mission_L4[mission].to_s) self.contents.draw_text(0, 128, 348, 32, mis::Mission_L5[mission].to_s) self.contents.draw_text(0, 160, 348, 32, mis::Mission_L6[mission].to_s) self.contents.draw_text(0, 192, 348, 32, mis::Mission_L7[mission].to_s) self.contents.draw_text(0, 224, 348, 32, mis::Mission_L8[mission].to_s) end end #-------------------------------------------------------------------- # * Ends Window_Missiondesc #-------------------------------------------------------------------- #==================================== # Scene_MissionMenu #==================================== class Scene_MissionMenu #-------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index end #-------------------------------------------------------------------- # * Main #-------------------------------------------------------------------- def main @missionhelp_window = Window_Missionhelp.new @missionlist_window = Window_Missionlist.new @missionnum_window = Window_MissionNum.new @missioncomp_window = Window_Missioncomp.new(@missionlist_window.mission) @missiondesc_window = Window_Missiondesc.new(@missionlist_window.mission) @mission = @missionlist_window.mission @missiondesc_window.refresh(@missionlist_window.mission) @missioncomp_window.refresh(@missionlist_window.mission) Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @missionhelp_window.dispose @missiondesc_window.dispose @missioncomp_window.dispose @missionlist_window.dispose @missionnum_window.dispose end #-------------------------------------------------------------------- # * Update #-------------------------------------------------------------------- def update mis = Mission_Menu @missionlist_window.update @missionnum_window.update @missionhelp_window.update("Select a mission to see details.") if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN) or Input.repeat?(Input::DOWN) or Input.repeat?(Input::UP) @missiondesc_window.refresh(@missionlist_window.mission) @missioncomp_window.refresh(@missionlist_window.mission) end if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new end end end #-------------------------------------------------------------------- # * Ends Scene_Missionmenu #-------------------------------------------------------------------- Game Guy's Quest Log System. #=============================================================================== # Quest Log System # Author game_guy # Version 3.0 #------------------------------------------------------------------------------- # Intro: # A script that keeps track of quests you obtain and complete. # # Features: # Marks quest names with a yellow color if they're completed # Easy to setup one quest # Be able to use a fairly long description # Be able to display a picture # Easy to add and complete a quest # More compatible than earlier versions # # Instructions: # Scroll down a bit until you see # Being Config. Follow the instructions there. # Scroll below that and you'll see Begin Quest Setup. Follow the steps there. # # Script Calls: # Quest.add(id) ~ Adds the quest(id) to the parties quests. # Quest.take(id) ~ Takes the quest(id) from the party. # Quest.complete(id) ~ Makes the quest(id) completed. # Quest.completed?(id) ~ Returns true if the quest(id) is completed. # Quest.has?(id) ~ Returns true if the party has quest(id). # $scene = Scene_Quest.new ~ Opens the quest menu. # # Credits: # game_guy ~ for making it # Beta Testers ~ Sally and Landith # Blizzard ~ Small piece of code I borrowed from his bestiary #=============================================================================== module GameGuy #================================================== # Begin Config # UsePicture ~ true means it'll show pictures in # the quests, false it wont. #================================================== UsePicture = false def self.qreward(id) case id #================================================== # Quest Reward # Use when x then return "Reward" # x = id, Reward = reward in quotes #================================================== when 1 then return "100 Gold" when 2 then return "3 Potions" when 3 then return "Strength Ring" end return "????" end def self.qpicture(id) case id #================================================== # Quest Picture # Use when x then return "picture" # x = id, picture = picutre name in quotes #================================================== when 1 then return "ghost" end return nil end def self.qname(id) case id #================================================== # Quest Name # Use when x then return "name" # x = id, name = quest name in quotes #================================================== when 1 then return "Village Hunt" when 2 then return "Pay Tab" when 3 then return "Hunting Knife" end return "" end def self.qlocation(id) case id #================================================== # Quest Location # Use when x then return "location" # x = id, location = location in quotes #================================================== when 1 then return "Arton Woods" when 2 then return "Eeka" when 3 then return "Eeka" end return "????" end def self.qdescription(id) case id #================================================== # Quest Description # Use when x then return "description" # x = id, description = quest description in quotes #================================================== when 1 then return "Extremely LOOOOOOOOOOONNNNNNGGGGGGGG quest description as you can see this goes on for awhile. :P:P:P:P:P" when 2 then return "Bring gold to Jarns Defense to pay her tab." when 3 then return "Go get Kip a hunting knife from Eeka." end return "" end end module Quest def self.add(id) $game_party.add_quest(id) end def self.take(id) $game_party.take_quest(id) end def self.complete(id) $game_party.complete(id) end def self.completed?(id) return $game_party.completed?(id) end def self.has?(id) return $game_party.has_quest?(id) end end class Game_Party attr_accessor :quests attr_accessor :completed alias gg_quests_lat initialize def initialize @quests = [] @completed = [] gg_quests_lat end def add_quest(id) unless @quests.include?(id) @quests.push(id) end end def completed?(id) return @completed.include?(id) end def complete(id) unless @completed.include?(id) if @quests.include?(id) @completed.push(id) end end end def has_quest?(id) return @quests.include?(id) end def take_quest(id) @quests.delete(id) @completed.delete(id) end end class Scene_Quest def main @quests = [] for i in $game_party.quests @quests.push(GameGuy.qname(i)) end @map = Spriteset_Map.new @quests2 = [] for i in $game_party.quests @quests2.push(i) end @quests_window = Window_Command.new(160, @quests) @quests_window.height = 480 @quests_window.back_opacity = 110 Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end @quests_window.dispose @quest_info.dispose if @quest_info != nil @map.dispose end def update @quests_window.update if @quests_window.active update_quests return end if @quest_info != nil update_info return end end def update_quests if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Menu.new return end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) @quest_info = Window_QuestInfo.new(@quests2[@quests_window.index]) @quest_info.back_opacity = 110 @quests_window.active = false return end end def update_info if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @quests_window.active = true @quest_info.dispose @quest_info = nil return end end end class Window_QuestInfo < Window_Base def initialize(quest) super(160, 0, 480, 480) self.contents = Bitmap.new(width - 32, height - 32) @quest = quest refresh end def refresh self.contents.clear if GameGuy::UsePicture pic = GameGuy.qpicture(@quest) bitmap = RPG::Cache.picture(GameGuy.qpicture(@quest)) if pic != nil rect = Rect.new(0, 0, bitmap.width, bitmap.height) if pic != nil self.contents.blt(480-bitmap.width-32, 0, bitmap, rect) if pic != nil end self.contents.font.color = system_color self.contents.draw_text(0, 0, 480, 32, "Quest:") self.contents.font.color = normal_color self.contents.draw_text(0, 32, 480, 32, GameGuy.qname(@quest)) self.contents.font.color = system_color self.contents.draw_text(0, 64, 480, 32, "Reward:") self.contents.font.color = normal_color self.contents.draw_text(0, 96, 480, 32, GameGuy.qreward(@quest)) self.contents.font.color = system_color self.contents.draw_text(0, 128, 480, 32, "Location:") self.contents.font.color = normal_color self.contents.draw_text(0, 160, 480, 32, GameGuy.qlocation(@quest)) self.contents.font.color = system_color self.contents.draw_text(0, 192, 480, 32, "Completion:") self.contents.font.color = normal_color if $game_party.completed.include?(@quest) self.contents.font.color = crisis_color self.contents.draw_text(0, 224, 480, 32, "Completed") else self.contents.font.color = normal_color self.contents.draw_text(0, 224, 480, 32, "In Progress") end self.contents.font.color = system_color self.contents.draw_text(0, 256, 480, 32, "Description:") self.contents.font.color = normal_color text = self.contents.slice_text(GameGuy.qdescription(@quest), 460) text.each_index {|i| self.contents.draw_text(0, 288 + i*32, 460, 32, text[i])} end end class Bitmap def slice_text(text, width) words = text.split(' ') return words if words.size == 1 result, current_text = [], words.shift words.each_index {|i| if self.text_size("#{current_text} #{words[i]}").width > width result.push(current_text) current_text = words[i] else current_text = "#{current_text} #{words[i]}" end result.push(current_text) if i >= words.size - 1} return result end end Share this post Link to post Share on other sites
Broken Messiah 20 Report post Posted June 29, 2010 Didn't know this many existed. WOW Share this post Link to post Share on other sites
Kiriashi 117 Report post Posted June 29, 2010 There's actually quite a few more. You just need to look around. ^_^ Share this post Link to post Share on other sites
fizzycandy 0 Report post Posted June 29, 2010 thanks guys i really appreciate it :) Share this post Link to post Share on other sites