Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> [SOLVED]quest script add image, not for quest, but for no quest
Viewer
post Mar 3 2011, 04:10 AM
Post #1


Level 4
Group Icon

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




I have modern algebra's Quest journal script. I couldn't find the link to the demo so I posted the script.

The script shows 3 categories of quests: active(in progress), complete, failed. What I need is an image in the description window that will allways be used if there is no quest to show, for each of the 3 categories. Meaning if I have no quest, an image with a red circle or something will appear instead of the normal quest image(the script uses an image for each quest, all in Graphics/Quests folder).
For better understanding, the script should be copied in a project.
Also, scene_menu must be changed to be able to access the Scene_Quest.
Thanks to anyone who might be interested in helping me.

Here's the script:

Title

CODE

#==============================================================================
# Quest Journal
# Version: 1.1
# Author: modern algebra (rmrk.net)
# Date: March 24, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Description:
# Basically, this script is an objective based quest log that allows the
# user to make quests and reveal them to the characters through specified
# script calls. It is objective based, meaning that you advance the quest
# by having the player complete objectives and you can choose when to reveal
# these objectives and when to set them as complete or as failed. That being
# said, this script does not build quests, it more or less gives you a
# graphical interface for showing quest progress. It does run by script
# call, and so read the instructions carefully if you want to use this script
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Instructions:
# Basically, set up all of your quests in the module below. The Constants
# section is annotated, so read the comments near them to determine what you
# should set these constants to. As you can see, they are filled in with
# default values currently, and so that should give you an idea of what to
# do.
#
# Setting up quests can be a little bit harder. You will have to set one
# of these up for every quest that you want represented in the scene. Refer
# to the editable region inside the class Quest for further instructions
#
# Once they are setup, you can activate them at any time in the game by
# this code:
#
# $game_party.quests[quest_id]
#
# There are several methods you can call that are of relevance. Namely:
#
# $game_party.quests[quest_id].reveal_objective (objective_id)
# $game_party.quests[quest_id].conceal_objective (objective_id)
# $game_party.quests[quest_id].complete_objective (objective_id)
# $game_party.quests[quest_id].uncomplete_objective (objective_id)
# $game_party.quests[quest_id].fail_objective (objective_id)
# $game_party.quests[quest_id].unfail_objective (objective_id)
# $game_party.quests[quest_id].complete?
# $game_party.quests[quest_id].failed?
# $game_party.quests[quest_id].reward_given = true/false
# $game_party.quests[quest_id].concealed = true/false
# $game_party.quests.remove (quest_id)
#
# There are other methods that you can access, but they are irrelevant for
# the purposes of controlling quest progress. These are fairly self-
# explanatory methods, but in case they aren't, reveal_objective naturally
# allows the specified objective to appear in the Quest Journal for browsing
# by the user. complete_objective notes when an objective is complete, and
# fail_objective notes when the player has done something that fails this
# objective. complete? returns true if all primary objectives have been
# completed and failed? returns true if any primary objective has been
# failed. reward_given serves the function of a switch. You should
# essentially make the reward event look like this:
#
# @> Conditional Branch: Script: $game_party.quests[quest_id].complete?
# @> Conditional Branch: Script: $game_party.quests[quest_id].reward_given
# @> ...Thank you or whatever you want the event to say once the reward has been given
# @> Else
# @> ...Give Reward
# @> Script: $game_party.quests[quest_id].reward_given = true
# @> Branch End
# @> Branch End
#
# Later versions of this script will have an auto-reward system and also a
# Journal to which the player can write notes.
#
# You can also disable access to the Quest Log at any time with the code:
# $game_system.quest_disabled = true
#
# And you can change how it is accessed with the codes:
#
# $game_system.quest_keyaccess = true / false # ON MAP
# $game_system.quest_menuaccess = true / false # IN MENU
#
# Also, in a message, \nq[quest_id] will retrieve the name of a quest and
# print it in a message

#===============================================================================
=
# This is needed for quest image
#===============================================================================
=

module Cache
#--------------------------------------------------------------------------
# * Get Animation Graphic
# filename : Filename
#--------------------------------------------------------------------------
def self.quests(filename)
load_bitmap("Graphics/Quests/", filename) # the folder is Quests
end
end

#===============================================================================
=
# *** Quest Data
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~
# This is the configuration class for the Quest Journal
#===============================================================================
=

module ModAlg_QuestData
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Constants
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Editable Region
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
QUESTS_LABEL = 'Quests' # What you want Quests to be called (eg. 'Missions')
ACTIVE_QUEST_ICON = 149 # What icon signifies a quest is active
COMPLETE_QUEST_ICON = 150 # What icon signifies a quest is complete
FAILED_QUEST_ICON = 179 # What icon signifies a quest is failed
BULLET_CHARACTER = '●' # The character used for listing objectives
ACTIVE_COLOUR = 0 # The colour of a quest that is active
COMPLETE_COLOUR = 11 # The colour of a quest that is complete
FAILED_COLOUR = 18 # The colour of a quest that is failed
MENU_ACCESS = true # Can the script be accessed through the menu?
MENU_INDEX = 4 # If above is true, where in the command window?
KEY_ACCESS = true # Can the quest log be accessed by a key
MAPKEY_BUTTON = Input::L # If above is true, which button?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Quest Data
#----------------------------------------------------------------------------
# Returns skeleton data for the quesr
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.quest_data (id)
# Set class variables to corresponding arguments
objectives = []
name = '??????'
description = '??????????'
icon_index = 0
case id
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * EDITABLE REGION
#------------------------------------------------------------------------
# To set up a quest, first identify it with an ID - this can be anything
# as long as it is not the same as another quest, but it is important to
# remember this ID as it is the only way to access your quest.
# In any case, the format for setting up a quest is:
#
# when <quest_id> # Give the quest an ID number
# name = '<quest_name>'
# description = '<quest_description>'
# objectives[0] = '<first_objective>'
# ...
# objectives[n] = '<nth objective>'
# prime = [<objective_id>, ..., <objective_id>]
# icon_index = <quest_icon_index>
#
# Each of these values have an importance.
# name is the name of the quest
# description is a small blurb explaining the overall goal of the quest
# objective[0..n] are short-term goals that lead to the overall goal
# primes are which objectives need to be complete before the quest is
# considered to be complete
# icon_index is the icon that represents the quest
#
# Note that any of the above values can be omitted without throwing an
# error, but for the quest to work properly you should at least set the
# name, description, and objectives. If you do omit these, the default
# values are:
#
# name = '??????'
# description = '??????????'
# objectives = []
# prime = [all objectives]
# icon_index = 0
#
# If you do want to require that all objectives must be satisfied before
# the quest is complete, then do not bother defining it. Otherwise, be
# sure to set it.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
when 1 # Fetch
name = 'Quest 1 test'
description = 'Martha needs someone to play with her dog'
objectives[0] = 'Find a stick'
objectives[1] = 'Throw the stick to the dog'
objectives[2] = 'Retrieve the stick from the dog'
objectives[3] = 'Retrieve the stick from the dog again'
objectives[4] = 'Retrieve the stick from the dog again and again'
objectives[5] = 'Find a stick'
objectives[6] = 'Throw the stick to the dog'
objectives[7] = 'Retrieve the stick from the dog'
objectives[8] = 'Retrieve the stick from the dog again'
objectives[9] = 'Retrieve the stick from the dog again and again'
prime = [0, 1,2,3,4,5,6,7,8,9]
icon_index = 79
when 2 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 3 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 4 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 5 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 6 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 7 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 8 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 9 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 10 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 11 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 12 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 13 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * END EDITABLE REGION
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
end
return name, description, objectives, prime, icon_index
end

#============================================================================
# ** Quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Holds in-game data for a quest
#============================================================================

class Quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :name # The name of the quest
attr_reader :id # The ID in $game_party.quests
attr_reader :description # A blurb explaining the quest
attr_reader :objectives # An array of strings holding objectives
attr_reader :prime_objectives # An array of crucial objectives
attr_reader :icon_index # The Icon associated with this quest
attr_reader :revealed_objectives # An array of revealed objectives
attr_reader :complete_objectives # An array of completed objectives
attr_reader :failed_objectives # An array of failed objectives
attr_accessor :reward_given # A switch to ensure only one reward given
attr_accessor :concealed # A switch to show or not show the quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize (id)
@id = id
# Set class variables to corresponding arguments
@name, @description, @objectives, prime, @icon_index = ModAlg_QuestData.quest_data (id)
# If no primary objectives are specified
if prime.nil?
# All objectives become primary
prime = []
for i in 0...@objectives.size
prime.push (i)
end
end
@prime_objectives = prime
# Initialize non-public arrays
@revealed_objectives = []
@complete_objectives = []
@failed_objectives = []
@reward_given = false
@concealed = false
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Reveal Objective
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def reveal_objective (index)
return if index >= @objectives.size
# Add to revealed objectives
@revealed_objectives |= [index]
# Sort from lowest index to highest index
# @revealed_objectives.sort!
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Conceal Objective
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def conceal_objective (index)
@revealed_objectives.delete (index)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Complete Objective
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def complete_objective (index)
return if index >= @objectives.size
# If the objective is failed, you cannot complete it.
return if @failed_objectives.include? (index)
# Reveal the objective if it was not previously revealed
reveal_objective (index) unless @revealed_objectives.include? (index)
# Add to complete objectives
@complete_objectives |= [index]
# Sort from lowest index to highest index
@complete_objectives.sort!
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Uncomplete Objective
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def uncomplete_objective (index)
@complete_objectives.delete (index)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Fail Objective
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def fail_objective (index)
return if index >= @objectives.size
# Reveal the objective if it has not yet been revealed
reveal_objective (index) unless @revealed_objectives.include? (index)
# Add to revealed objectives
@failed_objectives |= [index]
# Sort from lowest index to highest index
@failed_objectives.sort!
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Unfail Objective
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def unfail_objective (index)
@failed_objectives.delete (index)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Complete?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def complete?
# Check if all prime objectives have been completed
return (@complete_objectives & @prime_objectives) == @prime_objectives
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Failed?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def failed?
# Check if any prime objectives have been failed
return (@failed_objectives & @prime_objectives) != []
end
end
end

#==============================================================================
# ** Game_Party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new instance variable - quests
# aliased method - initialize
#==============================================================================

class Game_Party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :quests
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_qst_jrnl_party_init_quests initialize
def initialize
# Run Original Method
modalg_qst_jrnl_party_init_quests
# Initialize @quests
@quests = Game_Quests.new
end
end

#==============================================================================
# ** Game_Quests
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This class handles Quests. It is a wrapper for the built-in class "Hash".
# The instance of this class is accessed by $game_party.quests
#==============================================================================

class Game_Quests
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize
@data = {}
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Quest
# quest_id : the ID of the quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def [] (quest_id)
@data[quest_id] = ModAlg_QuestData::Quest.new (quest_id) if @data[quest_id] == nil
return @data[quest_id]
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Quest List
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def list
quest_list = @data.values
quest_list.each { |i| quest_list.delete (i) if i.concealed }
return quest_list
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Completed Quest List
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def completed_list
complete_quests = []
list.each { |i| complete_quests.push (i) if i.complete? }
return complete_quests
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Failed Quest List
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def failed_list
failed_quests = []
list.each { |i| failed_quests.push (i) if i.failed? }
return failed_quests
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Active Quest List
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def active_list
return list - failed_list - completed_list
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Revealed?
# quest_id : the ID of a checked quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def revealed? (quest_id)
return @data[quest_id] != nil
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Remove Quest
# quest_id : the ID of a checked quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def remove (quest_id)
@data.delete (quest_id)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Clear
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def clear
@data.clear
end
end

#==============================================================================
# ** Window_QuestCategory
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This window displays which category that is being viewed
#==============================================================================

class Window_QuestCategory < Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize(x, y, width)
super (x, y, width, WLH + 32)
# create_contents
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
# category_index : icon to highlight -
# 0 => All, 1 => Active, 2 => Complete, 3 => Failed
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def refresh (category_index = 0)
self.contents.clear
# Retrieve Icon Bitmaps
bitmap = Cache.system("Iconset")

# theese 2 lines below show the icon of active quests
icon_index = ModAlg_QuestData::ACTIVE_QUEST_ICON
active_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
icon_index = ModAlg_QuestData::COMPLETE_QUEST_ICON
complete_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
icon_index = ModAlg_QuestData::FAILED_QUEST_ICON
failed_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)

# Draw the 'Active' Icon onto the window
if category_index == 0
self.contents.blt (x, 0, bitmap, active_rect, category_index == 0 ? 255 : 75)
# below, check if cursor on active(category_index == 0 ?). If yes->opactiy = 128
self.contents.font.color = text_color (ModAlg_QuestData::ACTIVE_COLOUR)
self.contents.draw_text (24, 0, self.contents.width, WLH, 'Current')
elsif category_index == 1
# Draw the 'Complete' Icon onto the window
self.contents.blt (x, 0, bitmap, complete_rect, category_index == 1 ? 255 : 75)
self.contents.font.color = text_color (ModAlg_QuestData::COMPLETE_COLOUR)
self.contents.draw_text (x + 24, 0, self.contents.width, WLH, 'Complete')
# Draw the 'Failed' Icon onto the window
elsif category_index == 2
self.contents.blt (x, 0, bitmap, failed_rect, category_index == 2 ? 255 : 75)
self.contents.font.color = text_color (ModAlg_QuestData::FAILED_COLOUR)
self.contents.draw_text (x + 24, 0, self.contents.width, WLH, 'Failed')
end
end
end

#==============================================================================
# ** Window_QuestList
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This window displays the list of quests
#==============================================================================

class Window_QuestList < Window_Selectable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize (x, y, width, category_index = 0, index = 0)
super (x, y, width, 56)
@data = []
@column_max = 1
refresh (category_index)
self.index = index
self.active = true
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def quest
return @data[self.index]
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
# category_index : List to show -
# 0 => All, 1 => Active, 2 => Complete, 3 => Failed
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def refresh (category_index = 0)
@data.clear
self.index = 0
# Get the quest list to be drawn
case category_index
when 0
@data = $game_party.quests.active_list
self.height = [[Graphics.height - 288, @data.size*24+32].min, 56].max # added

@item_max = @data.size # maybe this has stoped scroll
unless contents == nil
# Clear Contents
contents.clear
return if @data.empty?
contents.dispose
end
# Create Contents
self.contents = Bitmap.new (width - 32, WLH*@data.size)
for i in 0...@data.size
quest = @data[i]
draw_icon (quest.icon_index, 0, i*WLH)
# Draw the name of the quest
self.contents.font.color = text_color (ModAlg_QuestData::ACTIVE_COLOUR)
self.contents.draw_text (24, i*WLH, contents.width - 24, WLH, quest.name)
end

when 1
@data = $game_party.quests.completed_list
# added 'self.contents.'
self.height = [[Graphics.height - 288, @data.size*24+32].min, 56].max # added

@item_max = @data.size # maybe this has stoped scroll
unless contents == nil
# Clear Contents
contents.clear
return if @data.empty?
contents.dispose
end
# Create Contents
self.contents = Bitmap.new (width - 32, WLH*@data.size)
for i in 0...@data.size
quest = @data[i]
draw_icon (quest.icon_index, 0, i*WLH)
# Draw the name of the quest
self.contents.font.color = text_color (ModAlg_QuestData::COMPLETE_COLOUR)
self.contents.draw_text (24, i*WLH, contents.width - 24, WLH, quest.name)
end

when 2
@data = $game_party.quests.failed_list
# added 'self.contents.'
self.height = [[Graphics.height - 288, @data.size*24+32].min, 56].max # added

@item_max = @data.size # maybe this has stoped scroll
unless contents == nil
# Clear Contents
contents.clear
return if @data.empty?
contents.dispose
end
# Create Contents
self.contents = Bitmap.new (width - 32, WLH*@data.size)
for i in 0...@data.size
quest = @data[i]
draw_icon (quest.icon_index, 0, i*WLH)
# Draw the name of the quest
self.contents.font.color = text_color (ModAlg_QuestData::FAILED_COLOUR)
self.contents.draw_text (24, i*WLH, contents.width - 24, WLH, quest.name)
end

end
end
end

#==============================================================================
# ** Window_QuestInfo
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This window displays the information on the quest being viewed
#==============================================================================

class Window_QuestInfo < Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize(x, y, width, height)
super (x, y, width, height)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def refresh (quest = nil)
self.contents.clear # added 'self.' for all
return if quest == nil

#ADDED to show picture with quest
# below in Rect.new you can change the rectangle dimensiond of picture
self.contents.blt(0, WLH, Cache.quests(quest.name), Rect.new(0, 0, self.width, 6 * WLH))
# ex-bitmap
#ADDED to show picture with quest
self.contents.font.color = normal_color
self.contents.draw_text (0, 0, width, WLH, quest.name, 1)
self.contents.draw_text (0, 6 * WLH + WLH, self.width, WLH, quest.description)

self.contents.font.color = system_color
self.contents.draw_text (0, 6 * WLH + WLH * 3, self.width, WLH, 'Tasks')

row = 0 # var needed to properly arrange objectives(initialized)
quest.revealed_objectives.each { |i|
self.contents.font.color = quest.complete_objectives.include? (i) ?
text_color (ModAlg_QuestData::COMPLETE_COLOUR) : quest.failed_objectives.include? (i) ?
text_color (ModAlg_QuestData::FAILED_COLOUR) : text_color (ModAlg_QuestData::ACTIVE_COLOUR)
objective = quest.objectives[i]

# condition needed to properly calculate objective row
if i == 0 # if first objective reveald
row = 0 # put in row 0
else
row += i/i # increase row(initial 0) by 1
end
self.contents.draw_text (WLH, 6 * WLH + (WLH * 4) + (row * WLH) + 8, self.width, WLH, objective)
self.contents.draw_text (0, 6 * WLH + (WLH * 4) + (row * WLH) + 8, self.width, WLH, ModAlg_QuestData::BULLET_CHARACTER)
}
end
end

#==============================================================================
# ** Scene_Quest
#------------------------------------------------------------------------------
# This class performs the quest screen processing.
#==============================================================================

class Scene_Quest < Scene_Base
#--------------------------------------------------------------------------
# new method: create_command_list
#--------------------------------------------------------------------------
def create_command_list
vocab = []
commands = []
icons = []
index_list = {}
YEZ::MENU::MENU_COMMANDS.each_with_index { |c,i|
case c
when :items
index_list[:items] = commands.size
vocab.push(Vocab.item)

when :skill # Skills
index_list[:skill] = commands.size
vocab.push(Vocab.skill)

when :equip # Equip
index_list[:equip] = commands.size
vocab.push(Vocab.equip)

when :status # Status
index_list[:status] = commands.size
vocab.push(Vocab.status)

when :quest # Save
index_list[:save] = commands.size
vocab.push('Quests')

when :system # System
index_list[:system] = commands.size
vocab.push(Vocab.game_end)

end

commands.push©
icons.push(menu_icon©)
} # YEZ::MENU::MENU_COMMANDS.each_with_index
@menu_array = [vocab, commands, icons]
end

#--------------------------------------------------------------------------
# new method: menu_icon
#--------------------------------------------------------------------------
def menu_icon(command)
if YEZ::MENU::MENU_ICONS.include?(command)
return YEZ::MENU::MENU_ICONS[command]
else
return YEZ::MENU::MENU_ICONS[:unused]
end
end

#--------------------------------------------------------------------------
# overwrite method: create_command_window
#--------------------------------------------------------------------------
def create_command_window
create_command_list
@command_window = Window_MenuCommand.new(@menu_array)
@command_window.height = [@command_window.height,
YEZ::MENU::MAX_ROWS * 24 + 32].min
@command_window.index = 4
end

#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(category_index = 0, quest_index = 0)
@category_index = category_index
@quest_index = quest_index
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
# Create Windows
# @label_window = Window_QuestLabel.new
# ADDED
create_command_window
@gold_window = Window_Gold.new(0, @command_window.height) # added
# ADDED
@category_window = Window_QuestCategory.new(0, @command_window.height + @gold_window.height, @command_window.width)
@category_window.refresh (@category_index)
@list_window = Window_QuestList.new (0, @command_window.height + @gold_window.height + 56, @command_window.width, @category_index, @quest_index)
@info_window = Window_QuestInfo.new(@command_window.width, 56, Graphics.width - @command_window.width, Graphics.height - 56)
@info_window.refresh (@list_window.quest)
@help_window = Window_Help.new(@command_window.width, @info_window.width)
@help_window.y = 0
@help_window.set_text ('LEFT/RIGHT: switch category', 1)

@category_window.openness = 0
@list_window.openness = 0
@info_window.openness = 0
@help_window.openness = 0
end
#--------------------------------------------------------------------------
# * Pre-termination Processing
#--------------------------------------------------------------------------
def pre_terminate
super
@category_window.close
@list_window.close
@info_window.close
@help_window.close
begin
@category_window.update
@list_window.update
@info_window.update
@help_window.update
Graphics.update
end until (@category_window.openness == 0) && (@list_window.openness == 0) && (@info_window.openness == 0) && (@help_window.openness == 0)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
# @label_window.dispose
@category_window.dispose
@list_window.dispose
@info_window.dispose
@help_window.dispose
@gold_window.dispose
@command_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@category_window.open
@list_window.open
@info_window.open
@help_window.open

@category_window.update
@list_window.update
@info_window.update
@help_window.update

if Input.trigger?(Input::B) # If Button B is pressed
Sound.play_cancel
$scene = Scene_Menu.new(4) # changed
elsif Input.trigger?(HOTKEYS::Menu) # If Button M is pressed
Sound.play_cancel
$game_temp.next_scene = Scene_Map.new # I don't know why I added this, but
# it seems that the part animations won't reappear without it, on scene exit.
$scene = Scene_Map.new
elsif Input.trigger? (Input::C) # If C(enter/space) button is pressed
# Open Journal (eventually)
elsif Input.trigger? (Input::LEFT) # If Left direction pressed
# Play Cursor SE
Sound.play_cursor
# Refresh Category Window
@category_index = (@category_index - 1) % 3
$scene = Scene_Quest.new(@category_index) # added to dinamicly open/close
elsif Input.trigger? (Input::RIGHT) # If C pressed
# Play Cursor SE
Sound.play_cursor
# Refresh Category Window
@category_index = (@category_index + 1) % 3
$scene = Scene_Quest.new(@category_index) # added to dinamicly open/close
# If scrolling through quests
elsif Input.trigger? (Input::DOWN) || Input.trigger? (Input::UP)
# Refresh Info Window
@info_window.refresh (@list_window.quest)
end
end
end





This post has been edited by Viewer: Mar 6 2011, 01:34 AM
Go to the top of the page
 
+Quote Post
   
brewmeister
post Mar 3 2011, 05:22 AM
Post #2


Paste above Main
Group Icon

Group: Revolutionary
Posts: 408
Type: Scripter
RM Skill: Skilled




missing module: YEZ

If you've modified MA's script, you should post your own demo with your modifications & dependent scripts.


__________________________
Go to the top of the page
 
+Quote Post
   
Viewer
post Mar 4 2011, 11:47 PM
Post #3


Level 4
Group Icon

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




Oh, sorry. Here's a demo:

Go to the top of the page
 
+Quote Post
   
brewmeister
post Mar 5 2011, 06:49 AM
Post #4


Paste above Main
Group Icon

Group: Revolutionary
Posts: 408
Type: Scripter
RM Skill: Skilled




That was easier than I thought....

on line 787, it says"

return if quest == nil

replace that with

CODE
#ADDED to show picture with no quest    
    if quest == nil
      self.contents.blt(0, WLH, Cache.quests("no_quest"), Rect.new(0, 0, self.width, 6 * WLH))
      return
    end


then put an image called "no_quest.jpg" or "no_quest.png" in the Images\Quests folder


__________________________
Go to the top of the page
 
+Quote Post
   
Viewer
post Mar 6 2011, 01:33 AM
Post #5


Level 4
Group Icon

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




You're right, that was easy. But obviously, not for me.
Thanks a lot.
Go to the top of the page
 
+Quote Post
   
TTrain427
post May 15 2011, 11:27 AM
Post #6


Level 13
Group Icon

Group: Revolutionary
Posts: 229
Type: Writer
RM Skill: Intermediate




QUOTE (Viewer @ Mar 3 2011, 04:10 AM) *
I have modern algebra's Quest journal script. I couldn't find the link to the demo so I posted the script.

The script shows 3 categories of quests: active(in progress), complete, failed. What I need is an image in the description window that will allways be used if there is no quest to show, for each of the 3 categories. Meaning if I have no quest, an image with a red circle or something will appear instead of the normal quest image(the script uses an image for each quest, all in Graphics/Quests folder).
For better understanding, the script should be copied in a project.
Also, scene_menu must be changed to be able to access the Scene_Quest.
Thanks to anyone who might be interested in helping me.

Here's the script:

Title

CODE

#==============================================================================
# Quest Journal
# Version: 1.1
# Author: modern algebra (rmrk.net)
# Date: March 24, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Description:
# Basically, this script is an objective based quest log that allows the
# user to make quests and reveal them to the characters through specified
# script calls. It is objective based, meaning that you advance the quest
# by having the player complete objectives and you can choose when to reveal
# these objectives and when to set them as complete or as failed. That being
# said, this script does not build quests, it more or less gives you a
# graphical interface for showing quest progress. It does run by script
# call, and so read the instructions carefully if you want to use this script
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Instructions:
# Basically, set up all of your quests in the module below. The Constants
# section is annotated, so read the comments near them to determine what you
# should set these constants to. As you can see, they are filled in with
# default values currently, and so that should give you an idea of what to
# do.
#
# Setting up quests can be a little bit harder. You will have to set one
# of these up for every quest that you want represented in the scene. Refer
# to the editable region inside the class Quest for further instructions
#
# Once they are setup, you can activate them at any time in the game by
# this code:
#
# $game_party.quests[quest_id]
#
# There are several methods you can call that are of relevance. Namely:
#
# $game_party.quests[quest_id].reveal_objective (objective_id)
# $game_party.quests[quest_id].conceal_objective (objective_id)
# $game_party.quests[quest_id].complete_objective (objective_id)
# $game_party.quests[quest_id].uncomplete_objective (objective_id)
# $game_party.quests[quest_id].fail_objective (objective_id)
# $game_party.quests[quest_id].unfail_objective (objective_id)
# $game_party.quests[quest_id].complete?
# $game_party.quests[quest_id].failed?
# $game_party.quests[quest_id].reward_given = true/false
# $game_party.quests[quest_id].concealed = true/false
# $game_party.quests.remove (quest_id)
#
# There are other methods that you can access, but they are irrelevant for
# the purposes of controlling quest progress. These are fairly self-
# explanatory methods, but in case they aren't, reveal_objective naturally
# allows the specified objective to appear in the Quest Journal for browsing
# by the user. complete_objective notes when an objective is complete, and
# fail_objective notes when the player has done something that fails this
# objective. complete? returns true if all primary objectives have been
# completed and failed? returns true if any primary objective has been
# failed. reward_given serves the function of a switch. You should
# essentially make the reward event look like this:
#
# @> Conditional Branch: Script: $game_party.quests[quest_id].complete?
# @> Conditional Branch: Script: $game_party.quests[quest_id].reward_given
# @> ...Thank you or whatever you want the event to say once the reward has been given
# @> Else
# @> ...Give Reward
# @> Script: $game_party.quests[quest_id].reward_given = true
# @> Branch End
# @> Branch End
#
# Later versions of this script will have an auto-reward system and also a
# Journal to which the player can write notes.
#
# You can also disable access to the Quest Log at any time with the code:
# $game_system.quest_disabled = true
#
# And you can change how it is accessed with the codes:
#
# $game_system.quest_keyaccess = true / false # ON MAP
# $game_system.quest_menuaccess = true / false # IN MENU
#
# Also, in a message, \nq[quest_id] will retrieve the name of a quest and
# print it in a message

#===============================================================================
=
# This is needed for quest image
#===============================================================================
=

module Cache
#--------------------------------------------------------------------------
# * Get Animation Graphic
# filename : Filename
#--------------------------------------------------------------------------
def self.quests(filename)
load_bitmap("Graphics/Quests/", filename) # the folder is Quests
end
end

#===============================================================================
=
# *** Quest Data
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~
# This is the configuration class for the Quest Journal
#===============================================================================
=

module ModAlg_QuestData
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Constants
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Editable Region
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
QUESTS_LABEL = 'Quests' # What you want Quests to be called (eg. 'Missions')
ACTIVE_QUEST_ICON = 149 # What icon signifies a quest is active
COMPLETE_QUEST_ICON = 150 # What icon signifies a quest is complete
FAILED_QUEST_ICON = 179 # What icon signifies a quest is failed
BULLET_CHARACTER = '●' # The character used for listing objectives
ACTIVE_COLOUR = 0 # The colour of a quest that is active
COMPLETE_COLOUR = 11 # The colour of a quest that is complete
FAILED_COLOUR = 18 # The colour of a quest that is failed
MENU_ACCESS = true # Can the script be accessed through the menu?
MENU_INDEX = 4 # If above is true, where in the command window?
KEY_ACCESS = true # Can the quest log be accessed by a key
MAPKEY_BUTTON = Input::L # If above is true, which button?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Quest Data
#----------------------------------------------------------------------------
# Returns skeleton data for the quesr
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.quest_data (id)
# Set class variables to corresponding arguments
objectives = []
name = '??????'
description = '??????????'
icon_index = 0
case id
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * EDITABLE REGION
#------------------------------------------------------------------------
# To set up a quest, first identify it with an ID - this can be anything
# as long as it is not the same as another quest, but it is important to
# remember this ID as it is the only way to access your quest.
# In any case, the format for setting up a quest is:
#
# when <quest_id> # Give the quest an ID number
# name = '<quest_name>'
# description = '<quest_description>'
# objectives[0] = '<first_objective>'
# ...
# objectives[n] = '<nth objective>'
# prime = [<objective_id>, ..., <objective_id>]
# icon_index = <quest_icon_index>
#
# Each of these values have an importance.
# name is the name of the quest
# description is a small blurb explaining the overall goal of the quest
# objective[0..n] are short-term goals that lead to the overall goal
# primes are which objectives need to be complete before the quest is
# considered to be complete
# icon_index is the icon that represents the quest
#
# Note that any of the above values can be omitted without throwing an
# error, but for the quest to work properly you should at least set the
# name, description, and objectives. If you do omit these, the default
# values are:
#
# name = '??????'
# description = '??????????'
# objectives = []
# prime = [all objectives]
# icon_index = 0
#
# If you do want to require that all objectives must be satisfied before
# the quest is complete, then do not bother defining it. Otherwise, be
# sure to set it.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
when 1 # Fetch
name = 'Quest 1 test'
description = 'Martha needs someone to play with her dog'
objectives[0] = 'Find a stick'
objectives[1] = 'Throw the stick to the dog'
objectives[2] = 'Retrieve the stick from the dog'
objectives[3] = 'Retrieve the stick from the dog again'
objectives[4] = 'Retrieve the stick from the dog again and again'
objectives[5] = 'Find a stick'
objectives[6] = 'Throw the stick to the dog'
objectives[7] = 'Retrieve the stick from the dog'
objectives[8] = 'Retrieve the stick from the dog again'
objectives[9] = 'Retrieve the stick from the dog again and again'
prime = [0, 1,2,3,4,5,6,7,8,9]
icon_index = 79
when 2 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 3 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 4 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 5 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 6 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 7 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 8 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 9 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 10 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 11 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 12 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
when 13 # Cat Retrieval
name = 'Cat Retrieval'
description = 'Mrs. Bunderby has lost her cat, and she has employed you to find it.'
objectives[0] = 'Find the lost cat'
objectives[1] = 'Climb the tree and retrieve the cat'
objectives[2] = "Return a cat to Mrs. Bunderby"
# Set prime objectives in an array based on index
prime = [0, 2]
icon_index = 137
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * END EDITABLE REGION
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
end
return name, description, objectives, prime, icon_index
end

#============================================================================
# ** Quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Holds in-game data for a quest
#============================================================================

class Quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :name # The name of the quest
attr_reader :id # The ID in $game_party.quests
attr_reader :description # A blurb explaining the quest
attr_reader :objectives # An array of strings holding objectives
attr_reader :prime_objectives # An array of crucial objectives
attr_reader :icon_index # The Icon associated with this quest
attr_reader :revealed_objectives # An array of revealed objectives
attr_reader :complete_objectives # An array of completed objectives
attr_reader :failed_objectives # An array of failed objectives
attr_accessor :reward_given # A switch to ensure only one reward given
attr_accessor :concealed # A switch to show or not show the quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize (id)
@id = id
# Set class variables to corresponding arguments
@name, @description, @objectives, prime, @icon_index = ModAlg_QuestData.quest_data (id)
# If no primary objectives are specified
if prime.nil?
# All objectives become primary
prime = []
for i in 0...@objectives.size
prime.push (i)
end
end
@prime_objectives = prime
# Initialize non-public arrays
@revealed_objectives = []
@complete_objectives = []
@failed_objectives = []
@reward_given = false
@concealed = false
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Reveal Objective
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def reveal_objective (index)
return if index >= @objectives.size
# Add to revealed objectives
@revealed_objectives |= [index]
# Sort from lowest index to highest index
# @revealed_objectives.sort!
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Conceal Objective
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def conceal_objective (index)
@revealed_objectives.delete (index)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Complete Objective
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def complete_objective (index)
return if index >= @objectives.size
# If the objective is failed, you cannot complete it.
return if @failed_objectives.include? (index)
# Reveal the objective if it was not previously revealed
reveal_objective (index) unless @revealed_objectives.include? (index)
# Add to complete objectives
@complete_objectives |= [index]
# Sort from lowest index to highest index
@complete_objectives.sort!
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Uncomplete Objective
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def uncomplete_objective (index)
@complete_objectives.delete (index)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Fail Objective
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def fail_objective (index)
return if index >= @objectives.size
# Reveal the objective if it has not yet been revealed
reveal_objective (index) unless @revealed_objectives.include? (index)
# Add to revealed objectives
@failed_objectives |= [index]
# Sort from lowest index to highest index
@failed_objectives.sort!
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Unfail Objective
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def unfail_objective (index)
@failed_objectives.delete (index)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Complete?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def complete?
# Check if all prime objectives have been completed
return (@complete_objectives & @prime_objectives) == @prime_objectives
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Failed?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def failed?
# Check if any prime objectives have been failed
return (@failed_objectives & @prime_objectives) != []
end
end
end

#==============================================================================
# ** Game_Party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new instance variable - quests
# aliased method - initialize
#==============================================================================

class Game_Party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :quests
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_qst_jrnl_party_init_quests initialize
def initialize
# Run Original Method
modalg_qst_jrnl_party_init_quests
# Initialize @quests
@quests = Game_Quests.new
end
end

#==============================================================================
# ** Game_Quests
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This class handles Quests. It is a wrapper for the built-in class "Hash".
# The instance of this class is accessed by $game_party.quests
#==============================================================================

class Game_Quests
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize
@data = {}
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Quest
# quest_id : the ID of the quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def [] (quest_id)
@data[quest_id] = ModAlg_QuestData::Quest.new (quest_id) if @data[quest_id] == nil
return @data[quest_id]
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Quest List
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def list
quest_list = @data.values
quest_list.each { |i| quest_list.delete (i) if i.concealed }
return quest_list
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Completed Quest List
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def completed_list
complete_quests = []
list.each { |i| complete_quests.push (i) if i.complete? }
return complete_quests
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Failed Quest List
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def failed_list
failed_quests = []
list.each { |i| failed_quests.push (i) if i.failed? }
return failed_quests
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Active Quest List
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def active_list
return list - failed_list - completed_list
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Revealed?
# quest_id : the ID of a checked quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def revealed? (quest_id)
return @data[quest_id] != nil
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Remove Quest
# quest_id : the ID of a checked quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def remove (quest_id)
@data.delete (quest_id)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Clear
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def clear
@data.clear
end
end

#==============================================================================
# ** Window_QuestCategory
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This window displays which category that is being viewed
#==============================================================================

class Window_QuestCategory < Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize(x, y, width)
super (x, y, width, WLH + 32)
# create_contents
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
# category_index : icon to highlight -
# 0 => All, 1 => Active, 2 => Complete, 3 => Failed
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def refresh (category_index = 0)
self.contents.clear
# Retrieve Icon Bitmaps
bitmap = Cache.system("Iconset")

# theese 2 lines below show the icon of active quests
icon_index = ModAlg_QuestData::ACTIVE_QUEST_ICON
active_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
icon_index = ModAlg_QuestData::COMPLETE_QUEST_ICON
complete_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
icon_index = ModAlg_QuestData::FAILED_QUEST_ICON
failed_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)

# Draw the 'Active' Icon onto the window
if category_index == 0
self.contents.blt (x, 0, bitmap, active_rect, category_index == 0 ? 255 : 75)
# below, check if cursor on active(category_index == 0 ?). If yes->opactiy = 128
self.contents.font.color = text_color (ModAlg_QuestData::ACTIVE_COLOUR)
self.contents.draw_text (24, 0, self.contents.width, WLH, 'Current')
elsif category_index == 1
# Draw the 'Complete' Icon onto the window
self.contents.blt (x, 0, bitmap, complete_rect, category_index == 1 ? 255 : 75)
self.contents.font.color = text_color (ModAlg_QuestData::COMPLETE_COLOUR)
self.contents.draw_text (x + 24, 0, self.contents.width, WLH, 'Complete')
# Draw the 'Failed' Icon onto the window
elsif category_index == 2
self.contents.blt (x, 0, bitmap, failed_rect, category_index == 2 ? 255 : 75)
self.contents.font.color = text_color (ModAlg_QuestData::FAILED_COLOUR)
self.contents.draw_text (x + 24, 0, self.contents.width, WLH, 'Failed')
end
end
end

#==============================================================================
# ** Window_QuestList
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This window displays the list of quests
#==============================================================================

class Window_QuestList < Window_Selectable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize (x, y, width, category_index = 0, index = 0)
super (x, y, width, 56)
@data = []
@column_max = 1
refresh (category_index)
self.index = index
self.active = true
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def quest
return @data[self.index]
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
# category_index : List to show -
# 0 => All, 1 => Active, 2 => Complete, 3 => Failed
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def refresh (category_index = 0)
@data.clear
self.index = 0
# Get the quest list to be drawn
case category_index
when 0
@data = $game_party.quests.active_list
self.height = [[Graphics.height - 288, @data.size*24+32].min, 56].max # added

@item_max = @data.size # maybe this has stoped scroll
unless contents == nil
# Clear Contents
contents.clear
return if @data.empty?
contents.dispose
end
# Create Contents
self.contents = Bitmap.new (width - 32, WLH*@data.size)
for i in 0...@data.size
quest = @data[i]
draw_icon (quest.icon_index, 0, i*WLH)
# Draw the name of the quest
self.contents.font.color = text_color (ModAlg_QuestData::ACTIVE_COLOUR)
self.contents.draw_text (24, i*WLH, contents.width - 24, WLH, quest.name)
end

when 1
@data = $game_party.quests.completed_list
# added 'self.contents.'
self.height = [[Graphics.height - 288, @data.size*24+32].min, 56].max # added

@item_max = @data.size # maybe this has stoped scroll
unless contents == nil
# Clear Contents
contents.clear
return if @data.empty?
contents.dispose
end
# Create Contents
self.contents = Bitmap.new (width - 32, WLH*@data.size)
for i in 0...@data.size
quest = @data[i]
draw_icon (quest.icon_index, 0, i*WLH)
# Draw the name of the quest
self.contents.font.color = text_color (ModAlg_QuestData::COMPLETE_COLOUR)
self.contents.draw_text (24, i*WLH, contents.width - 24, WLH, quest.name)
end

when 2
@data = $game_party.quests.failed_list
# added 'self.contents.'
self.height = [[Graphics.height - 288, @data.size*24+32].min, 56].max # added

@item_max = @data.size # maybe this has stoped scroll
unless contents == nil
# Clear Contents
contents.clear
return if @data.empty?
contents.dispose
end
# Create Contents
self.contents = Bitmap.new (width - 32, WLH*@data.size)
for i in 0...@data.size
quest = @data[i]
draw_icon (quest.icon_index, 0, i*WLH)
# Draw the name of the quest
self.contents.font.color = text_color (ModAlg_QuestData::FAILED_COLOUR)
self.contents.draw_text (24, i*WLH, contents.width - 24, WLH, quest.name)
end

end
end
end

#==============================================================================
# ** Window_QuestInfo
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This window displays the information on the quest being viewed
#==============================================================================

class Window_QuestInfo < Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize(x, y, width, height)
super (x, y, width, height)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def refresh (quest = nil)
self.contents.clear # added 'self.' for all
return if quest == nil

#ADDED to show picture with quest
# below in Rect.new you can change the rectangle dimensiond of picture
self.contents.blt(0, WLH, Cache.quests(quest.name), Rect.new(0, 0, self.width, 6 * WLH))
# ex-bitmap
#ADDED to show picture with quest
self.contents.font.color = normal_color
self.contents.draw_text (0, 0, width, WLH, quest.name, 1)
self.contents.draw_text (0, 6 * WLH + WLH, self.width, WLH, quest.description)

self.contents.font.color = system_color
self.contents.draw_text (0, 6 * WLH + WLH * 3, self.width, WLH, 'Tasks')

row = 0 # var needed to properly arrange objectives(initialized)
quest.revealed_objectives.each { |i|
self.contents.font.color = quest.complete_objectives.include? (i) ?
text_color (ModAlg_QuestData::COMPLETE_COLOUR) : quest.failed_objectives.include? (i) ?
text_color (ModAlg_QuestData::FAILED_COLOUR) : text_color (ModAlg_QuestData::ACTIVE_COLOUR)
objective = quest.objectives[i]

# condition needed to properly calculate objective row
if i == 0 # if first objective reveald
row = 0 # put in row 0
else
row += i/i # increase row(initial 0) by 1
end
self.contents.draw_text (WLH, 6 * WLH + (WLH * 4) + (row * WLH) + 8, self.width, WLH, objective)
self.contents.draw_text (0, 6 * WLH + (WLH * 4) + (row * WLH) + 8, self.width, WLH, ModAlg_QuestData::BULLET_CHARACTER)
}
end
end

#==============================================================================
# ** Scene_Quest
#------------------------------------------------------------------------------
# This class performs the quest screen processing.
#==============================================================================

class Scene_Quest < Scene_Base
#--------------------------------------------------------------------------
# new method: create_command_list
#--------------------------------------------------------------------------
def create_command_list
vocab = []
commands = []
icons = []
index_list = {}
YEZ::MENU::MENU_COMMANDS.each_with_index { |c,i|
case c
when :items
index_list[:items] = commands.size
vocab.push(Vocab.item)

when :skill # Skills
index_list[:skill] = commands.size
vocab.push(Vocab.skill)

when :equip # Equip
index_list[:equip] = commands.size
vocab.push(Vocab.equip)

when :status # Status
index_list[:status] = commands.size
vocab.push(Vocab.status)

when :quest # Save
index_list[:save] = commands.size
vocab.push('Quests')

when :system # System
index_list[:system] = commands.size
vocab.push(Vocab.game_end)

end

commands.push©
icons.push(menu_icon©)
} # YEZ::MENU::MENU_COMMANDS.each_with_index
@menu_array = [vocab, commands, icons]
end

#--------------------------------------------------------------------------
# new method: menu_icon
#--------------------------------------------------------------------------
def menu_icon(command)
if YEZ::MENU::MENU_ICONS.include?(command)
return YEZ::MENU::MENU_ICONS[command]
else
return YEZ::MENU::MENU_ICONS[:unused]
end
end

#--------------------------------------------------------------------------
# overwrite method: create_command_window
#--------------------------------------------------------------------------
def create_command_window
create_command_list
@command_window = Window_MenuCommand.new(@menu_array)
@command_window.height = [@command_window.height,
YEZ::MENU::MAX_ROWS * 24 + 32].min
@command_window.index = 4
end

#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(category_index = 0, quest_index = 0)
@category_index = category_index
@quest_index = quest_index
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
# Create Windows
# @label_window = Window_QuestLabel.new
# ADDED
create_command_window
@gold_window = Window_Gold.new(0, @command_window.height) # added
# ADDED
@category_window = Window_QuestCategory.new(0, @command_window.height + @gold_window.height, @command_window.width)
@category_window.refresh (@category_index)
@list_window = Window_QuestList.new (0, @command_window.height + @gold_window.height + 56, @command_window.width, @category_index, @quest_index)
@info_window = Window_QuestInfo.new(@command_window.width, 56, Graphics.width - @command_window.width, Graphics.height - 56)
@info_window.refresh (@list_window.quest)
@help_window = Window_Help.new(@command_window.width, @info_window.width)
@help_window.y = 0
@help_window.set_text ('LEFT/RIGHT: switch category', 1)

@category_window.openness = 0
@list_window.openness = 0
@info_window.openness = 0
@help_window.openness = 0
end
#--------------------------------------------------------------------------
# * Pre-termination Processing
#--------------------------------------------------------------------------
def pre_terminate
super
@category_window.close
@list_window.close
@info_window.close
@help_window.close
begin
@category_window.update
@list_window.update
@info_window.update
@help_window.update
Graphics.update
end until (@category_window.openness == 0) && (@list_window.openness == 0) && (@info_window.openness == 0) && (@help_window.openness == 0)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
# @label_window.dispose
@category_window.dispose
@list_window.dispose
@info_window.dispose
@help_window.dispose
@gold_window.dispose
@command_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@category_window.open
@list_window.open
@info_window.open
@help_window.open

@category_window.update
@list_window.update
@info_window.update
@help_window.update

if Input.trigger?(Input::cool.gif # If Button B is pressed
Sound.play_cancel
$scene = Scene_Menu.new(4) # changed
elsif Input.trigger?(HOTKEYS::Menu) # If Button M is pressed
Sound.play_cancel
$game_temp.next_scene = Scene_Map.new # I don't know why I added this, but
# it seems that the part animations won't reappear without it, on scene exit.
$scene = Scene_Map.new
elsif Input.trigger? (Input::C) # If C(enter/space) button is pressed
# Open Journal (eventually)
elsif Input.trigger? (Input::LEFT) # If Left direction pressed
# Play Cursor SE
Sound.play_cursor
# Refresh Category Window
@category_index = (@category_index - 1) % 3
$scene = Scene_Quest.new(@category_index) # added to dinamicly open/close
elsif Input.trigger? (Input::RIGHT) # If C pressed
# Play Cursor SE
Sound.play_cursor
# Refresh Category Window
@category_index = (@category_index + 1) % 3
$scene = Scene_Quest.new(@category_index) # added to dinamicly open/close
# If scrolling through quests
elsif Input.trigger? (Input::DOWN) || Input.trigger? (Input::UP)
# Refresh Info Window
@info_window.refresh (@list_window.quest)
end
end
end




Is their away to add this to syvkal's ring menu script?


__________________________
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 26th May 2013 - 01:01 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker