#=======================================
# ** Scene_Quests
# ** Created by coolmariners98 (Atoria)
#------------------------------------------------------------------------------
# Please do not copy and distribute claiming to have created this.
# I would like full credit, even though this script is kind of crappy.
#=======================================
class Scene_Quests
# * Object Initialization
def initialize(quest_index = 0)
@quest_index = quest_index
end
def main
@command_window = Window_Qmand.new(160, $quest.questname) # actually makes window
@command_window.index = @quest_index
# while loop determines what to show
tmp = 1
tmp2 = 10
tmp3 = 0
$quest.totalfound = 0
$quest.moneyearned = 0
$quest.expearned = 0
$quest.rpearned = 0
while (tmp3 < $quest.totalquests)
if $quest.showdisabledquests == true and $quest.qupdate[tmp] == false
@command_window.disable_item(tmp3)
else
$quest.totalfound += 1
end
if $quest.handin[tmp3] == true
@command_window.finished(tmp3)
$quest.moneyearned += $quest.goldreward[tmp3]
$quest.expearned += $quest.expreward[tmp3]
$quest.rpearned += $quest.rpreward[tmp3]
$quest.totalcompleted += 1
end
tmp += 10
tmp2 += 10
tmp3 +=1
end
# Make quest status window
@qs_window = Quest_Status.new
@qs_window.x = 0
@qs_window.y = 300
# Make quest info window
@qi_window = Quest_Info.new
@qi_window.x = 160
@qi_window.y = 0
# Make quest window
@status_window = Quest.new
@status_window.x = 160
@status_window.y = 180
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
Graphics.freeze
# Dispose of windows
@command_window.dispose
@status_window.dispose
@qs_window.dispose
@qi_window.dispose
end
def update
@command_window.update
@status_window.update
if @command_window.active
update_command
return
end
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
Sound.play_cancel
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
index = @command_window.index
#pattern on switch is index * 10 + 1
if $quest.qupdate[index * 10 + 1] == false
Sound.play_buzzer
return
else
$quest.whichquest = index
Sound.play_decision
@status_window.dispose
@status_window = Quest.new
@status_window.x = 160
@status_window.y = 180
@status_window.update
end
return
end
end
end
#=======================================
# ** Quest_Status
# ** Created by coolmariners98
#------------------------------------------------------------------------------
# This displays what has been done so far in your quests (upper middle window)
#=======================================
class Quest_Status < Window_Base
def initialize
super(0, 0, 160, 117)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, -10, 150, 32, "Total Quests: " + $quest.totalfound.to_s)
self.contents.font.color = system_color
self.contents.draw_text(0, 8, 150, 32, "Total Complete: " + $quest.totalcompleted.to_s)
self.contents.font.color = normal_color
self.contents.draw_text(0, 26, 150, 32, "Money: " + $quest.moneyearned.to_s)
self.contents.font.color = system_color
self.contents.draw_text(0, 44, 150, 32, "Exp: " + $quest.expearned.to_s)
self.contents.font.color = normal_color
self.contents.draw_text(0, 62, 150, 32, "RP: " + $quest.rpearned.to_s)
end
end
#=======================================
# ** Quest_Info
# ** Created by coolmariners98
#------------------------------------------------------------------------------
# This displays all the quest information in the upper right window
#=======================================
class Quest_Info < Window_Base
def initialize
super(0, 0, 385, 180)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = text_color(14)
self.contents.draw_text(0, -10, 380, 32, "Quest Information")
self.contents.font.color = normal_color
if $quest.totalfound != 0
self.contents.draw_wrap_text(0, 20, 350, 16, $quest.preinfo[$quest.whichquest])
end
end
end
#=======================================
# ** Quest
# ** Created by coolmariners98
#------------------------------------------------------------------------------
# This displays all the quest information in the bottom right window
#=======================================
class Quest < Window_Selectable
def initialize
super(0, 0, 385, 237)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
def refresh
self.contents.clear
if $quest.totalfound != 0
bitmap = Cache.character($quest.charspriteN[$quest.whichquest])
sign = $quest.charspriteN[$quest.whichquest][/^[\!\$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = $quest.charspriteI[$quest.whichquest]
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
self.contents.blt(19 - cw / 2, 57 - ch, bitmap, src_rect)
if $quest.qupdate[(($quest.whichquest * 10) + 10)]
bitmap2 = Cache.picture("complete.png")
src_rect2 = Rect.new(0, 0, bitmap2.width, bitmap2.height)
self.contents.blt(300, 10, bitmap2, src_rect2)
end
self.contents.font.color = system_color
self.contents.draw_text(50, 0, 385, 45, "Name: " + $quest.charname[$quest.whichquest])
self.contents.font.color = normal_color
self.contents.draw_text(50, 0, 385, 80, "Location: " + $quest.location[$quest.whichquest])
self.contents.font.color = system_color
self.contents.draw_text(50, 0, 385, 115, "Reward: " + $quest.textreward[$quest.whichquest])
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 435, 175, "Quest Objectives:")
temp = $quest.whichquest
script = (temp * 8)
easy = 0
switch = 2
switch2 = (temp * 10) + 2
while (switch < 10)
if $quest.objs[script] == " "
$quest.qupdate[switch2] = true
end
if $quest.qupdate[switch2]
self.contents.font.color = text_color(7)
self.contents.draw_text(0, 0, 435, 210 + (easy * 35), $quest.objs[script])
else
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 435, 210 + (easy * 35), $quest.objs[script])
end
easy += 1
script += 1
switch += 1
switch2 += 1
end
end
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
end
#=======================================
# ** Window_Qmand
# ** Created by coolmariners98
#------------------------------------------------------------------------------
# This displays all the quest information in the bottom right window
#=======================================
class Window_Qmand < Window_Selectable
def initialize(width, commands)
super(0, 0, width, 300)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
self.index = 0
end
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color, true)
end
end
def draw_item(index, color, enabled = true)
self.contents.font.color = color
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(rect, @commands[index])
end
def disable_item(index)
draw_item(index, text_color(7), true)
end
def delete_item(index)
rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
end
def finished(index)
draw_item(index, text_color(3), true)
end
end
#==============================================================================
#==============================================================================
#==============================================================================
# ** DON'T TOUCH BELOW HERE UNLESS YOU KNOW WHAT YOU'RE DOING
#==============================================================================
#==============================================================================
#==============================================================================
#==============================================================================
# ** Event Text Display
#==============================================================================
# Created By: Áص¹
# Modified By: SephirothSpawn
# Modified By: Me™
# Modified By: Atoria
# Version 2.1
# 2006-03-04
#==============================================================================
# * Instructions :
#
# ~ Creating Event With Text Display
# - Put a Comment on the Page With
# [CD____]
# - Place Text to Be Displayed in the Blank
#------------------------------------------------------------------------------
# * Customization :
#
# ~ NPC Event Colors
# - Event_Color = Color
#
# ~ Player Event Color
# - Player_Color = Color
#
# ~ Player Text
# - Player_Text = text_display *
#
# ~ text_display
# - 'Name', 'Class', 'Level', 'Hp', 'Sp'
#==============================================================================
#==============================================================================
# ** Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Dispaly Text Color (Event & Player)
#--------------------------------------------------------------------------
Event_Color = Color.new(0, 0, 200)
Player_Color = Color.new(200, 0, 0)
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :text_display
attr_accessor :isQuest
attr_accessor :foundQuest
attr_accessor :doneQuest
attr_accessor :bounce
attr_accessor :bounceFlip
end
#==============================================================================
# ** Game_Event
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_characterdisplay_gevent_refresh refresh
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Original Refresh Method
seph_characterdisplay_gevent_refresh
# Checks to see if display text
# If the name contains CD, it takes the rest of the name as the text
@bounce = 0
@bounceFlip = false
unless @list.nil?
for i in 0...@list.size # for all the commands in event
if @list.code == 108 # if it is a comment
@list.parameters[0].dup.gsub!(/\[[Cc][Dd](.+?)\]/) do
@text_display = [$1, Event_Color]
@isQuest = false
end
@list.parameters[0].dup.gsub!(/\[[Qq][Dd](.+?)\]/) do
@text_display = [$1, Event_Color]
@isQuest = true
end
end
end
end
@text_display = nil if @erased
end
end
#==============================================================================
# ** Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_characterdisplay_gplayer_refresh refresh
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Original Refresh Method
seph_characterdisplay_gplayer_refresh
# Creates Text Display
@text_display = ["Hero", Player_Color]
end
end
#==============================================================================
# ** Sprite_Character
#==============================================================================
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_characterdisplay_scharacter_update update
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Original update Method
seph_characterdisplay_scharacter_update
# Character Display Update Method
update_display_text
unless @character.bounce.nil?
if @character.bounce < -2
@character.bounceFlip = true
end
if @character.bounce > 2
@character.bounceFlip = false
end
if @character.bounceFlip
@character.bounce = @character.bounce + 0.2
else
@character.bounce = @character.bounce - 0.2
end
end
end
#--------------------------------------------------------------------------
# * Create Display Sprite
#--------------------------------------------------------------------------
def create_display_sprite(args)
Font.default_size = 12
Font.default_name = "Verdana"
# Creates Display Bitmap
bitmap = Bitmap.new(160, 24)
bitmap2 = Bitmap.new(160, 24)
# Changes Font Color
bitmap.font.color = args[1]
# Draws Text
if @character.isQuest
bitmap2 = Cache.picture("quest.png")
@_quest_display = Sprite.new(self.viewport)
@_quest_display.bitmap = bitmap2
@_quest_display.ox = 8
@_quest_display.oy = 40
@_quest_display.x = self.x
@_quest_display.y = self.y - self.oy / 2 - 24
@_quest_display.z = 30001
@_quest_display.visible = self.visible #true
end
bitmap.draw_text(0, 0, 160, 24, args[0], 1)
# Creates Display Text Sprite
@_text_display = Sprite.new(self.viewport)
@_text_display.bitmap = bitmap
@_text_display.ox = 80
@_text_display.oy = 12
@_text_display.x = self.x
@_text_display.y = self.y - self.oy / 2 - 24
@_text_display.z = 30001
@_text_display.visible = self.visible #true
end
#--------------------------------------------------------------------------
# * Dispose Display Sprite
#--------------------------------------------------------------------------
def dispose_display_text
unless @_text_display.nil?
@_text_display.dispose
end
#reset font colors
Font.default_size = 14
Font.default_name = "Verdana"
end
#--------------------------------------------------------------------------
# * Dispose Quest Sprite
#--------------------------------------------------------------------------
def dispose_quest_text
unless @_quest_display.nil?
@_quest_display.dispose
end
#reset font colors
Font.default_size = 14
Font.default_name = "Verdana"
end
#--------------------------------------------------------------------------
# * Update Display Sprite
#--------------------------------------------------------------------------
def update_display_text
unless @character.text_display.nil?
if @_text_display.nil?
create_display_sprite(@character.text_display)
end
switch = ($quest.whichquest * 10) + 2
if $quest.qupdate[switch]
if $quest.qupdate[switch + 1]
if $quest.qupdate[switch + 2]
if $quest.qupdate[switch + 3]
if $quest.qupdate[switch + 4]
if $quest.qupdate[switch + 5]
if $quest.qupdate[switch + 6]
if $quest.qupdate[switch + 7]
$quest.qupdate[switch + 8] = true
end
end
end
end
end
end
end
end
@_text_display.x = self.x
@_text_display.y = self.y - self.oy / 2 - 24
if @character.isQuest
@_quest_display.x = self.x
@_quest_display.y = self.y - self.oy / 2 - 24 + @character.bounce
end
else
unless @_text_display.nil?
dispose_display_text
end
unless @_quest_display.nil?
dispose_quest_text
end
end
#reset font colors
Font.default_size = 14
Font.default_name = "Verdana"
end
end
#C[RRBBGG] Changes the Color (RR,BB,GG)
#C[N] Changes to color back to normal
#I[] Changes the font to Italics
#B[] Changes the font to Bold
#T[] A Tab
#N[] New Line
#==============================================================================
# ** Bitmap
#------------------------------------------------------------------------------
# Additions add a draw wrap text method which draws word wrapped text
# Text Automattically goes to the next line if the text can not fit on the line
#==============================================================================
class Bitmap
def draw_wrap_text(x,y,width, height, text)
array = text.split
for i in array
word = i + ' '
word_width = text_size(word).width
if x + word_width > width
y += height
x = 0
end
self.draw_text(x, y, 350, height, word)
x += word_width
end
end
end