Quest system v0.9 - Printable Version +- Save-Point (https://www.save-point.org) +-- Forum: Archives (https://www.save-point.org/forum-105.html) +--- Forum: Creation Asylum Archives (https://www.save-point.org/forum-90.html) +---- Forum: Scripts & Code Snippets (https://www.save-point.org/forum-92.html) +----- Forum: RPG Maker VX Code (https://www.save-point.org/forum-101.html) +----- Thread: Quest system v0.9 (/thread-7059.html) |
Quest system v0.9 - elbrunito - 10-02-2008 This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss. No support is given. If you are the owner of the thread, please contact administration. I've made a script for my own rpg, a simple Quest system you can found in any game. Download the demonstration, and copy the scripts from there, in the materials section. This is an "alpha-almost-beta" version. It works fine, but there are many things to add (I haven't thought about them yet). The essentials of a Quest in this Quest system are: 1.- The name of the quest 2.- The description of the quest (which one you'll be modifiying as the quest is updated, scripted in an event) 3.- The difficulty of the quest (just orientative, how much complex is it) 4.- If can it be repeated or not (this is not supported right now, but it's the next thing i'll implement) 5.- In which state the quest is (You don't know anything about it; you know something, but can't start with it; you're in the middle of the quest; you have completed the quest) You can modify any of these parameters at any moment, using a script. If you want to fully control this quest system, just see both Quest_System and Quest classes, and that's all. Using Quest_System_Vocab, you can translate the quest script to your language, just changing those words in that module. Note that there's a graphic you must add to your project: tick.png. It's placed in Graphics->Pictures. I'm working right now in a way of presenting the description of the quest using multiple lines (right now, it will write everything in one line). This is the code to add to your game, if you want to have it all in one simple script (I really don't recommend it, just download the demo and copy the materials...): code #============================================================================== # ** Scene_Title #------------------------------------------------------------------------------ # This class performs the title screen processing. # Quest System modification in lines: # 128: $game_quests = QuestSystem.new #============================================================================== class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main if $BTEST # If battle test battle_test # Start battle test else # If normal play super # Usual main processing end end #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start super load_database # Load database create_game_objects # Create game objects check_continue # Determine if continue is enabled create_title_graphic # Create title graphic create_command_window # Create command window play_title_music # Play title screen music end #-------------------------------------------------------------------------- # * Execute Transition #-------------------------------------------------------------------------- def perform_transition Graphics.transition(20) end #-------------------------------------------------------------------------- # * Post-Start Processing #-------------------------------------------------------------------------- def post_start super open_command_window end #-------------------------------------------------------------------------- # * Pre-termination Processing #-------------------------------------------------------------------------- def pre_terminate super close_command_window end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super dispose_command_window snapshot_for_background dispose_title_graphic end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super @command_window.update if Input.trigger?(Input::C) case @command_window.index when 0 #New game command_new_game when 1 # Continue command_continue when 2 # Shutdown command_shutdown end end end #-------------------------------------------------------------------------- # * Load Database #-------------------------------------------------------------------------- def load_database $data_actors = load_data("Data/Actors.rvdata") $data_classes = load_data("Data/Classes.rvdata") $data_skills = load_data("Data/Skills.rvdata") $data_items = load_data("Data/Items.rvdata") $data_weapons = load_data("Data/Weapons.rvdata") $data_armors = load_data("Data/Armors.rvdata") $data_enemies = load_data("Data/Enemies.rvdata") $data_troops = load_data("Data/Troops.rvdata") $data_states = load_data("Data/States.rvdata") $data_animations = load_data("Data/Animations.rvdata") $data_common_events = load_data("Data/CommonEvents.rvdata") $data_system = load_data("Data/System.rvdata") $data_areas = load_data("Data/Areas.rvdata") end #-------------------------------------------------------------------------- # * Load Battle Test Database #-------------------------------------------------------------------------- def load_bt_database $data_actors = load_data("Data/BT_Actors.rvdata") $data_classes = load_data("Data/BT_Classes.rvdata") $data_skills = load_data("Data/BT_Skills.rvdata") $data_items = load_data("Data/BT_Items.rvdata") $data_weapons = load_data("Data/BT_Weapons.rvdata") $data_armors = load_data("Data/BT_Armors.rvdata") $data_enemies = load_data("Data/BT_Enemies.rvdata") $data_troops = load_data("Data/BT_Troops.rvdata") $data_states = load_data("Data/BT_States.rvdata") $data_animations = load_data("Data/BT_Animations.rvdata") $data_common_events = load_data("Data/BT_CommonEvents.rvdata") $data_system = load_data("Data/BT_System.rvdata") end #-------------------------------------------------------------------------- # * Create Game Objects #-------------------------------------------------------------------------- def create_game_objects $game_temp = Game_Temp.new $game_message = Game_Message.new $game_system = Game_System.new $game_switches = Game_Switches.new $game_variables = Game_Variables.new $game_self_switches = Game_SelfSwitches.new $game_actors = Game_Actors.new $game_party = Game_Party.new $game_troop = Game_Troop.new $game_map = Game_Map.new $game_player = Game_Player.new $game_quests = Quest_System.new end #-------------------------------------------------------------------------- # * Determine if Continue is Enabled #-------------------------------------------------------------------------- def check_continue @continue_enabled = (Dir.glob('Save*.rvdata').size > 0) end #-------------------------------------------------------------------------- # * Create Title Graphic #-------------------------------------------------------------------------- def create_title_graphic @sprite = Sprite.new @sprite.bitmap = Cache.system("Title") end #-------------------------------------------------------------------------- # * Dispose of Title Graphic #-------------------------------------------------------------------------- def dispose_title_graphic @sprite.bitmap.dispose @sprite.dispose end #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window s1 = Vocab::new_game s2 = Vocab::continue s3 = Vocab::shutdown @command_window = Window_Command.new(172, [s1, s2, s3]) @command_window.x = (544 - @command_window.width) / 2 @command_window.y = 288 if @continue_enabled # If continue is enabled @command_window.index = 1 # Move cursor over command else # If disabled @command_window.draw_item(1, false) # Make command semi-transparent end @command_window.openness = 0 @command_window.open end #-------------------------------------------------------------------------- # * Dispose of Command Window #-------------------------------------------------------------------------- def dispose_command_window @command_window.dispose end #-------------------------------------------------------------------------- # * Open Command Window #-------------------------------------------------------------------------- def open_command_window @command_window.open begin @command_window.update Graphics.update end until @command_window.openness == 255 end #-------------------------------------------------------------------------- # * Close Command Window #-------------------------------------------------------------------------- def close_command_window @command_window.close begin @command_window.update Graphics.update end until @command_window.openness == 0 end #-------------------------------------------------------------------------- # * Play Title Screen Music #-------------------------------------------------------------------------- def play_title_music $data_system.title_bgm.play RPG::BGS.stop RPG::ME.stop end #-------------------------------------------------------------------------- # * Check Player Start Location Existence #-------------------------------------------------------------------------- def confirm_player_location if $data_system.start_map_id == 0 print "Player start location not set." exit end end #-------------------------------------------------------------------------- # * Command: New Game #-------------------------------------------------------------------------- def command_new_game confirm_player_location Sound.play_decision $game_party.setup_starting_members # Initial party $game_map.setup($data_system.start_map_id) # Initial map position $game_player.moveto($data_system.start_x, $data_system.start_y) $game_player.refresh $scene = Scene_Map.new RPG::BGM.fade(1500) close_command_window Graphics.fadeout(60) Graphics.wait(40) Graphics.frame_count = 0 RPG::BGM.stop $game_map.autoplay end #-------------------------------------------------------------------------- # * Command: Continue #-------------------------------------------------------------------------- def command_continue if @continue_enabled Sound.play_decision $scene = Scene_File.new(false, true, false) else Sound.play_buzzer end end #-------------------------------------------------------------------------- # * Command: Shutdown #-------------------------------------------------------------------------- def command_shutdown Sound.play_decision RPG::BGM.fade(800) RPG::BGS.fade(800) RPG::ME.fade(800) $scene = nil end #-------------------------------------------------------------------------- # * Battle Test #-------------------------------------------------------------------------- def battle_test load_bt_database # Load battle test database create_game_objects # Create game objects Graphics.frame_count = 0 # Initialize play time $game_party.setup_battle_test_members $game_troop.setup($data_system.test_troop_id) $game_troop.can_escape = true $game_system.battle_bgm.play snapshot_for_background $scene = Scene_Battle.new end end #============================================================================== # ** Scene_Menu #------------------------------------------------------------------------------ # This class performs the menu screen processing. # Quest System modification in lines: # 74: s6 = Quest_System_Vocab::Quests # 75: s7 = Vocab::game_end # 76: @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6,s7]) # 87-89: # if $game_quests.getTotalQuests == 0 # @command_window.draw_item(5, false) # Disable quests # end # 114-117: # when 5 # Quests # $scene = Scene_Quest.new # when 6 # End Game # $scene = Scene_End.new # #============================================================================== class Scene_Menu < Scene_Base #-------------------------------------------------------------------------- # * Object Initialization # menu_index : command cursor's initial position #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index end #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start super create_menu_background create_command_window @gold_window = Window_Gold.new(0, 360) @status_window = Window_MenuStatus.new(160, 0) end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super dispose_menu_background @command_window.dispose @gold_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super update_menu_background @command_window.update @gold_window.update @status_window.update if @command_window.active update_command_selection elsif @status_window.active update_actor_selection end end #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window s1 = Vocab::item s2 = Vocab::skill s3 = Vocab::equip s4 = Vocab::status s5 = Vocab::save s6 = Quest_System_Vocab::Quests s7 = Vocab::game_end @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6,s7]) @command_window.index = @menu_index if $game_party.members.size == 0 # If number of party members is 0 @command_window.draw_item(0, false) # Disable item @command_window.draw_item(1, false) # Disable skill @command_window.draw_item(2, false) # Disable equipment @command_window.draw_item(3, false) # Disable status end if $game_system.save_disabled # If save is forbidden @command_window.draw_item(4, false) # Disable save end if $game_quests.getTotalQuests == 0 @command_window.draw_item(5, false) # Disable quests end end #-------------------------------------------------------------------------- # * Update Command Selection #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) if $game_party.members.size == 0 and @command_window.index < 4 Sound.play_buzzer return elsif $game_system.save_disabled and @command_window.index == 4 Sound.play_buzzer return end Sound.play_decision case @command_window.index when 0 # Item $scene = Scene_Item.new when 1,2,3 # Skill, equipment, status start_actor_selection when 4 # Save $scene = Scene_File.new(true, false, false) when 5 # Quests $scene = Scene_Quest.new when 6 # End Game $scene = Scene_End.new end end end #-------------------------------------------------------------------------- # * Start Actor Selection #-------------------------------------------------------------------------- def start_actor_selection @command_window.active = false @status_window.active = true if $game_party.last_actor_index < @status_window.item_max @status_window.index = $game_party.last_actor_index else @status_window.index = 0 end end #-------------------------------------------------------------------------- # * End Actor Selection #-------------------------------------------------------------------------- def end_actor_selection @command_window.active = true @status_window.active = false @status_window.index = -1 end #-------------------------------------------------------------------------- # * Update Actor Selection #-------------------------------------------------------------------------- def update_actor_selection if Input.trigger?(Input::B) Sound.play_cancel end_actor_selection elsif Input.trigger?(Input::C) $game_party.last_actor_index = @status_window.index Sound.play_decision case @command_window.index when 1 # skill $scene = Scene_Skill.new(@status_window.index) when 2 # equipment $scene = Scene_Equip.new(@status_window.index) when 3 # status $scene = Scene_Status.new(@status_window.index) end end end end #============================================================================== # ** Scene_File #------------------------------------------------------------------------------ # This class performs the save and load screen processing. # Quest System modification in lines: # 228: Marshal.dump($game_quests, file) # 249: $game_quests = Marshal.load(file) # #============================================================================== class Scene_File < Scene_Base #-------------------------------------------------------------------------- # * Object Initialization # saving : save flag (if false, load screen) # from_title : flag: it was called from "Continue" on the title screen # from_event : flag: it was called from the "Call Save Screen" event #-------------------------------------------------------------------------- def initialize(saving, from_title, from_event) @saving = saving @from_title = from_title @from_event = from_event end #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start super create_menu_background @help_window = Window_Help.new create_savefile_windows if @saving @index = $game_temp.last_file_index @help_window.set_text(Vocab::SaveMessage) else @index = self.latest_file_index @help_window.set_text(Vocab::LoadMessage) end @savefile_windows[@index].selected = true end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super dispose_menu_background @help_window.dispose dispose_item_windows end #-------------------------------------------------------------------------- # * Return to Original Screen #-------------------------------------------------------------------------- def return_scene if @from_title $scene = Scene_Title.new elsif @from_event $scene = Scene_Map.new else $scene = Scene_Menu.new(4) end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super update_menu_background @help_window.update update_savefile_windows update_savefile_selection end #-------------------------------------------------------------------------- # * Create Save File Window #-------------------------------------------------------------------------- def create_savefile_windows @savefile_windows = [] for i in 0..3 @savefile_windows.push(Window_SaveFile.new(i, make_filename(i))) end @item_max = 4 end #-------------------------------------------------------------------------- # * Dispose of Save File Window #-------------------------------------------------------------------------- def dispose_item_windows for window in @savefile_windows window.dispose end end #-------------------------------------------------------------------------- # * Update Save File Window #-------------------------------------------------------------------------- def update_savefile_windows for window in @savefile_windows window.update end end #-------------------------------------------------------------------------- # * Update Save File Selection #-------------------------------------------------------------------------- def update_savefile_selection if Input.trigger?(Input::C) determine_savefile elsif Input.trigger?(Input::B) Sound.play_cancel return_scene else last_index = @index if Input.repeat?(Input::DOWN) cursor_down(Input.trigger?(Input::DOWN)) end if Input.repeat?(Input::UP) cursor_up(Input.trigger?(Input::UP)) end if @index != last_index Sound.play_cursor @savefile_windows[last_index].selected = false @savefile_windows[@index].selected = true end end end #-------------------------------------------------------------------------- # * Confirm Save File #-------------------------------------------------------------------------- def determine_savefile if @saving Sound.play_save do_save else if @savefile_windows[@index].file_exist Sound.play_load do_load else Sound.play_buzzer return end end $game_temp.last_file_index = @index end #-------------------------------------------------------------------------- # * Move cursor down # wrap : Wraparound allowed #-------------------------------------------------------------------------- def cursor_down(wrap) if @index < @item_max - 1 or wrap @index = (@index + 1) % @item_max end end #-------------------------------------------------------------------------- # * Move cursor up # wrap : Wraparound allowed #-------------------------------------------------------------------------- def cursor_up(wrap) if @index > 0 or wrap @index = (@index - 1 + @item_max) % @item_max end end #-------------------------------------------------------------------------- # * Create Filename # file_index : save file index (0-3) #-------------------------------------------------------------------------- def make_filename(file_index) return "Save#{file_index + 1}.rvdata" end #-------------------------------------------------------------------------- # * Select File With Newest Timestamp #-------------------------------------------------------------------------- def latest_file_index index = 0 latest_time = Time.at(0) for i in 0...@savefile_windows.size if @savefile_windows[i].time_stamp > latest_time latest_time = @savefile_windows[i].time_stamp index = i end end return index end #-------------------------------------------------------------------------- # * Execute Save #-------------------------------------------------------------------------- def do_save file = File.open(@savefile_windows[@index].filename, "wb") write_save_data(file) file.close return_scene end #-------------------------------------------------------------------------- # * Execute Load #-------------------------------------------------------------------------- def do_load file = File.open(@savefile_windows[@index].filename, "rb") read_save_data(file) file.close $scene = Scene_Map.new RPG::BGM.fade(1500) Graphics.fadeout(60) Graphics.wait(40) @last_bgm.play @last_bgs.play end #-------------------------------------------------------------------------- # * Write Save Data # file : write file object (opened) #-------------------------------------------------------------------------- def write_save_data(file) characters = [] for actor in $game_party.members characters.push([actor.character_name, actor.character_index]) end $game_system.save_count += 1 $game_system.version_id = $data_system.version_id @last_bgm = RPG::BGM::last @last_bgs = RPG::BGS::last Marshal.dump(characters, file) Marshal.dump(Graphics.frame_count, file) Marshal.dump(@last_bgm, file) Marshal.dump(@last_bgs, file) Marshal.dump($game_system, file) Marshal.dump($game_message, file) Marshal.dump($game_switches, file) Marshal.dump($game_variables, file) Marshal.dump($game_self_switches, file) Marshal.dump($game_actors, file) Marshal.dump($game_party, file) Marshal.dump($game_troop, file) Marshal.dump($game_map, file) Marshal.dump($game_player, file) Marshal.dump($game_quests, file) end #-------------------------------------------------------------------------- # * Read Save Data # file : file object for reading (opened) #-------------------------------------------------------------------------- def read_save_data(file) characters = Marshal.load(file) Graphics.frame_count = Marshal.load(file) @last_bgm = Marshal.load(file) @last_bgs = Marshal.load(file) $game_system = Marshal.load(file) $game_message = Marshal.load(file) $game_switches = Marshal.load(file) $game_variables = Marshal.load(file) $game_self_switches = Marshal.load(file) $game_actors = Marshal.load(file) $game_party = Marshal.load(file) $game_troop = Marshal.load(file) $game_map = Marshal.load(file) $game_player = Marshal.load(file) $game_quests = Marshal.load(file) if $game_system.version_id != $data_system.version_id $game_map.setup($game_map.map_id) $game_player.center($game_player.x, $game_player.y) end end end #============================================================================== # ** Quest System #------------------------------------------------------------------------------ # A new Quest System for RPG Maker VX #============================================================================== class Quest_System #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize @quests = [] end def enableQuests addQuest("Quest starting","Please, talk to Boromir.",0,false,1) end def addQuest(name, description, difficulty, repeat=false, state=0) @quests.push(Quest.new(name,description,difficulty,repeat,state)) end def getTotalQuests return @quests.length end #-------------------------------------------------------------------------- # * Get Quest # id : INPUT integer The index of the quest #-------------------------------------------------------------------------- def [](id) return @quests[id] end end #============================================================================== # ** Quest System Vocab #------------------------------------------------------------------------------ # This module defines the messages. #============================================================================== module Quest_System_Vocab Quests = "Quests" State = "State:" State_0 = "???" State_1 = "Talk to client" State_2 = "Started" State_3 = "Complete" Level = "Level:" Level_0 = "Very Easy" Level_1 = "Easy" Level_2 = "Normal" Level_3 = "Hard" Level_4 = "Very Hard" end #============================================================================== # ** Quest #------------------------------------------------------------------------------ # Definition of the Quest Class #============================================================================== class Quest #CONSTANTS VERY_EASY = 0 EASY = 1 NORMAL = 2 HARD = 3 VERY_HARD = 4 UNKNOWN = 0 KNOWN = 1 STARTED = 2 FINISHED = 3 attr_reader :description, :difficulty, :state attr_writer :description, :state #-------------------------------------------------------------------------- # * Object Initialization # -Parameters- # name: INPUT string The name of the quest # description:INPUT string String descripting the quest. # difficulty: INPUT integer Which level is the quest (easy, medium, hard...)? # repeat: INPUT boolean Will the player be able to repeat this quest? # state: INPUT integer State of the quest: # 0.- Unknown quest # 1.- Known quest # 2.- Started # 3.- Finished #-------------------------------------------------------------------------- def initialize(name, description, difficulty, repeat, state) @name = name @description = description @difficulty = difficulty @repeat = repeat @state = state end def name if @state == 0 return "???" else return @name end end #-------------------------------------------------------------------------- # * color # Returns a Color, depending on the state and difficulty of the quest # -Parameters- # OUTPUT Color #-------------------------------------------------------------------------- def color if @state == UNKNOWN return Color.new(64,64,64,255) #Unknown quest elsif @state == FINISHED return Color.new(128,128,128,255) #Finished quest else case @difficulty when VERY_EASY return Color.new(0,0,255,255) #Very Easy when EASY return Color.new(128,128,255,255) #Easy when NORMAL return Color.new(255,255,255,255) #Normal when HARD return Color.new(255,128,128,255) #Hard when VERY_HARD return Color.new(255,0,0,255) #Very Hard end end end def stateStr case @state when UNKNOWN return Quest_System_Vocab::State_0 #Unknown when KNOWN return Quest_System_Vocab::State_1 #Known when STARTED return Quest_System_Vocab::State_2 #Started when FINISHED return Quest_System_Vocab::State_3 #Finished end end def difficultyStr if @state == UNKNOWN return "???" #Unknown quest else case @difficulty when VERY_EASY return Quest_System_Vocab::Level_0 #Very Easy when EASY return Quest_System_Vocab::Level_1 #Easy when NORMAL return Quest_System_Vocab::Level_2 #Normal when HARD return Quest_System_Vocab::Level_3 #Hard when VERY_HARD return Quest_System_Vocab::Level_4 #Very Hard end end end end #=================================================== # - CLASS Scene_Quest Begins #=================================================== #--------------------------------------------------- class Scene_Quest < Scene_Base def initialize(window_index = 0) @quest_selections = [] @window_index = window_index end def start super @select_window = Window_Select_Quest.new @select_window.index = @window_index @select_window.z = 10 for i in 0..$game_quests.getTotalQuests-1 @select_window.draw_item(i) end end def terminate super @select_window.dispose @quest_selections.clear end def update super @select_window.update if @select_window.active update_command elsif Input.trigger?(Input::B) || Input.trigger?(Input::C) if @select_window.active == false Sound.play_cancel @select_window.active = true @select_window.visible = true #Dispose all windows @windowName.dispose @windowDescription.dispose @windowDifficulty.dispose @windowState.dispose else Sound.play_cancel $scene = Scene_Menu.new(5) end end end def update_command if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Menu.new(5) elsif Input.trigger?(Input::C) if $game_quests[@select_window.index].state == 0 Sound.play_buzzer else Sound.play_decision #Create new windows @select_window.active = false @select_window.visible = false @windowName = Window_Name.new($game_quests[@select_window.index].name,$game_quests[@select_window.index].color) @windowName.z= 20 @windowDescription = Window_Description.new($game_quests[@select_window.index].description) @windowDescription.z = 30 @windowDifficulty = Window_Difficulty.new($game_quests[@select_window.index].difficultyStr,$game_quests[@select_window.index].color) @windowDifficulty.z = 40 @windowState = Window_State.new($game_quests[@select_window.index].stateStr,$game_quests[@select_window.index].color) @windowState.z = 50 end end end end class Window_Description < Window_Selectable def initialize(description) super(0,2*(WLH+32),544,416-2*(WLH+32)) self.contents.draw_text(0, WLH, self.width, WLH+32, description, 0) end end class Window_Select_Quest < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize if($game_quests.getTotalQuests < 16) height = ($game_quests.getTotalQuests+1) * 28 else height = 416 end super(0, 0, 275, height) @column_max = 1 self.index = 0 refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh @data = [] for i in 0..$game_quests.getTotalQuests-1 @data.push($game_quests[i].name) end @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # * Draw Item # index : item number #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) #rect.width -= 4 #(- 4 default) rect.width -= 30 #leave 16+10+4 pix for quest completion icon self.contents.font.color = $game_quests[index].color self.contents.font.color.alpha = $game_quests[index].state>Quest::UNKNOWN ? 255 : 128 self.contents.draw_text(rect, $game_quests[index].name) if $game_quests[index].state == Quest::FINISHED self.contents.blt(self.width-50, 24*index+6, Cache::picture("tick.png"), Rect.new(0,0,16,16), 255) end end end class Window_Name < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(questName, color) super(0, 0, 544, WLH+32) self.contents.font.color = color self.contents.draw_text(4, 0, self.width-40, WLH, questName, 1) end end class Window_Difficulty < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(questDifficulty, color) super(0, WLH+32, 272, WLH+32) self.contents.font.color = Color.new(255,255,255,255) self.contents.draw_text(4, 0, 76, WLH, Quest_System_Vocab::Level) self.contents.font.color = color self.contents.draw_text(80, 0, 130, WLH, questDifficulty) end end class Window_State < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(questState, color) super(272, WLH+32, 272, WLH+32) self.contents.font.color = Color.new(255,255,255,255) self.contents.draw_text(4, 0, 76, WLH, Quest_System_Vocab::State) self.contents.font.color = color self.contents.draw_text(80, 0, 130, WLH, questState) end end Anything you want to add something to this quest script, you're free to do it. I want no credit, and all that stuff, but if you do some modification, that could be useful to all the comunity, please contact me and I'll add it to this script. Any idea? :P QuestSystem.rar (Size: 233.34 KB / Downloads: 0) |