[XP] Quest Log System

Started by G_G, May 31, 2009, 08:12:58 pm

Previous topic - Next topic

G_G

May 31, 2009, 08:12:58 pm Last Edit: July 21, 2011, 02:58:04 am by game_guy
Quest Log System
Authors: game_guy
Version: 3.0
Type: Mission Logger
Key Term: Misc System



Introduction

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



Screenshots
Spoiler: ShowHide



Demo

Mediafire


Script

Spoiler: ShowHide

#===============================================================================
# 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).
#
# 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   = true
 
 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 "Capture 10 animals and bring back the meat."
   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.push("No Quests") if @quests.size < 1
   @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), 480)
   text.each_index {|i|
       self.contents.draw_text(0, 288 + i*32, 480, 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


If you use RMX-OS and you would like to use this script with it. Place the above script below RMX-OS. Then place the plugin below beneath the above script.
Spoiler: ShowHide
if !defined?(RMXOS) || RMXOS::VERSION < 1.09
 raise 'ERROR: The "Blizz-ABS Controller" requires RMX-OS 1.09 or higher.'
end
module RMXOS
 module Options
   SAVE_DATA[Game_Party].push('@quests')
   SAVE_DATA[Game_Party].push('@completed')
 end
end



Instructions

In the script.

Looking for a fast way to configure this? Check out mroedesigns' config tool!
http://forum.chaos-project.com/index.php/topic,10125.new.html#new


Compatibility

Not tested with SDK.
Works with all of my scripts and blizzard's scripts. (Tested with most add-ons and all of his scripts)


Credits and Thanks


  • game_guy ~ Making it
  • Beta Testers ~ Sally and Landith



Author's Notes

Enjoy and give credits

Sally

Very nice and simple script, i suggest using it for its simplicity.

G_G

thanks sally I decided to make my own quest log when I couldnt find one with a right layout and/or making a quest easily.

Yin

OK, I just tested it out and it's actually pretty good! I liked it, but the quest info does look a bit empty. My suggestion, try putting the actual description in the area that's empty (the complete right side). Throw in an option to show a picture on the bottom. I did a quick mockup. Here:

Those would make it perfect. But those are just suggestions.
Newly formed MUGEN, RPG Maker, and BOR forum.
http://cavernofcreativity.com
Opening in September
My Partner in crime = TREXRELL

Calintz


Kagutsuchi

It works good, serves its purpose. Go with Yin's suggestion, thats all I can say.

G_G

*Updates* New features are
Longer Descriptions
Description is in better format
$quest.complete(item id) now completes the quest
And more

Holyrapid

So, if i want to add the quest menu option to the main menu in the game, do i just add the $quest.new thing somewhere? And if so, is it addable to STCMS (Storm tronics CMS)

Jackolas

you need to add
@scene = Scene_Quest.new

somewhere in the STCMS script

Holyrapid

Does it matter where i approx pput it? Do i just shove it to the end or, into some other part...

G_G

as long as you dont have a custom save system above it you can place it anywhere.

Holyrapid

Do i add the snipplet as it´s own, or do i put inside another script?
You approx. know what the STCMS looks like, so i just want to add a manu for the quest created with your quest script.

G_G

Well if you're using this with STCMS just place it above it. It can be under neath it and still work but the scripts need to be in order according to blizz's.

RTP Scripts
SDK (If have it)
custom scripts
blizz's scripts
main

Hellfire Dragon

Awesomeness :D Will this work with RMX-OS?

G_G

The saving will need to be a bit altered is all. So it saves quests. I'll make an rmx-os add on when a later version of rmx-os comes out. If you want it now I'll make one.

Holyrapid

I´ve got working now. Thanks to Jackolas.

Blizzard

Quote from: Hellfire Dragon on June 28, 2009, 06:14:06 pm
Awesomeness :D Will this work with RMX-OS?


You'll have to define another save variable in RMX-OS for this to work properly.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

Which I saw in the options. I've already figured out how to do it all. It shouldnt be too hard to make a small side plugin for it ;)

G_G


Calintz

I like this system.
It's quite simple, and very effective.