Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
jporter917

Tornado Quest Log Edit

Question

I am looking for someone to do and or help me edit Tornado Quest Book by storm for my game. I included that script and the RMX-OS save script. I am wanting to add a effect to the script the calls a scene when the call script, $game_party.add_quest(id), is used. The scene will be a small window that displays the information about the quest, ["title","author's name","text","reward"], and also offers the player an option to select either accept quest or cancel the scene. If a player selects accept then the quest is added to the Quest Log, if cancel then it isn't. It will also check rather a players has completed the quest already. If a player has completed the quest already then scene will just display no available quest. When a player completes a quest and returns to the quest giver the script will check if it is complete, if it is then the option accept is replaced by complete. Player selects complete the quest is removed from their quest log and they are rewarded. Much like the interface for most MMORPG's

 

**Since quests can only be done once so the script will also need to check if a player has already done the quest too, which that data will need to be saved by RMX-OS. Which I can handled and define myself if someone so choices to help me.

 

The scene it calls will use the current windowskin and be slightly translucent, like in the following picture.

 

 

26058375.png

 

 

 

Tornado Quest Book

 

#==============================================================================
#==============================================================================
#                            Tornado Quest Book
#                               Version 1.0
#                              Author: Storm
#                      http://rpgxpultimate.darkbb.com
#
# Instructions:
# Place the script above main.
#
# Use $scene = Scene_QuestBook.new to call it.
#
# Use $game_party.add_quest(id) to add quest.
#
# Use $game_party.delete_quest(id) to delete quest.
#
# Use $game_party.finish_quest(id) to finish quest.
#
# Use $game_party.unfinish_quest(id) to unfinish quest.
#
# In condition branch, at the script tab enter $game_party.quest_complete?(id)
# to check if that quest have completed yet.
#
# Features:
# Can custom menus name.
# Opacity configable.
# Customable complete quest color.
# Customable incomplete quest color.
# Able to set return scene.
# Auto replace text in the message.
# Replacements configable.
# 
# Compatibility:
# Most of things. (Haven't test to any yet. :P)
#
# Credits and Thanks:
# Storm     - For making it.
# Game_Guy  - For teach me how to use array.
#
#==============================================================================
#==============================================================================
module TNDqb
 #============================================================================
 # START CONFIG
 #============================================================================

 #============================== General Config ==============================
 # General Config.
 #============================================================================
 QB_Name     = "Quest Book" #Quest Book name
 Author_Name = "Author" #Author name
 Title_Name  = "Title" #Title name
 Reward_Name = "Reward" #Reward name
 Status_Name = "Status" #Reward name
 Complete    = "Complete" #Complete name
 Incomplete  = "Incomplete" #Incomplete name
 Unknown     = "???" #Unknown Name
 Opacity     = 200 #Windows Opacity
 Screen      = 1 #(0 = black,1 = map,"quoted string" = picture)

 Cmp_Color   = Color.new(0, 255, 0, 255) #Complete color
 Incmp_Color = Color.new(255, 0, 0, 255) #Incomplete Color

 Return      = Scene_Map #Return Scene

 #================================ Ignore Part ===============================
 # Ignore Parts Under This.
 #============================================================================
 Quest       = []

 #============================ Replacement Config ============================
 # Replacements, this will auto replace texts in your message
 #
 # Replace = ["text","replace"]
 # NOTE: Maximum of replaces is 10. Replaces cannot be add or remove.
 #       Cannot include {name1}, {name2}, {name3} and {name4}
 #
 #       Completed Replacements: (Do not add)
 #       {name1} = 1st actor's name
 #       {name2} = 2nd actor's name
 #       {name3} = 3rd actor's name
 #       {name4} = 4th actor's name
 #============================================================================
 Replace1 = ["",""]
 Replace2 = ["",""]
 Replace3 = ["",""]
 Replace4 = ["",""]
 Replace5 = ["",""]
 Replace6 = ["",""]
 Replace7 = ["",""]
 Replace8 = ["",""]
 Replace9 = ["",""]
 Replace10 = ["",""]

 #=============================== Quest Config ===============================
 # Config quests here.
 #
 # Quest[id] = ["title","author's name","text","reward"]
 #============================================================================

 #PART 1
 Quest[1]    = ["Anemone Refugees","Flol ","Flol wants you to talk to Opsur","10 Gold & 5 Experience"]
 Quest[2]    = ["Bee Stringers","Hene","Hene has asked you to kill ten bees and bring back their stringers as proof","4 Gold & 10 Experience"]
 Quest[3]    = ["Camellia Flower","Pogrua","Bring twenty Camellia flowers to Pogrua. The flowers can be found anywhere in the Camellia Plains","2 Gold & 20 Expereince"]
 Quest[4]    = ["Abonded Chest", "Chest","It is locked, you should take it to Riro.","5 Gold & 10 Experience"]
 Quest[5]    = ["Supplies Thiefs","Fupp","Find the Fupp's ten missing supply crates.","3 Gold & 15 Experience"]
 #============================================================================
 # END CONFIG
 #============================================================================
end

#====================
# Game_Party
#====================
class Game_Party
 attr_accessor :quest
 attr_accessor :qComplete
 alias tnd_qb_init initialize
 def initialize
   @quest = []
   @qComplete = []
   tnd_qb_init
 end

 def add_quest(id)
   msg = TNDqb::Quest[id]
   return if msg == nil
   unless @quest.include?(id)
     @qComplete.delete(id)
     @quest.push(id)
   end
 end

 def delete_quest(id)
   msg = TNDqb::Quest[id]
   return if msg == nil
   if @quest.include?(id)
     @qComplete.delete(id)
     @quest.delete(id)
   end
 end

 def finish_quest(id)
   msg = TNDqb::Quest[id]
   return if msg == nil
   if @quest.include?(id)
     @qComplete.push(id)
   end
 end

 def unfinish_quest(id)
   msg = TNDqb::Quest[id]
   return if msg == nil
   if @quest.include?(id)
     @qComplete.delete(id)
   end
 end

 def quest_complete?(id)
   return if id == nil
   msg = TNDqb::Quest[id]
   return if msg == nil
   if @qComplete.include?(id)
     return true
   else
     return false
   end
 end

end

#====================
# Bitmap
#====================
class Bitmap
 def format_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

#====================
# Window_QuestTitle
#====================
class Window_QuestTitle < Window_Base
 def initialize
   super(0, 0, 640, 60)
   self.back_opacity = TNDqb::Opacity
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
 end
 def refresh
   self.contents.clear
   self.contents.font.color = normal_color
   self.contents.font.size = 25
   cx = contents.text_size(TNDqb::QB_Name).width
   self.contents.draw_text(0, 0, cx, 37, TNDqb::QB_Name)
 end
end

#====================
# Window_QuestMain
#====================
class Window_QuestMain < Window_Base
 def initialize
   super(35, 100, 380, 340)
   self.back_opacity = TNDqb::Opacity
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
 end
 def refresh
   return if @quest_id == nil
   msg = TNDqb::Quest[@quest_id]
   return if msg == nil
   self.contents.clear
   self.contents.font.size = 20
   t = self.contents.text_size(TNDqb::Title_Name+": ").width
   t2 = self.contents.text_size(TNDqb::Author_Name+": ").width
   t3 = self.contents.text_size(TNDqb::Reward_Name+": ").width
   t4 = self.contents.text_size(TNDqb::Status_Name+": ").width
   self.contents.font.color = system_color
   self.contents.draw_text(0, 0, self.width, 32, TNDqb::Title_Name+": ")
   self.contents.draw_text(0, 32, self.width, 32, TNDqb::Author_Name+": ")
   self.contents.draw_text(0, 250, self.width, 32, TNDqb::Reward_Name+": ")
   self.contents.draw_text(0, 282, self.width, 32, TNDqb::Status_Name+": ")
   self.contents.font.color = normal_color
   self.contents.draw_text(t, 0, self.width, 32, msg[0])
   self.contents.draw_text(t2, 32, self.width, 32, msg[1])

   @text = msg[2]

   @text = @text.gsub(TNDqb::Replace1[0], TNDqb::Replace1[1])
   @text = @text.gsub(TNDqb::Replace2[0], TNDqb::Replace2[1])
   @text = @text.gsub(TNDqb::Replace3[0], TNDqb::Replace3[1])
   @text = @text.gsub(TNDqb::Replace4[0], TNDqb::Replace4[1])
   @text = @text.gsub(TNDqb::Replace5[0], TNDqb::Replace5[1])
   @text = @text.gsub(TNDqb::Replace6[0], TNDqb::Replace6[1])
   @text = @text.gsub(TNDqb::Replace7[0], TNDqb::Replace7[1])
   @text = @text.gsub(TNDqb::Replace8[0], TNDqb::Replace8[1])
   @text = @text.gsub(TNDqb::Replace9[0], TNDqb::Replace9[1])
   @text = @text.gsub(TNDqb::Replace10[0], TNDqb::Replace10[1])

   actor = $game_party.actors[0]
   @text = @text.gsub("{name1}", actor.name)


   draw_msg(@text, 0, 64)

   if $game_party.qComplete.include?(@quest_id)
     self.contents.draw_text(t3, 250, self.width, 32, msg[3])
     self.contents.font.color = TNDqb::Cmp_Color
     self.contents.draw_text(t4, 282, self.width, 32, TNDqb::Complete)
   else
     self.contents.draw_text(t3, 250, self.width, 32, TNDqb::Unknown)
     self.contents.font.color = TNDqb::Incmp_Color
     self.contents.draw_text(t4, 282, self.width, 32, TNDqb::Incomplete)
   end
 end
 def draw_msg(msg, x, y)
   text = self.contents.format_text(msg, 380)
   text.each_index {|i|self.contents.draw_text(x, y + i*32, 544, 32, text[i])}
 end
 def set_quest(id)
   return if @quest_id == id
   @quest_id = id
   refresh
 end
end

#====================
# Scene_QuestBook
#====================
class Scene_QuestBook
 def main
   if TNDqb::Screen.is_a?(Integer)
     if TNDqb::Screen == 1
       @back = Spriteset_Map.new
     end
   else
     @back = Sprite.new
     @back.bitmap = RPG::Cache.picture(TNDqb::Screen)
   end

   #Command window setup
   @quest = $game_party.quest
   @msg = []
   @quest.each {|i|
     @msg.push(TNDqb::Quest[i][0])
   }
   @msg = [""] if @msg.size < 1

   #Create command window
   @command_window = Window_Command.new(180, @msg)
   @command_window.x = 460
   @command_window.back_opacity = TNDqb::Opacity
   @command_window.height = 420
   @command_window.y = 60
   j = 0
   @quest.each{|i| 
   if $game_party.qComplete.include?(i)
     @command_window.draw_item(j, TNDqb::Cmp_Color)
   end
   j += 1}

   #Make main windows
   @title = Window_QuestTitle.new
   @main = Window_QuestMain.new

   Graphics.transition
   loop do
     Graphics.update
     Input.update
     #Update windows and inputs
     update
     inputUpdate
     #Break if scene is not Scene_QuestBook
     if $scene != self
       break
     end
   end
   Graphics.freeze

   #Dispose windows
   if TNDqb::Screen == 1
     @back.dispose
   end
   @command_window.dispose
   @title.dispose
   @main.dispose
 end

 def command_refresh
   @newIndex = @command_window.index
   @msg = []
   @command_window.dispose
   @command_window = nil
   @quest.each {|i|
   @msg.push(TNDqb::Quest[i][0])
   }
   @msg = [""] if @msg.size < 1
   @command_window = Window_Command.new(180, @msg)
   @command_window.x = 460
   @command_window.back_opacity = TNDqb::Opacity
   @command_window.height = 420
   @command_window.y = 60
   @command_window.index = @newIndex
   j = 0
   @quest.each{|i| 
   if $game_party.qComplete.include?(i)
     @command_window.draw_item(j, TNDqb::Cmp_Color)
   end
   j += 1}
 end

 def inputUpdate
   if Input.trigger?(Input::Key['L'])
     #Play Cancel SE
     $game_system.se_play($data_system.cancel_se)
     #Return to set scene
     $scene = TNDqb::Return.new
   elsif Input.trigger?(Input::C)
     #Play Decision SE
     $game_system.se_play($data_system.decision_se)
     #Refresh quest data
     @main.set_quest(@quest[@command_window.index])
     #Goto command_refresh
     command_refresh
   end
 end

 def update
   #Updates
   @command_window.update
   @title.update
   @main.update
 end
end

 

 

RMX-OS Save Script

 

module RMXOS
 module Options
   SAVE_DATA[Game_Party].push('@quest')
   SAVE_DATA[Game_Party].push('@qComplete')
   SAVE_DATA[Game_Party].push('@unfinish_quest')
 end
end

 

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...