class Bitmap
# Draws an outline around the text,
# both the outline color and the color of the
# text inside can be anything.
def draw_text_outline_custom(x, y, wid, hei, text, align, outlinecolor, insidecolor)
if $qdata.useoutlines == true
self.font.color = outlinecolor
draw_text(x + 1,y + 1,wid,hei,text, align)
draw_text(x + 1,y - 1,wid,hei,text, align)
draw_text(x - 1,y - 1,wid,hei,text, align)
draw_text(x - 1,y + 1,wid,hei,text, align)
end
self.font.color = insidecolor
draw_text(x,y,wid,hei,text, align)
end
end
class Scene_Quests
attr_accessor :questids
attr_accessor :command_window
attr_accessor :questswitches
# QSETUP This is the initialize method.
# It's where you set up which list will load:
def initialize(list = 1)
@quest_index = 0
@currentlist = list
# Right here. The format is:
# when A
# $qdata = B.new
# @questswitches = $game_temp.C
#
# A is the number called in $scene = Scene_Quests.new(Number)
# B is the class name for the list.
# C is the variable name for the quest list. Don't put the @ part with it here.
case list
when 1
$qdata = Quest_Data.new
@questswitches = $game_temp.qupdate
when 2
$qdata = Quest_Data2.new
@questswitches = $game_temp.qupdate2
end
end
def main
# Displays the map as background:
@backpic = Spriteset_Map.new
# Creates the quest list based on how many quests are active on that list:
questwin = []
@questids = []
# QSETUP This is one of the for branches that will need changing once your game is complete.
# More about that later.
for i in 1...10000
if @questswitches[i][0] == true
questwin.push($qdata.questname[i])
@questids.push(i)
end
end
if questwin.size == 0
questwin.push($qdata.questname[0])
@questids.push(0)
end
@command_window = Window_Qmand.new(182, questwin)
@command_window.index = @quest_index
@command_window.opacity = 200
@command_window.z = 1100
@command_window.opacity = 200
# This creates the title window
@top_window = Window_top.new
@top_window.x = 0
@top_window.y = 0
@top_window.opacity = 200
# This makes the window for the description text and objectives:
@status_window = Quest.new
@status_window.x = 184
@status_window.y = 64
@status_window.z = 1100
@status_window.opacity = 200
Graphics.transition
loop do
Graphics.update
Input.update
update_command
if $scene != self
break
end
end
Graphics.freeze
@command_window.contents.clear
@command_window.dispose
@top_window.contents.clear
@top_window.dispose
@status_window.contents.clear
@status_window.dispose
end
end
#-------------------------------------------------------------------------------
# Updates the quest data, and switches between lists:
#-------------------------------------------------------------------------------
def update_command
if Input.repeat?(Input::UP)
if @command_window.index == 0
@command_window.index = @questids.size - 1
else
@command_window.index -= 1
end
unless @questids.size == 1
$game_system.se_play($data_system.cursor_se) unless @questids.size == 1
@status_window.refresh
end
end
if Input.repeat?(Input::DOWN)
if @command_window.index == @questids.size - 1
@command_window.index = 0
else
@command_window.index += 1
end
unless @questids.size == 1
$game_system.se_play($data_system.cursor_se)
@status_window.refresh
end
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(5)
return
end
# QSETUP This is where you set up how it switches between lists.
# If you want to have say, 2 parties, each with different lists,
# this is where you would set up how it switches between lists.
# The format is simple:
# when listnumber
# $scene = Scene_Quests.new(list number to switch to)
#
# So if lists 1/2 are for the first party, and you want lists 3/4 to be for the second party,
# You'd just set up list 3 to switch to list 4 and list 4 to switch to list 3.
if Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
case @currentlist
when 1
$scene = Scene_Quests.new(2)
when 2
$scene = Scene_Quests.new(1)
end
end
if Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
case @currentlist
when 1
$scene = Scene_Quests.new(2)
when 2
$scene = Scene_Quests.new(1)
end
end
end
#-------------------------------------------------------------------------------
# This creates the description text and the objectives
# for the the quests in progress. Objectives change colors
# and have an icon next to them.
#-------------------------------------------------------------------------------
class Quest < Window_Base
def initialize
super(0, 0, 456, 416)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
y = 0
for i in 0...$qdata.description[$scene.questids[$scene.command_window.index]].size
self.contents.draw_text_outline_custom(2, 24 * y, 480, 32, $qdata.description[$scene.questids[$scene.command_window.index]][i],0, $qdata.descoutline, $qdata.desctext)
y += 1
end
for i in 0...$qdata.objectives[$scene.questids[$scene.command_window.index]].size
y += 1
if $scene.questswitches[$scene.questids[$scene.command_window.index]][i + 1] == true
bitmap = RPG::Cache.icon("CompletedIcon")
self.contents.blt(0, 4 + ( y * 24) , bitmap, Rect.new(0, 0, 18, 18))
self.contents.draw_text_outline_custom(24, 0 + (y * 24), 456, 24, $qdata.objectives[$scene.questids[$scene.command_window.index]][i], 0, $qdata.compoutline, $qdata.comptext)
else
bitmap = RPG::Cache.icon("InProgressIcon")
self.contents.blt(0, 4 + ( y * 24) , bitmap, Rect.new(0, 0, 18, 18))
self.contents.draw_text_outline_custom(24, 0 + (y * 24), 456, 24, $qdata.objectives[$scene.questids[$scene.command_window.index]][i], 0, $qdata.incompoutline, $qdata.incomptext)
end
end
end
end
#-------------------------------------------------------------------------------
# This is for the list of quests on the left:
#-------------------------------------------------------------------------------
class Window_Qmand < Window_Selectable
def initialize(width, commands)
super(0, 64, width, 416)
self.contents = Bitmap.new(width - 32, commands.size * 32)
@commands = commands
@item_max = @commands.size
self.index = 0
refresh
end
def refresh
self.contents.clear
for i in 0...@commands.size
self.contents.draw_text_outline_custom(0, 32 * i, self.contents.width, 32,@commands[i],1, $qdata.menuoutline, $qdata.menutext)
end
end
end
#-------------------- working-------------------------------
class Window_top < Window_Selectable
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(640 - 32, 64 - 32)
refresh
end
def refresh
self.contents.clear
self.cursor_rect.set(0 + 288 * 1, 0, 288, 32)
self.contents.draw_text(0, 0, 288, 32, "Main Quests in Progress", 1)
self.contents.draw_text(288, 0, 288, 32, "Side Quests in Progress", 1)
end
end
# (self.width-32, self.height-32)
# @title_window.contents = Bitmap.new(640 - 32 , 64 - 32)
# @title_window.contents.draw_text(0, 0, 288, 32, "Main Quests in Progress", 1)
# @title_window.contents.draw_text(288, 0, 288, 32, "Side Quests in Progress", 1)
class Game_Temp
# QSETUP This is where you add the variables that control the quests on the lists.
attr_accessor :qupdate
attr_accessor :qupdate2
# You'll need one of these for every list. The script is setup by default to
# use qupdate for the first list and qupdate2 for the second.
#You can change these if you want.
alias asdfghjkl initialize
def initialize
asdfghjkl
# You'll need to add any new quest variables here, like this:
@qupdate = []
@qupdate2 = []
for i in 0...10000
# And here, too, like this:
@qupdate[i] = []
@qupdate2[i] = []
end
# That 10000 there is the maximum number of quests per list.
# Once your game is completely finished, count the number of quests on each list.
# There'll be a for loop like this in each of the quest lists.
# Replace the 10000 there with the number of quests on the list.
# This will lower the amount of time it takes to read the list.
# Do the same to the 10000 both here and in the main method up at the top,
# with the highest number of quests your lists have.
end
end
class Scene_Save < Scene_File
alias qwertyuiop write_save_data
def write_save_data(file)
qwertyuiop(file)
# QSETUP You'll need to add any new quest variables here, too, like this:
Marshal.dump($game_temp.qupdate, file)
Marshal.dump($game_temp.qupdate2, file)
end
end
class Scene_Load < Scene_File
alias zxcvbnm read_save_data
def read_save_data(file)
zxcvbnm(file)
# QSETUP Also need to add any new quest variable here, like this:
$game_temp.qupdate = Marshal.load(file)
$game_temp.qupdate2 = Marshal.load(file)
end
end