Game_Guy's Quest Log Version 4.5 with New Features and LayoutVersion: 4.5Author: Game_Guy with some updates by OutlandishDate: Dec 3, 2012Version History
- Version 4.6 2012.12.07 - Fixed a bug where the opening Bleep sound effect kept playing over and over. Also got rid of some unnecessary code and constants.
- Version 4.5 2012.12.03 - finally finished complete layout changes. Added ability to change quest title color based on whether it is a mandatory story quest or an optional sidequest. Added quest minimum level to complete. Lots of other features.
Planned Future VersionsDescription
A long time ago I asked game_guy permission to make some major changes to his super cool quest log script and to share the script and a demo with everyone. I've added a demo that shows all the new features. There's a new layout with the ability for really long description text. Also I've demonstrated the ability to change the description text based on where you are in the progress of a quest using game variables. For example, you could have a quest that says you must rescue the princess. Using a game variable to progress of the quest once you've rescued her, you can have description update and say you have to get her safely out of the evil castle. Once that's done you could update again and have the description say that you must now bring the princess to the king. Granted, it takes a bit of basic scripting knowledge of if and elsif statements to do this, but I've set up a couple demonstration quests in the script that show how this can be done.
Another feature I've added to the demo is the ability to say in the description something like: Collect 2/5 Rocks, or kill 1/5 Lizard Mobs. This also just uses a game variable to track how many you've collected or killed and I have a couple examples in the script of how to display the current number you've collected/killed in the description. Using that as a template hopefully you'll be able to figure out how to use this in your own projects.
I've also added a simple feature that will color the title of the quest red if it's a mandatory story quest that's needed to advance the story, or green if it's an optional side quest. The title defaults to the system color blue if you decide not to set this up.
I've also added the ability list up to three quest rewards, the location of the quest, and the name of the quest giver. I've also made the layout look a little less empty. Anyway, I'm planning on possibly using this in my game and decided I should share all the changes I made. Credit goes to game_guy for making the script. I don't care if you credit me or not. As to the license terms, he had said in the original script post that you could use it in a commercial game if you let him know and give him a free copy. If that's changed he can let us know I'm sure.
This is my first time posting a script and I'm not a very skilled scripter myself. Game_guy made the script I only adapted it to my needs.
Features- Long quest titles
- Quest titles can be color coded for if the quest is a story quest or side quest or neither
- Flexibility to keep track of your progress in the quest using game variables and a little basic scripting knowledge
- Track how many items you've collected/killed for a quest using variables
- Extra long quest description text
- New layout
- Show the location of the quest, the name of the quest giver, and up to three rewards given
- Shows whether a quest is completed or not
- Shows the minimum level needed to complete the quest. Can also be used to show a quest difficulty rating.
ScreenshotsInstructionsMost the instructions are in the script itself and the demo shows how you can use several of its features.
Script Version 4.6
#===============================================================================
# Quest Log System
# Author game_guy
# Version 4.6
# Updated by Outlandish
# Date: 12-7-2012
#-------------------------------------------------------------------------------
# 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
# NEW - Able to call a check to see if the Quest log has any quests available
# Added a Contact or Quest Giver
# Added space for two extra rewards
# Fixed the problem on line 187-188 where it crashed if you
# didn't have any missions, thanks to Mr. Wiggles.
# NEW - Completely new Layout to make it less Empty looking
# Added longer quest names for the info screen. Now you can have more interesting
# quest names
# NEW - Made it so that if there are no quests it displays "No Quests" in
# the quest command menu and it won't open the info screen unless you
# have a quest
# NEW - WHOLE NEW LOOK
# NEW - Ability to have quests like "Kill 5 groups of lizards" or
# "Collect 2/5 rocks." Etc. It's a little tricky but I have examples of
# how to do it.
# NEW - You can now customize the fonts of each section on other things
# in the CONSTANTS section
#
# 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
# Outlandish (Gerhard Bahnsen) ~ New layout; Extra Rewards; New Contact or Quest Giver; Long Quest names
# Steven Wallace a.k.a Lethrface ~ adding ability to check for available quests
#===============================================================================
#===============================================================================
# CONSTANTS
#===============================================================================
# Long Title Font on Info screen
TITLE_FONT = "Lucida Sans Unicode", "Lucida Grande", "Verdana", "Ariel", "Helvetica", "sans-serif"
TITLE_FONT_SIZE = 28
# Info Font
INFO_FONT = "Verdana", "Ariel", "Helvetica", "sans-serif", "Trebuchet MS"
INFO_FONT_BOLD = false
INFO_FONT_SIZE = 22
# Description Font
DESC_FONT_NAME = "Verdana", "Ariel", "Helvetica", "sans-serif"
DESC_FONT_SIZE = 18
DESC_FONT_BOLD = false
# This is the name of the quests difficulty or level. You can use Rank, or Grade, etc.
DIFFICULTY_NAME = "Level"
# Quest Menu Font
#QMENU_FONT_SIZE = 18
# self.contents.font.size = QMENU_FONT_SIZE
LINE_THICKNESS = 1
LINE_SHADOW = true
module GameGuy
#==================================================
# Begin Config
# UsePicture ~ true means it'll show pictures in
# the quests, false it wont.
# (This new layout version 3.5+ doesn't allow room for a picture
# Though I suppose you could still have a picture in the background)
#==================================================
UsePicture = false
def self.qname(id)
case id
#==================================================
# Quest Short Name (for menu)
# Use when x then return "name"
# x = id, name = short quest name in quotes for quest menu
#==================================================
when 1 then return "Rock Hunt"
when 2 then return "Pay Tab"
when 3 then return "Chicken Help"
end
return ""
end
def self.qname_long(id)
case id
#==================================================
# Quest Long Name (for Info screen)
# Use when x then return "long name"
# x = id, name = quest name in quotes
# I thought it'd be cool to have a longer name in the info screen
# The short name for the menu, and a longer more
# creative name in the info screen
#==================================================
when 1 then return "Hunting Fun with Rocks"
when 2 then return "Pay the Tab"
when 3 then return "Helping the Chicken"
end
return ""
end
def self.qtype(id)
case id
#==================================================
# Quest Type for Titles
# This will change the color of the quest title
# depending on whether the quest is a mandatory story quest
# or if it's an optional side quest
# 1=Mandatory Story Quest, 2=Optional Side Quest
# nil = neither just leave it the default system color
# set these to nil if you don't want to use this feature
#==================================================
when 1 then return 2
when 2 then return nil
when 3 then return 1
end
return nil
end
def self.qreward(id)
case id
#==================================================
# Quest Reward
# Use when x then return "Reward"
# x = id, Reward = reward in quotes
#==================================================
when 1 then return "50 Gold"
when 2 then return "Potions x 3"
when 3 then return "Potion x 1"
end
return ""
end
def self.qreward2(id)
case id
#==================================================
# Quest Reward 2
# Use when x then return "Reward"
# x = id, Reward = reward in quotes
#==================================================
when 1 then return "Potions x 2"
when 2 then return "50 Gold"
when 3 then return "15 Gold"
end
return ""
end
def self.qreward3(id)
case id
#==================================================
# Quest Reward 3
# Use when x then return "Reward"
# x = id, Reward = reward in quotes
#==================================================
when 1 then return "75 EXP"
when 2 then return "Doombringer Axe"
when 3 then return "100 EXP"
end
return ""
end
def self.qpicture(id)
case id
#==================================================
# Quest Picture (the current layout doesn't really leave room for this
# Use when x then return "picture"
# x = id, picture = picutre name in quotes
#==================================================
when 1 then return "ghost"
end
return nil
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 "Grassy Plains"
when 2 then return "Eeka Village"
when 3 then return "Boolana Swamp"
end
return "????"
end
def self.qcontact(id)
case id
#==================================================
# Quest Contact - Or Quest Giver
# Use when x then return "contact"
# x = id, contact = contact in quotes
#==================================================
when 1 then return "The Tiger-lady"
when 2 then return "Edge Reman"
when 3 then return "Kip the Chicken"
end
return "????"
end
def self.qdescription(id)
case id
#==================================================
# QUEST DESCRIPTION/OBJECTIVES
# Use when x then return "description"
# x = id, description = quest description in quotes
#
# If you want to collect a certain number of items, e.g. five rocks
# then include in your description text:
# "Bring five rocks to the Tiger-lady. You've collected " + $game_variables[x].to_s + "/5 rocks."
# This uses a regular game variable (where "x" is the id number of the
# variable. e.g. "$game_variables[10].to_s" 10 is the id # of the variable
# Also don't forget the ".to_s". That converts the number into a string
#
# In addition it is possible to change the description text based on
# where the player is in the quest. Note how the text is different when
# you've completed gathering the 5 stones. You could easily use a game
# variable to control what text is shown and thus guide the player through
# different stages in a particular quest. E.g. the first stage is to find
# the lost princess. The second stage once you found her is to help her
# escape from the castle. The third stage is to bring her back to the king.
# Simply use a game variable to track where you are in the quest and then
# use if and elsif statements below to display the appropriate description
# for that stage of the quest.
#==================================================
when 1 # Collect 5 rocks
if $game_variables[28] < 5
return "Gorgonzalla the Tiger-lady wants you to collect 5 ROCKS. They're pretty huge, but thankfully your inventory pockets are bigger on the inside. You've collected " + $game_variables[28].to_s + "/5 rocks."
else
return "Return the 5 rocks to the Tiger-lady in the Grassy Plains."
end
when 2 # Fake quest 2
# Simply display the description like this
return "Bring gold to Jarns Defense to pay her tab. We also want to see just how long we can make this text. I'd like it to be really really really long. Some quests just need some description. I mean let's see if we can make it reall really long. I'd say maybe about this long. Or this long."
when 3 #Defeat 4 Basilisk mobs
if $game_variables[27] < 4
# Still need to kill mobs. Show how many you've defeated.
return "Kip the chicken wants you to defeat four groups of orange basilisk lizards in the grassy plain. You've defeated " + $game_variables[27].to_s + "/4 lizard mobs."
else
# Completed quest. Return to kip.
return "Kip the chicken wants you to defeat four groups of orange basilisk lizards in the grassy plain. Return to Kip for your reward."
end
end
return ""
end
def self.qlevel(id)
case id
#==================================================
# Quest Level or Difficulty number. This can be the minimum level the
# player must be to complete the quest
# Use when x then return "level #"
# x = id, contact = level in quotes
#==================================================
when 1 then return "1"
when 2 then return "25"
when 3 then return "5"
end
return "????"
end
end
#==============================================================================
# END CONFIG SECTION
# Don't edit below unless you know what you're doing
#==============================================================================
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
def self.check
return $game_party.check_quests
end
end
class Game_Party
attr_accessor :quests
attr_accessor :completed
attr_accessor :quests_avail
alias gg_quests_lat initialize
def initialize
@quests = []
@completed = []
gg_quests_lat
@quests_avail = false
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
def check_quests
if @quests == []
@quests_avail = false
else
@quests_avail = true
end
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
# If no quests then show No Quests in the quest menu
@quests = ["No Quests"] if @quests == []
@quests_window = Window_Command.new(160, @quests)
@quests_window.height = 480
@quests_window.back_opacity = 255 # Uncomment to make it semi-transparent
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 #Switch to menu screen
$scene = Scene_Map.new # Switch to map screen
return
end
if Input.trigger?(Input::C) and @quests != ["No Quests"]
$game_system.se_play($data_system.decision_se)
@quest_info = Window_QuestInfo.new(@quests2[@quests_window.index])
#@quest_info.back_opacity = 110 # Change this if you want a semi-transparent window
@quests_window.active = false
return
else
#$game_system.se_play($data_system.cancel_se)
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
# Draw Quests Long Title in the Info Screen
# Change the title color depending on whether it is a mandatory story quest
# or a optional side quest
if GameGuy.qtype(@quest) == 1
self.contents.font.color = Color.new(255,0,0) # Red for Story quests
elsif GameGuy.qtype(@quest) == 2
#self.contents.font.color = Color.new(30,144,255) # Blue for Side Quests
self.contents.font.color = Color.new(50,205,50) # Green for Side Quests
else
self.contents.font.color = system_color # System color for none
end
self.contents.font.name = TITLE_FONT
self.contents.font.bold = true
self.contents.font.size = TITLE_FONT_SIZE
#self.contents.draw_text(0, 0, 480, 32, GameGuy.qname(@quest))
self.contents.draw_text(0, 0, 480, 32, GameGuy.qname_long(@quest))
self.contents.font.size = INFO_FONT_SIZE
self.contents.font.name = INFO_FONT
self.contents.font.bold = INFO_FONT_BOLD
self.contents.font.color = normal_color
self.contents.draw_text(335, 0, 480, 32, DIFFICULTY_NAME + ": " + GameGuy.qlevel(@quest))
# Draw top line
self.contents.fill_rect(0, 38, 480, LINE_THICKNESS, normal_color)
if LINE_SHADOW == true
y = 38 + LINE_THICKNESS
self.contents.fill_rect(0, y, 480, LINE_THICKNESS, Color.new(0, 0, 0, 255))
end
# Draw Info
self.contents.font.bold = INFO_FONT_BOLD
self.contents.font.color = system_color
self.contents.draw_text(0, 48, 480, 32, "Location:")
self.contents.font.color = normal_color
self.contents.draw_text(0, 74, 480, 32, GameGuy.qlocation(@quest))
self.contents.font.color = system_color
self.contents.draw_text(220, 48, 480, 32, "Contact:")
self.contents.font.color = normal_color
self.contents.draw_text(220, 74, 480, 32, GameGuy.qcontact(@quest))
self.contents.font.color = system_color
self.contents.draw_text(0, 106, 480, 32, "Reward:")
self.contents.font.color = normal_color
#self.contents.font.size = self.contents.font.size - 5
#self.contents.font.bold = true
self.contents.draw_text(0, 132, 480, 32, GameGuy.qreward(@quest))
self.contents.draw_text(0, 158, 480, 32, GameGuy.qreward2(@quest))
self.contents.draw_text(0, 184, 480, 32, GameGuy.qreward3(@quest))
#self.contents.font.size = self.contents.font.size + 5
#self.contents.font.bold = false
self.contents.font.color = system_color
self.contents.draw_text(220, 106, 480, 32, "Status:")
self.contents.font.color = normal_color
if $game_party.completed.include?(@quest)
self.contents.font.color = crisis_color
self.contents.draw_text(220, 132, 480, 32, "Completed")
else
self.contents.font.color = normal_color
self.contents.draw_text(220, 132, 480, 32, "In Progress")
end
# Draw bottom line
#self.contents.fill_rect(0, 221, 480, 1, Color.new(0, 0, 0, 255)) #Shadow line
self.contents.fill_rect(0, 220, 480, LINE_THICKNESS, normal_color)
if LINE_SHADOW == true
y = 220 + LINE_THICKNESS
self.contents.fill_rect(0, y, 480, LINE_THICKNESS, Color.new(0, 0, 0, 255))
end
# Draw Description
self.contents.font.color = system_color
self.contents.draw_text(0, 226, 480, 32, "Description:")
self.contents.font.name = DESC_FONT_NAME
self.contents.font.bold = DESC_FONT_BOLD
self.contents.font.color = normal_color
self.contents.font.size = DESC_FONT_SIZE
text = self.contents.slice_text(GameGuy.qdescription(@quest), 450)
text.each_index {|i|
self.contents.draw_text(0, 254 + i*28, 450, 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
Credit
- game_guy
- Outlandish, for the updates
Thanks- Lethrface ~ Added some updates a while back
- Beta Testers ~ Sally and Landith
Support
Contact me here on this forum if you need help, though my scripting is limited and I don't always come here. But I'll try to help if I can.
Known Compatibility IssuesI don't know of any yet. Not tested with SDK yet. I haven't had a chance to test it with any other scripts.
Edit: It should be compatible with most scripts. I've tested it in a project with quite of few scripts including the SDK 2.4 (I think) and it seemed to work fine. Please let me know if there's any problem.
Demo
http://legendsfromthevoid.com/downloads/QuestLogNew4_5-Final.zipHere's the demo with the updated version 4.6. If this doesn't work try the above demo as it's hosted on a different server.
http://www.mediafire.com/?hstc87m8z7g4u74Notes
Enjoy and give credits!
Edit: Drat, I just tested it with the sound on and found a bug. When you go to open the quest window it continuously repeats the bleep sound effect. I commented that out and I'm updating the script with version 4.6. The code isn't exactly elegant but it seems to work ok now.