|
  |
Submission: Quest Manager v2.0, by Prexus |
|
|
|
|
Oct 15 2005, 03:21 AM
|

Level 3

Group: Member
Posts: 31
Type: Event Designer
RM Skill: Masterful

|
By the way, I forgot to point out in the comments but if a quest is incomplete, it has a (!) beside its name. If it is disabled, it has a (?), and if its completed, it has a (*). If the quest is .type = 0, then there is no () Script:Place in a new script above main and read the instructions: CODE #----------------------------------------# # Quest Manager Revision by Prexus # #----------------------------------------# # Created on Friday, June 3rd # # Revised on Sunday, June 5th # # [url="http://prexus.rmxponline.com"]http://prexus.rmxponline.com[/url] # All Rights Reserved # #----------------------------------------# # Interferance Scripts: # # Quest Manager Revision uses these # # default classes, so make sure no other # # scripts interfere. If they do, update # # them accordingly. # # Game_Party # # Scene_Title # # Scene_Save # # Scene_Load # #----------------------------------------# # New in Revision 1: # # The quests look better visually, using # # a duallist for requirements and easier # # access to a quests status in the list. # # Also, when a quest uses switches or # # variables, $game_switches/variables is # # no longer used. This is important to # # note because now, you must use Call # # Script to change the values. # # Like so: # # $quest_variables[id] (will return the value at id.) # $quest_variables[id] += value (will add value to the current value of the var) # $quest_variables[id] -= value (will subtract value from the current var) # $quest_variables[id] /= value (will divide the current var with value) # $quest_variables[id] *= value (will mulitple the current var by value) # $quest_switches[id] (will return true or false based on the id) # $quest_switches[id] = true (will set switch to true) # $quest_switches[id] = false (will set switch to false) # Thank you Mr. DJ for the idea =) # #----------------------------------------# # To use this script, simply paste it # # above main. It should not interfere # # with any other scripts unless they use # # or change scene_load and scene_save and# # scene_title, as they are the only # # default scripts that are affected. # # To add a quest to the database, in # # Call Script, put the following: # # ?????????????????? # # $quest[id] = PRX_Quest.new Change ID to whatever you want. Just never use the same twice. # $quest[id].name = "Enter Name Here" # $quest[id].type = 0-3 (explained below) # $quest[id].description = "Short Explaination of Quest" # $quest[id].requirements = [] (An array of values, Explained Below) # $quest[id].values = [] (An array of values, explained below) # $quest[id].switches = [] (Array of switch IDs, explained below.) # $quest[id].variables = [] (Array of variable IDs, explained below.) # $quest[id].completed = Set this to true/false when the quest is done # $quest[id].disabled = If you want the quest to appear disabled, set this to true # ?????????????????? # # Important Notes about Values: # .name # - A string value that appears in the list. # .type # - An integer value 0-3. # When the value is set to 0, make sure to set .requirements to string values. # These will appear in the quest menu and never change. # # If type is set to 1, make sure to set .requirements to string values and # set .variables accordingly. Also, .values needs to be set # appropriately as well. For example: # .requirements = ["Kill Two Goblins", "Find 3 Eggs"] # .values = [2, 3] # .variables = [1, 2] # If variable 1 is 2 or higher, the first requirement will appear green and # if variable 2 is 3 or higher, the second requirement will appear green. # # If it is set to 2, make sure to set .requirements to string values and # set .switches accordingly. For example: # .requirements = ["Fight Orc", "Capture Flag"] # .switches = [1, 2] # If switch 1 is on, Fight Orc will appear green in the menu and if switch 2 # is on, Capture Flag will also appear green. # # If type is set to 3, make sure to set .requirements to IDs of Items from # the database. Then make sure .values are set appropriately. # For example: # .requirements = [1, 2, 3] # .values = [3, 2, 1] # You'd need 3 potions, 2 high potions, and 1 full potion. # .description # - A string value that appears in the description box explaining quest. # .requirements # - An array which if type is 0 2 or 3, will contain string values, for example # ["Kill the King", "Save the Princess", "Dance a Jig"] # If type is 1, be sure to fill it with item ids such as # [1, 2, 3] will return Potion, High Potion, Full Potion by default # .values # - An array which holds integer values. If the type is 0, this field can be # blank as it will have no effect. If type is 1, these values correspond with # how much of the items in .requirements you need. For example: # .requirements = [1, 2, 3] # .values = [3, 2, 1] # You need 3 Potions, 2 High Potions, and 1 Full Potion. # If type is 1, this holds how much of each Quest Variable you need. # .switches # - Holds integer values of the IDs of Quest_Switches. This is used if the .type # is set to 2. # .variables # - Holds integer values of the IDs of Quest_Variables. This is used if the .type # is set to 1. # .completed # - If true, the name will be green in the quest menu. # [NEW] This field will automatically update if conditions for quest are met. # .disabled # - If true, the name will be greyed out in the quest menu. # Note: If both completed and disabled are true, it will appear completed. # # If any further questions are needed refer to the RMXP.net thread. # ?????????????????? #
# Visual Aspects:
# New Class #-------------------# # Scene Quest # #-------------------# class Scene_Quest def main @quest = Window_Quest.new @desc = Window_Description.new @req = Window_Requirements.new @quest.help_window = @desc @quest.req_window = @req Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @quest.dispose @desc.dispose @req.dispose end def update @quest.update @desc.update @req.update if Input.trigger?(Input::B) $scene = Scene_Map.new end end end # End New Class
# New Class #--------------------# # Window Quest # #--------------------# class Window_Quest < Window_Selectable attr_reader :req_window def initialize super(0, 0, 640, 192) @column_max = 2 refresh self.index = 0 end def quest return @data[self.index] end def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] for i in 0...$quest.size if $quest[i] != nil @data.push($quest[i]) end end @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize for i in 0...@item_max draw_item(i) end end end def draw_item(index) quest = @data[index] text = "" if quest.type == 0 self.contents.font.color = normal_color text = quest.name else if quest.disabled self.contents.font.color = disabled_color text += "(?) " + quest.name.to_s elsif quest.completed self.contents.font.color = Color.new(0, 255, 0, 255) text += "(*) " + quest.name.to_s else self.contents.font.color = Color.new(255, 0, 0, 255) text += "(!) " + quest.name.to_s end end x = 4 + index % 2 * (288 + 32) y = index / 2 * 32 self.contents.draw_text(x, y, 212, 32, text, 0) end def update_help @help_window.set_text(self.quest == nil ? "" : self.quest.description) if self.quest != nil if @req_window != nil @req_window.clear_text for i in 0...self.quest.requirements.size quest = self.quest if quest.type == 0 @req_window.add_text(quest.requirements[i].to_s, -1) elsif quest.type == 1 quest_variable = $quest_variables[quest.variables[i]] if quest_variable != nil @req_window.add_text(quest.requirements[i].to_s, quest_variable.to_i, quest.values[i], quest.type) else @req_window.add_text("Not Found?", -1) end elsif quest.type == 2 quest_switch = $quest_switches[quest.switches[i]] if quest_switch != nil @req_window.add_text(quest.requirements[i].to_s, quest_switch, quest.values[i], quest.type) else @req_window.add_text("Not Found?", -1) end elsif quest.type == 3 quest_item = $data_items[quest.requirements[i]] if quest_item != nil @req_window.add_text(quest_item.name.to_s, $game_party.item_number(quest_item.id), quest.values[i], quest.type) else @req_window.add_text("Not Found?", -1) end end end end end end def help_window=(help_window) @help_window = help_window if self.active and @help_window != nil update_help end end def req_window=(req_window) @req_window = req_window if self.active and @req_window != nil update_help end end end # End New Class
# New Class #---------------------------# # Window Requirements # #---------------------------# class Window_Requirements < Window_Base def initialize super(0, 256, 640, 480-256) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize @full_text = [] @amount = [] @amount_needed = [] @type = [] end def add_text(text, amount, amount_needed = -1, type = 0) @full_text.push(text) @amount.push(amount) @amount_needed.push(amount_needed) @type.push(type) show_text end def clear_text @full_text = [] @amount = [] @amount_needed = [] @type = [] end def show_text self.contents.clear self.contents.font.color = normal_color for i in 0...@full_text.size x = 4 + i % 2 * (288 + 32) y = i / 2 * 32 if @type[i] == 0 self.contents.font.color = normal_color self.contents.draw_text(x, y, (self.width / 2) - 40, 32, @full_text[i], 0) elsif @type[i] == 1 or @type[i] == 3 if @amount[i] >= @amount_needed[i] self.contents.font.color = Color.new(0, 255, 0, 255) else self.contents.font.color = Color.new(255, 0, 0, 255) end self.contents.draw_text(x, y, (self.width / 2) - 40, 32, @full_text[i], 0) self.contents.draw_text(x, y, (self.width / 2) - 40, 32, @amount[i].to_s + "/" + @amount_needed[i].to_s, 2) elsif @type[i] == 2 if @amount[i] == true self.contents.font.color = Color.new(0, 255, 0, 255) else self.contents.font.color = Color.new(255, 0, 0, 255) end self.contents.draw_text(x, y, (self.width / 2) - 40, 32, @full_text[i], 0) end end self.visible = true end end # End New Class
# New Class #--------------------------# # Window Description # #--------------------------# class Window_Description < Window_Base def initialize super(0, 192, 640, 64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize end def set_text(text, align = 0) if text != @text or align != @align self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(4, 0, self.width - 40, 32, text, align) @text = text @align = align end self.visible = true end end # End New Class
# Programming Aspects:
# New Class #-----------------# # PRX_Quest # #-----------------# class PRX_Quest attr_accessor :name attr_accessor :type attr_accessor :description attr_accessor :requirements attr_accessor :values attr_accessor :switches attr_accessor :variables attr_accessor :completed attr_accessor :disabled def initialize @name = "" @type = 0 @description = "" @requirements = [] @values = [] @switches = [] @switches = Array.new(5000, false) @variables = [] @variables = Array.new(5000, 0) @completed = false @disabled = false end end # End New Class
# Modified Class #-------------------# # Scene Title # #-------------------# class Scene_Title def command_new_game $game_system.se_play($data_system.decision_se) Audio.bgm_stop Graphics.frame_count = 0 $game_temp = Game_Temp.new $game_system = Game_System.new $game_switches = Game_Switches.new $quest_switches = Quest_Switches.new # New $game_variables = Game_Variables.new $quest_variables = Quest_Variables.new # New $game_self_switches = Game_SelfSwitches.new $game_screen = Game_Screen.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 $quest = [] # New $game_party.setup_starting_members $game_map.setup($data_system.start_map_id) $game_player.moveto($data_system.start_x, $data_system.start_y) $game_player.refresh $game_map.autoplay $game_map.update $scene = Scene_Map.new end end # End Modified Class
# Modified Class #------------------# # Scene Save # #------------------# class Scene_Save def write_save_data(file) characters = [] for i in 0...$game_party.actors.size actor = $game_party.actors[i] characters.push([actor.character_name, actor.character_hue]) end Marshal.dump(characters, file) Marshal.dump(Graphics.frame_count, file) $game_system.save_count += 1 $game_system.magic_number = $data_system.magic_number Marshal.dump($game_system, file) Marshal.dump($game_switches, file) Marshal.dump($quest_switches, file) # New Marshal.dump($game_variables, file) Marshal.dump($quest_variables, file) # New Marshal.dump($game_self_switches, file) Marshal.dump($game_screen, 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($quest, file) # New end end # End Modified Class
# Modified Class #------------------# # Scene Load # #------------------# class Scene_Load def read_save_data(file) characters = Marshal.load(file) Graphics.frame_count = Marshal.load(file) $game_system = Marshal.load(file) $game_switches = Marshal.load(file) $quest_switches = Marshal.load(file) # New $game_variables = Marshal.load(file) $quest_variables = Marshal.load(file) # New $game_self_switches = Marshal.load(file) $game_screen = 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) $quest = Marshal.load(file) # New if $game_system.magic_number != $data_system.magic_number $game_map.setup($game_map.map_id) $game_player.center($game_player.x, $game_player.y) end $game_party.refresh end end # End Modified Class
# New Class #----------------------# # Quest Switches # #----------------------# class Quest_Switches def initialize @data = [] @data = Array.new(5000, false) end def [](switch_id) if switch_id <= 5000 and @data[switch_id] != nil return @data[switch_id] else return false end end def []=(switch_id, value) if switch_id <= 5000 @data[switch_id] = value comp_count = 0 for i in 0...$quest.size if $quest[i].type == 2 for k in 0...$quest[i].requirements.size if @data[$quest[i].switches[k]] == true comp_count += 1 end end if comp_count == $quest[i].requirements.size $quest[i].completed = true else $quest[i].completed = false end end end end end end # End New Class
# New Class #-----------------------# # Quest Variables # #-----------------------# class Quest_Variables def initialize @data = [] @data = Array.new(5000, 0) end def [](variable_id) if variable_id <= 5000 and @data[variable_id] != nil return @data[variable_id] else return 0 end end def []=(variable_id, value) if variable_id <= 5000 @data[variable_id] = value comp_count = 0 for i in 0...$quest.size if $quest[i].type == 1 for k in 0...$quest[i].requirements.size if @data[$quest[i].variables[k]] != nil if @data[$quest[i].variables[k]] >= $quest[i].values[k] comp_count += 1 end end end if comp_count == $quest[i].requirements.size $quest[i].completed = true else $quest[i].completed = false end end end end end end # End New Class
# Modified Class #------------------# # Game Party # #------------------# class Game_Party def gain_item(item_id, n) if item_id > 0 @items[item_id] = [[item_number(item_id) + n, 0].max, 99].min # New comp_count = 0 for i in 0...$quest.size if $quest[i].type == 3 for k in 0...$quest[i].requirements.size if item_number($quest[i].requirements[k]) >= $quest[i].values[k] comp_count += 1 end end if comp_count == $quest[i].requirements.size $quest[i].completed = true else $quest[i].completed = false end end end # End New end end end # End Modified Class Important Note:I forgot to include this in the original and again in the revision, but to show the quest manager window, use call script: CODE $scene = Scene_Quest.new Support: This code defines a regular item quest: CODE $quest[1] = PRX_Quest.new # Sets the quest $quest[1].name = "Food Search" # Gives it a name $quest[1].type = 3 # Defines it as an item quest $quest[1].description = "Find The Food" # Gives it a description $quest[1].requirements = [1, 2, 3] # Sets the requirements to item IDs, in this case Potion, High Potion, Full Potion $quest[1].values = [3, 2, 1] # Sets the amount of each item you need to succeed. In this case, 3 Potions, 2 High Potions, 1 Full Potion.  This code defines a regular variable quest: CODE $quest[7] = PRX_Quest.new # Sets the quest, as always. $quest[7].name = "Variable Quest" # Gives it a name $quest[7].type = 1 # Defines it as a variable quest $quest[7].description = "Variables!" # Gives it a description $quest[7].requirements = ["VarA", "VarB"] # Labels the requirements.. this may say something like, ["Bugbears Killed:", "Locks Picked:"] or something. $quest[7].values = [2, 2] # This defines how much of each requirement you need, in this case you need 2 VarA and 2 VarB, or 2 Bugbear's Killed and 2 Locks Picked. $quest[7].variables = [1, 2] # This sets QuestVar IDs to the requirements. These IDs correspond with $quest_variables[ID]  This code demonstrates how to use the $quest_variables: CODE # $quest_variables[ID] math= value $quest_variables[1] += 1 # Increases Quest_Variable 1 by 1 $quest_variables[419] *= 21 # Multiplies Quest_Variable 419 by 21.  This code demonstrates how to use $quest_switches: CODE # $quest_switches[id] = true/false $quest_switches[1] = true # Sets switch 1 to true. $quest_switches[2] = false # Sets switch 2 to false. Screenshots:  
__________________________
|
|
|
|
|
|
|
|
|
Jan 27 2006, 03:33 AM
|
Level 2

Group: Member
Posts: 17
Type: None
RM Skill: Advanced

|
Its to bad your going to stop making scripts, i hope not forever cause you have the most awesome scripts ever. keep up the good work :Smilie7:
|
|
|
|
|
|
|
|
|
Jun 20 2006, 11:58 AM
|

Group: Member
Posts: 4
Type: Event Designer
RM Skill: Skilled

|
IT isn't working... I reallydon't understand scripting that well...and.... well, I made a new script above main...like you told us to and paisted the script in there...then when I try to start the game, it says... Well, basicly it says there is a syntax error on line 152... Oh, never mind...I found it... the forum turns a B ) without a space into  It messed up the script. You may want to check that out. EDIT: GRR. Error on line 139 here's 126-146 What's wrong? CODE class Scene_Quest ? def main ? ? @quest = Window_Quest.new ? ? @desc = Window_Description.new ? ? @req = Window_Requirements.new ? ? @quest.help_window = @desc ? ? @quest.req_window = @req ? ? Graphics.transition ? ? loop do ? ? ? Graphics.update ? ? ? Input.update ? ? ? update ? ? ? if $scene != self ? ? ? ? break ? ? ? end ? ? end ? ? Graphics.freeze ? ? @quest.dispose ? ? @desc.dispose ? ? @req.dispose ? end EDIT AGAIN: Awesome code...I don't know what was wrong, but it's fixed now....
This post has been edited by Moriarty: Jun 20 2006, 01:08 PM
|
|
|
|
|
|
|
|
|
Jun 20 2006, 02:58 PM
|
Level 43
Group: Retired Admin Staff
Posts: 1,185
Type: None
RM Skill: Undisclosed

|
Those A's aren't supposed to be there, I believe.
|
|
|
|
|
|
|
|
|
Jun 20 2006, 05:26 PM
|

L Did you know? Death gods... only eat apples

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled

|
QUOTE (Rydain @ Jun 20 2006, 02:58 PM) Those A's aren't supposed to be there, I believe. setting it to Unicode would help If that won't work then you have to delete the A's mannually
__________________________
My RMXP Project:  Farewell RRR. =]
|
|
|
|
|
|
|
|
|
Jun 21 2006, 05:40 AM
|

Group: Member
Posts: 4
Type: Event Designer
RM Skill: Skilled

|
Oh.
How do I change that in Firefox?
Ok...nevermind...but, specifically which one?? UTF 8, UTF 16, UTF 32.......
Help...please.
Thanks
This post has been edited by Moriarty: Jun 21 2006, 05:43 AM
|
|
|
|
|
|
|
|
|
Jun 12 2009, 04:31 AM
|

Group: Member
Posts: 1
Type: None
RM Skill: Undisclosed

|
srry noob question how to call scripts?
|
|
|
|
|
|
|
|
  |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
RPG RPG Revolution is an Privacy
Policy and Legal
|
|