Quantcast
Channel: RGSS3 Scripts (RMVX Ace) Latest Topics
Viewing all articles
Browse latest Browse all 416

Quest Script

$
0
0

Hi there. This is a pretty old script, but here it is nonetheless. I'm not the best programmer, so there may be compatibility issues with other scripts, but if you wanna give it a try here it is :) - Heres an old vid of it:

Code:

Spoiler

#-============================================================================-#
#    ProQuest Version 3
#    
#    Now with EasyUpdate! No more need to update and completely redo quests.  
#-============================================================================-#

#-=HOW TO USE!-=+=============================================================-#
=begin  
        
        Set quest name: (id = quest id number)
        $game_quests.setname(id, name)
        
        Set quest short name:
        $game_quests.setshortname(id, name)
        
        Set quest description:
        $game_quests.setdesc(id, desc)
        can be 3 lines long.
        
        Set quest sender:
        $game_quests.setsender(id, name)
        
        Set quest EXP:
        $game_quests.setexp(id, amount)
        
        Set quest Gold:
        $game_quests.setgold(id, amount)
        
        Set quest Item:
        $game_quests.setitem(id, name)
        
        Set quest location
        $game_quests.setlocation(id, location)
        
        Set quest Face
        $game_quests.setface(id, face_name, face_index)
        
        Set quest expired
        $game_quests.setexpired(id, on)
        
        Set quest level:
        $game_quests.set_level(id, min_level, max_level)
        
        set quest type:
        $game_quests.set_type(id, type, type_icon)
        
        Set goals: (Use 0 if disabled) up to 6 goals.
        $game_quests.set_goals(id, g1, g2, g3, g4, g5, g6)
        
        Set goal Min:
        $game_quests.set_goals_min(id, g1, g2, g3, g4, g5, g6)
        
        Set goal Max:
        $game_quests.set_goals_max(id, g1, g2, g3, g4, g5, g6)
        
        Check if quest is complete, and if so, complete it.
        $game_quests.do_complete(id)
        
        Set points earned for completing quest
        $game_quests.set_quest_points(id, val)
        
        Add Goal progress:
        $game_quests.add_goal_progress(id, value_to_add)
        $game_quests.add_goalx_progress(id, value_to_add) 
        ^ replace x with 2 through 6.
        
        Subtract Goal progress:
        $game_quests.subtract_goal_progress(id, value_to_subtract)
        $game_quests.subtract_goalx_progress(id, value_to_subtract) 
        ^ replace x with 2 through 6.
        

        
=end

        
        

#-[Config-#===================================================================-#
Use_Windowskin=true

Map_window_X=0
Map_window_Y=0

Gold_Icon=361
EXP_Icon=121
Item_Icon=192

No_Quest_Found_MSG = "Quest Not Available"

$quest_size=0

$font_size=Font.default_size

Window_Color_r=55
Window_Color_g=25
Window_Color_b=15

QP_Name="QP"

$error_msg = "-not found-"

$exp_name="EXP"
$gold_name="G"

Complete_ME="Audio/me/Fanfare1"
Complete_ME_Volume = 100
Complete_ME_Pitch=0



#-============================================================================-#


#-[Make Quest Information]-#==================================================-#


class Game_Quests
  def initialize
    @name= []
    @desc= []
    @sender= []
    @exp = []
    @gold = []
    @item = []
    @location = []
    @face = []
    @face_id = []
    @expired = []
    @min_level = []
    @max_level = []
    @type = []
    @type_icon = []
    @goal = []
    @goal2 = []
    @goal3 = []
    @goal4 = []
    @goal5 = []
    @goal6 = []
    @short_name= []
    @quest_complete = []
    
    @quest_accepted = []
    
    @goal_progress= []
    @goal2_progress= []
    @goal3_progress= []
    @goal4_progress= []
    @goal5_progress= []
    @goal6_progress= []
    
    @goal_min = []
    @goal2_min = []
    @goal3_min = []
    @goal4_min = []
    @goal5_min = []
    @goal6_min = []
    
    @goal_max = []
    @goal2_max = []
    @goal3_max = []
    @goal4_max = []
    @goal5_max = []
    @goal6_max = []
    
    @quest_size = 0
    
    @quest_rating= []
    
    @number_complete=0
    @qp=0
    
    @quests_enabled=0
    
    $index=0
    
    $quest_id=0
    $mode=0
    $selected_quest=0
    $show_quest=0
  end
  
  def get_completed_quests
    return @number_complete
  end
  
  def quests_enabled
    if @quests_enabled==0
      return false
    else
      return true
    end
  end
  
  def quest_size
    return @quest_size-1
  end
  
  def enable_quests
    @quests_enabled=1
  end
  
  
  def set_quest_points(id, val)
    @quest_rating[id]=val
  end
  
  def get_poitns(id)
    return @quest_rating[id]
  end
  
  def accept(id)
    return @quest_accepted[id]
  end
  
  def do_accept(id)
    @quest_accepted[id] = true
    enable_quests
  end
  
  def do_un_accept(id)
    @quest_accepted[id] = false
  end
  
  def check_complete(id)
    if @goal_min[id]==@goal_max[id] && @goal2_min[id]==@goal2_max[id] && @goal3_min[id]==@goal3_max[id] && @goal4_min[id]==@goal4_max[id] && @goal5_min[id]==@goal5_max[id] && @goal6_min[id]==@goal6_max[id]
      return true
    else
      return false
    end
  end
  
  def do_complete(id)
    if check_complete(id) && @quest_complete[id] != true
      @number_complete+=1
      @qp+=@quest_rating[id]
      @quest_complete[id]=true
    end
  end
  
  def name(id)
    return @name[id]
  end
  
  def short_name(id)
    return @short_name[id]
  end
  
  def desc(id)
    return @desc[id]
  end
  
  def sender(id)
    return @sender[id]
  end
  
  def exp(id)
    return @exp[id]
  end
  
  def gold(id)
    return @gold[id]
  end
  
  def item(id)
    return @item[id]
  end
  
  def location(id)
    return @location[id]
  end
  
  def face(id)
    return @face[id]
  end
  
  def face_id(id)
    return @face_id[id]
  end
  
  def expired(id)
    return @expired[id]
  end
  
  def min_level(id)
    return @min_level[id]
  end
  
  def max_level(id)
    return @max_level[id]
  end
  
  def type(id)
    return @type[id]
  end
  
  def type_icon(id)
    return @type_icon[id]
  end
  
  def setname(id, str)
    @name[id]=str
    @quest_size=id+1 if @quest_size<=id #Tell how many quests there are.
  end
  
  def setshortname(id, str)
    @short_name[id]=str
  end
  
  def setdesc(id, str)
    @desc[id]=str
  end
  
  def setsender(id, str)
    @sender[id]=str
  end
  
  def setexp(id, str)
    @exp[id]=str
  end
  
  def setgold(id, str)
    @gold[id]=str
  end
  
  def setitem(id, str)
    @item[id]=str
  end
  
  def setlocation(id, str)
    @location[id]=str
  end
  
  def setface(id, facename, str)
    @face[id]=facename
    @face_id[id]=str
  end
  
  def setexpired(id, str)
    @expired[id]=str
  end
  
  def set_level(id, str1, str2)
    @min_level[id]=str1
    @max_level[id]=str2
  end
  
  def setmax_level(id, str)
    @max_level[id]=str
  end
  
  def set_type(id, str1, str2)
    @type[id]=str1
    @type_icon[id]=str2
  end
  
  def settype_icon(id, str)
    @type_icon[id]=str
  end
  
  def set_goals(id, g1, g2, g3, g4, g5, g6)
    @goal[id]=g1
    @goal2[id]=g2
    @goal3[id]=g3
    @goal4[id]=g4
    @goal5[id]=g5
    @goal6[id]=g6
  end
  
  def set_goals_min(id, g1, g2, g3, g4, g5, g6)
    @goal_min[id]=g1
    @goal2_min[id]=g2
    @goal3_min[id]=g3
    @goal4_min[id]=g4
    @goal5_min[id]=g5
    @goal6_min[id]=g6
  end
  
  def set_goals_max(id, g1, g2, g3, g4, g5, g6)
    @goal_max[id]=g1
    @goal2_max[id]=g2
    @goal3_max[id]=g3
    @goal4_max[id]=g4
    @goal5_max[id]=g5
    @goal6_max[id]=g6
  end
  
  def add_goal_progress(id, val)
    @goal_min[id]=0 if @goal_min[id]==nil
    @goal_min[id]+=val
  end
  def add_goal2_progress(id, val)
    @goal2_min[id]=0 if @goal2_min[id]==nil
    @goal2_min[id]+=val
  end
  def add_goal3_progress(id, val)
    @goal3_min[id]=0 if @goal3_min[id]==nil
    @goal3_min[id]+=val
  end
  def add_goal4_progress(id, val)
    @goal4_min[id]=0 if @goal4_min[id]==nil
    @goal4_min[id]+=val
  end
  def add_goal5_progress(id, val)
    @goal5_min[id]=0 if @goal5_min[id]==nil
    @goal5_min[id]+=val
  end
  def add_goal6_progress(id, val)
    @goal6_min[id]=0 if @goal6_min[id]==nil
    @goal6_min[id]+=val
  end
  
  def subtract_goal_progress(id, val)
    @goal_min[id]=0 if @goal_min[id]==nil
    @goal_min[id]-=val
  end
  def subtract_goal2_progress(id, val)
    @goal2_min[id]=0 if @goal2_min[id]==nil
    @goal2_min[id]-=val
  end
  def subtract_goal3_progress(id, val)
    @goal3_min[id]=0 if @goal3_min[id]==nil
    @goal3_min[id]-=val
  end
  def subtract_goal4_progress(id, val)
    @goal4_min[id]=0 if @goal4_min[id]==nil
    @goal4_min[id]-=val
  end
  def subtract_goal5_progress(id, val)
    @goal5_min[id]=0 if @goal5_min[id]==nil
    @goal5_min[id]-=val
  end
  def subtract_goal6_progress(id, val)
    @goal6_min[id]=0 if @goal6_min[id]==nil
    @goal6_min[id]-=val
  end
  
  def get_goal(id)
    return @goal[id]
  end
  
  def get_goal2(id)
    return @goal2[id]
  end
  
  def get_goal3(id)
    return @goal3[id]
  end
  
  def get_goal4(id)
    return @goal4[id]
  end
  
  def get_goal5(id)
    return @goal5[id]
  end
  
  def get_goal6(id)
    return @goal6[id]
  end
  
  def get_goal_max(id)
    return @goal_max[id]
  end
  
  def get_goal2_max(id)
    return @goal2_max[id]
  end
  
  def get_goal3_max(id)
    return @goal3_max[id]
  end
  
  def get_goal4_max(id)
    return @goal4_max[id]
  end
  
  def get_goal5_max(id)
    return @goal5_max[id]
  end
  
  def get_goal6_max(id)
    return @goal6_max[id]
  end
  
  def get_goal_min(id)
    return @goal_min[id]
  end
  
  def get_goal2_min(id)
    return @goal2_min[id]
  end
  
  def get_goal3_min(id)
    return @goal3_min[id]
  end
  
  def get_goal4_min(id)
    return @goal4_min[id]
  end
  
  def get_goal5_min(id)
    return @goal5_min[id]
  end
  
  def get_goal6_min(id)
    return @goal6_min[id]
  end
  
  
  def qp(id)
    return @quest_rating[id]
  end
  
  def player_qp
    return @qp
  end
  
  
  
  def amount
    return @quest_size
  end
  
end



#function to set font size in description
def setFont(size)
  $font_size=size
end

def call_quest
  if $menu==0
    $mode=0
    SceneManager.call(Scene_Quest)
  else
    $mode=1
    SceneManager.call(Scene_Quest)
  end
end

#-============================================================================-#


#-[DataManager Alias]-#=======================================================-#

module DataManager
  class << self     
    alias :pq_create_game_objects    :create_game_objects
    alias :pq_make_save_contents     :make_save_contents
    alias :pq_extract_save_contents  :extract_save_contents
  end
  
  def self.create_game_objects
    $game_quests = Game_Quests.new
    pq_create_game_objects
  end
  
  def self.make_save_contents
    contents = pq_make_save_contents
    contents[:quests] = $game_quests
    contents
  end
  
  def self.extract_save_contents(contents)
    pq_extract_save_contents(contents)
    $game_quests = contents[:quests]
  end
end 



#-============================================================================-#


#-[Quest Window]-#============================================================-#

class Quest_Window < Window_Base
  def initialize
    super(0, 0, Graphics.width, Graphics.height)
    self.windowskin=Cache.system("QuestWindow") if Use_Windowskin == true
    self.opacity=0
    refresh
  end
  
  def refresh
    if $game_quests.name($quest_id)!=nil
      contents.clear
      contents.fill_rect(0, 0, 96, 96, face_bg)
      draw_face($game_quests.face($quest_id), $game_quests.face_id($quest_id), 0, 0)
      contents.fill_rect(0, 96, 96, line_height, face_bg)
      contents.fill_rect(96, 0, contents.width-96, line_height*4, dark)
      contents.fill_rect(96, 96, contents.width-96, line_height, darker)
      contents.fill_rect(96, 96, contents.width-96, 1, face_bg)
      
      contents.fill_rect(contents.width/2, 96+line_height*2, 1, line_height*2, white)
      contents.fill_rect(contents.width/2, 96+line_height*8, 1, line_height*2, white)
      contents.font.size=Font.default_size
      draw_text(0, 96, 96, line_height, $game_quests.sender($quest_id))
      
      
      text=sprintf("%s", $game_quests.desc($quest_id))
      ypos = 0
      change_color(normal_color)
      contents.font.size=$font_size
      text.split(/\n/).each do |t|
        draw_text(96, ypos, contents.width-96, line_height, t)
        ypos += $font_size
      end
      
      contents.font.size=Font.default_size
      $font_size=Font.default_size
      
      draw_icon($game_quests.type_icon($quest_id), 96, 96)
      
      contents.fill_rect(Graphics.width-300, 96, 100-24, line_height, dark2)
      draw_icon(EXP_Icon, contents.width-300, 96)
      contents.fill_rect(Graphics.width-200, 96, 100-24, line_height, dark2)
      draw_icon(Gold_Icon, contents.width-200, 96)
      contents.fill_rect(Graphics.width-100, 96, 100-24, line_height, dark2)
      draw_icon(Item_Icon, contents.width-100, 96)
      change_color(system_color)
      draw_text(96+24, 96, 96, line_height, $game_quests.type($quest_id))
      draw_text(Graphics.width-300, 96, 96, line_height, $game_quests.exp($quest_id))
      draw_text(Graphics.width-200, 96, 96, line_height, $game_quests.gold($quest_id))
      draw_text(Graphics.width-100, 96, 96, line_height, $game_quests.item($quest_id))
      change_color(normal_color)
      
      contents.fill_rect(0, 96+line_height*2, contents.width/2-24, line_height, dark)
      draw_text(0, 96+line_height*2, 200, line_height, "Min-level:")
      change_color(system_color) if $game_party.members[0].level >= $game_quests.min_level($quest_id)
      change_color(crisis_color) if $game_party.members[0].level < $game_quests.min_level($quest_id)
      draw_text(0, 96+line_height*2, contents.width/2-24, line_height, $game_quests.min_level($quest_id), 2)
      
      change_color(normal_color)
      
      contents.fill_rect(0, 96+line_height*3, contents.width/2-24, line_height, dark)
      draw_text(0, 96+line_height*3, 200, line_height, "Max-level:")
      change_color(system_color) if $game_party.members[0].level <= $game_quests.max_level($quest_id)
      change_color(crisis_color) if $game_party.members[0].level > $game_quests.max_level($quest_id)
      draw_text(0, 96+line_height*3, contents.width/2-24, line_height, $game_quests.max_level($quest_id), 2)
      
      change_color(normal_color)
      contents.fill_rect(contents.width/2+24, 96+line_height*2, 300, line_height, dark)
      draw_text(contents.width/2+24, 96+line_height*2, 300, line_height, "Location:")
      contents.fill_rect(contents.width/2+24, 96+line_height*3, 300, line_height, dark)
      draw_text(contents.width/2+24, 96+line_height*3, 300, line_height, "Expired:")
      change_color(system_color)
      draw_text(contents.width/2-24, 96+line_height*2, contents.width/2+24, line_height, $game_quests.location($quest_id), 2)
      text="Yes" if $game_quests.expired($quest_id)==true
      text="No" if $game_quests.expired($quest_id)==false
      draw_text(contents.width/2-24, 96+line_height*3, contents.width/2+24, line_height, text, 2)
      
      contents.fill_rect(0, 96+line_height*5, 50, line_height, dark)
      draw_text(0, 96+line_height*5, 50, line_height, $game_quests.get_goal($quest_id))
      contents.fill_rect(75, 96+line_height*5, 50, line_height, dark)
      contents.fill_rect(75*2, 96+line_height*5, 50, line_height, dark)
      contents.fill_rect(75*3, 96+line_height*5, 50, line_height, dark)
      contents.fill_rect(75*4, 96+line_height*5, 50, line_height, dark)
      contents.fill_rect(75*5, 96+line_height*5, 50, line_height, dark)
      draw_text(75, 96+line_height*5, 50, line_height, $game_quests.get_goal2($quest_id)) if $game_quests.get_goal2($quest_id) != 0
      draw_text(75*2, 96+line_height*5, 50, line_height, $game_quests.get_goal3($quest_id)) if $game_quests.get_goal3($quest_id) != 0
      draw_text(75*3, 96+line_height*5, 50, line_height, $game_quests.get_goal4($quest_id)) if $game_quests.get_goal4($quest_id) != 0
      draw_text(75*4, 96+line_height*5, 50, line_height, $game_quests.get_goal5($quest_id)) if $game_quests.get_goal5($quest_id) != 0
      draw_text(75*5, 96+line_height*5, 50, line_height, $game_quests.get_goal6($quest_id)) if $game_quests.get_goal6($quest_id) != 0
      
      
      text=sprintf("%d/%d", $game_quests.get_goal_min($quest_id), $game_quests.get_goal_max($quest_id))
      text2=sprintf("%d/%d", $game_quests.get_goal2_min($quest_id), $game_quests.get_goal2_max($quest_id))
      text3=sprintf("%d/%d", $game_quests.get_goal3_min($quest_id), $game_quests.get_goal3_max($quest_id))
      text4=sprintf("%d/%d", $game_quests.get_goal4_min($quest_id), $game_quests.get_goal4_max($quest_id))
      text5=sprintf("%d/%d", $game_quests.get_goal5_min($quest_id), $game_quests.get_goal5_max($quest_id))
      text6=sprintf("%d/%d", $game_quests.get_goal6_min($quest_id), $game_quests.get_goal6_max($quest_id))
      
      change_color(normal_color)
      
      draw_text(0, 96+line_height*6, 50, line_height, text) if $game_quests.get_goal($quest_id) != 0
      draw_text(75*1, 96+line_height*6, 50, line_height, text2) if $game_quests.get_goal2($quest_id) != 0
      draw_text(75*2, 96+line_height*6, 50, line_height, text3) if $game_quests.get_goal3($quest_id) != 0
      draw_text(75*3, 96+line_height*6, 50, line_height, text4) if $game_quests.get_goal4($quest_id) != 0
      draw_text(75*4, 96+line_height*6, 50, line_height, text5) if $game_quests.get_goal5($quest_id) != 0
      draw_text(75*5, 96+line_height*6, 50, line_height, text6) if $game_quests.get_goal6($quest_id) != 0
      
      change_color(system_color)
      
      contents.fill_rect(0, 96+line_height*8, contents.width/2-24, line_height*2, dark)
      contents.fill_rect(contents.width/2+24, 96+line_height*8, contents.width/2-24, line_height*2, dark)
      
      text="Quest Worth:"
      draw_text(0, 96+line_height*8, Graphics.width, line_height, text)
      
      draw_text(0, 96+line_height*9, Graphics.width, line_height, "Quest Complete:")
      
      text=sprintf("%s earned:", QP_Name)
      draw_text(contents.width/2+24, 96+line_height*8, contents.width/2, line_height, text)
      draw_text(contents.width/2+24, 96+line_height*9, contents.width/2, line_height, "Quests Completed:")
      
      
      change_color(normal_color)
      
      text=sprintf("%d %s", $game_quests.qp($quest_id), QP_Name)
      draw_text(0, 96+line_height*8, contents.width/2-24, line_height, text, 2)
      
      text=sprintf("Yes") if $game_quests.check_complete($quest_id)
      text=sprintf("No") if !$game_quests.check_complete($quest_id)
      
      draw_text(0, 96+line_height*9, contents.width/2-24, line_height, text, 2)
      draw_text(contents.width/2+24, 96+line_height*8, contents.width/2+24, line_height, $game_quests.player_qp, 2)
      text=sprintf("%d", $game_quests.get_completed_quests)
      draw_text(contents.width/2-24, 96+line_height*9, contents.width/2+24, line_height, text, 2)
      
      contents.font.size=12
      draw_text(0, line_height*16-4, Graphics.width, 12, "ProQuest by TheUnproPro")
    end
      
  end
  
  def white
    color=Color.new(255, 255, 255, 150)
    color
  end
  
  def dark
    color=Color.new(0, 0, 0, 50)
    color
  end
  
  def dark2
    color=Color.new(0, 0, 0, 120)
    color
  end
  
  def face_bg
    color=Color.new(0, 0, 0, 100)
    color
  end
  
  def darker
    color=Color.new(0, 0, 55, 75)
    color
  end
  
  def update
    super
    if $do_refresh == 1
      $game_quests.setface(01, $game_quests.face($quest_id), 3)
      contents.clear
      refresh
      $do_refresh = 0
    end
  end
end

#-============================================================================-#


#-[Empty Windows]-#===========================================================-#

class Dummy_Window < Window_Base
  def initialize(x, y, width, height)
    super(x, y, width, height)
    self.windowskin=Cache.system("QuestWindow") if Use_Windowskin == true
    refresh
  end
  
  def refresh
    
  end
  
  def update_tone
    if Use_Windowskin == true
      self.tone.set(brown) 
    else
      self.tone.set($game_system.window_tone)
    end
  end
  
  def brown
    if Use_Windowskin == true
      tone=Tone.new(Window_Color_r, Window_Color_g, Window_Color_b, 122)
      tone
    else
    end
  end
end

#-============================================================================-#


#-[Quest Accept Window]-#=====================================================-#

class Accept_Quests < Window_HorzCommand
  def make_command_list
    if $game_quests.accept($quest_id)==true && $game_quests.check_complete($quest_id)!=true
      add_command("Stop Quest", :stop)
      add_command("Back", :decline)
    end
    if $game_quests.accept($quest_id)!=true && $game_quests.check_complete($quest_id)!=true
      add_command("Accept", :accept, can_accept)
      add_command("Decline", :decline)
    end
    if $game_quests.check_complete($quest_id) == true
      add_command("Complete", :complete)
      add_command("Back", :decline, $game_quests.check_complete($quest_id)==false)
    end
  end
  
  def window_width
    return Graphics.width
  end
  
  def can_accept
    if $game_quests.min_level($quest_id) != nil && $game_quests.max_level($quest_id) != nil
      if $game_party.members[0].level <= $game_quests.max_level($quest_id) && $game_party.members[0].level>= $game_quests.min_level($quest_id)
        return true
      else
        return false
      end
    end
  end
end

#-============================================================================-#


#-[Quest Display Window]-#====================================================-#

class Quest_Display_Choices < Window_HorzCommand
  def make_command_list
    $i=0
    while $i<$game_quests.quest_size+1
      text=sprintf("%s", $error_msg) if $game_quests.accept($i)==nil
      text=sprintf("%s", $game_quests.name($i)) if $game_quests.accept($i)!=nil
      add_command(text, :cmd, $game_quests.accept($i)==true)
      $i+=1
    end
  end
  
  def window_width
    return Graphics.width
  end
  
  def update
    super
    if $game_quests.name(index) != nil
      $do_refresh = 1 if $quest_id != index
      $quest_id=index
    end
  end
end

#-============================================================================-#


#-[Quest help for map]-#======================================================-#

class Window_QuestHelp < Window_Base
  def initialize
    super(0, 0, Graphics.width, Graphics.height)
    self.opacity=0
    self.hide
    self.show
    
    refresh
  end
  
  def refresh
    contents.clear
    if $game_quests.quests_enabled == true && $show_quest==1
      size=75 if $game_quests.get_goal($selected_quest) != 0
      size=75*2 if $game_quests.get_goal2($selected_quest) != 0
      size=75*3 if $game_quests.get_goal3($selected_quest) != 0
      size=75*4 if $game_quests.get_goal4($selected_quest) != 0
      size=75*5 if $game_quests.get_goal5($selected_quest) != 0
      size=75*6 if $game_quests.get_goal6($selected_quest) != 0
      contents.fill_rect(0, 0, size, line_height*4, darker)
      contents.fill_rect(0, 0, 50, line_height, dark) if $game_quests.get_goal($selected_quest) != 0
      draw_text(0, 0, 50, line_height, $game_quests.get_goal($selected_quest))
      contents.font.size=18
      draw_text(0, line_height*3, Graphics.width, line_height, "Q-Close")
      draw_text(0, line_height*2, Graphics.width, line_height, $game_quests.name($selected_quest))
      contents.font.size=Font.default_size
      contents.fill_rect(75, 0, 50, line_height, dark) if $game_quests.get_goal2($selected_quest) != 0
      contents.fill_rect(75*2, 0, 50, line_height, dark) if $game_quests.get_goal3($selected_quest) != 0
      contents.fill_rect(75*3, 0, 50, line_height, dark) if $game_quests.get_goal4($selected_quest) != 0
      contents.fill_rect(75*4, 0, 50, line_height, dark) if $game_quests.get_goal5($selected_quest) != 0
      contents.fill_rect(75*5, 0, 50, line_height, dark) if $game_quests.get_goal6($selected_quest) != 0
      draw_text(75, 0, 50, line_height, $game_quests.get_goal2($selected_quest)) if $game_quests.get_goal2($selected_quest) != 0
      draw_text(75*2, 0, 50, line_height, $game_quests.get_goal3($selected_quest)) if $game_quests.get_goal3($selected_quest) != 0
      draw_text(75*3, 0, 50, line_height, $game_quests.get_goal4($selected_quest)) if $game_quests.get_goal4($selected_quest) != 0
      draw_text(75*4, 0, 50, line_height, $game_quests.get_goal5($selected_quest)) if $game_quests.get_goal5($selected_quest) != 0
      draw_text(75*5, 0, 50, line_height, $game_quests.get_goal6($selected_quest)) if $game_quests.get_goal6($selected_quest) != 0
    
    
      text=sprintf("%d/%d", $game_quests.get_goal_min($selected_quest), $game_quests.get_goal_max($selected_quest))
      text2=sprintf("%d/%d", $game_quests.get_goal2_min($selected_quest), $game_quests.get_goal2_max($selected_quest))
      text3=sprintf("%d/%d", $game_quests.get_goal3_min($selected_quest), $game_quests.get_goal3_max($selected_quest))
      text4=sprintf("%d/%d", $game_quests.get_goal4_min($selected_quest), $game_quests.get_goal4_max($selected_quest))
      text5=sprintf("%d/%d", $game_quests.get_goal5_min($selected_quest), $game_quests.get_goal5_max($selected_quest))
      text6=sprintf("%d/%d", $game_quests.get_goal6_min($selected_quest), $game_quests.get_goal6_max($selected_quest))
    
      change_color(normal_color)
    
      draw_text(0, line_height, 50, line_height, text) if $game_quests.get_goal($selected_quest) != 0
      draw_text(75*1, line_height, 50, line_height, text2) if $game_quests.get_goal2($selected_quest) != 0
      draw_text(75*2, line_height, 50, line_height, text3) if $game_quests.get_goal3($selected_quest) != 0
      draw_text(75*3, line_height, 50, line_height, text4) if $game_quests.get_goal4($selected_quest) != 0
      draw_text(75*4, line_height, 50, line_height, text5) if $game_quests.get_goal5($selected_quest) != 0
      draw_text(75*5, line_height, 50, line_height, text6) if $game_quests.get_goal6($selected_quest) != 0
    end
  end
  
  def dark
    color=Color.new(0, 0, 0, 50)
    color
  end
  def darker
    color=Color.new(50, 50, 50, 50)
    color
  end
  
  def update
    super
    refresh
    if Input.trigger?(:L)
      Sound.play_cancel if $show_quest!=0
      $show_quest=0
    end
  end
  
end

#-============================================================================-#


#-[Quest Scene]-#=============================================================-#

class Scene_Quest < Scene_MenuBase
  def start
    super
    make_windows
  end
  
  def make_windows
    @dummy1=Dummy_Window.new(0, 0, Graphics.width, 24*6)
    @dummy2=Dummy_Window.new(0, 96+48, Graphics.width, 24*3)
    @dummy3=Dummy_Window.new(0, 96+24+96, Graphics.width, 24*3)
    @dummy4=Dummy_Window.new(0, 96+96+96, Graphics.width, 24*3)
    @dummy5=Dummy_Window.new(0, 96+96+96+24*3, Graphics.width, 24*2+8)
    @info=Quest_Window.new
    
    if $mode==0
      @choices=Accept_Quests.new(0, 24*15-4)
      @choices.opacity=0
    
      @choices.set_handler(:accept, method(:accept))
      @choices.set_handler(:decline, method(:decline))
      @choices.set_handler(:cancel, method(:decline)) if $game_quests.check_complete($quest_id)!=true
      @choices.set_handler(:stop, method(:stop))
      @choices.set_handler(:complete, method(:complete))
    end
    
    if $mode == 1
      @choices=Quest_Display_Choices.new(0, 24*15-4)
      @choices.opacity=0
    
      @choices.set_handler(:cmd, method(:cmd))
      @choices.set_handler(:cancel, method(:decline))
    end
  end
  
  def cmd
    $selected_quest=@choices.index
    $show_quest=1
    $mode=0
    return_scene
  end
  def complete
    $show_quest=0
    return_scene
    SceneManager.call(Scene_Complete)
  end
  
  def accept
    $game_quests.do_accept($quest_id)
    return_scene
  end
  
  def stop
    $game_quests.do_un_accept($quest_id)
    $show_quest=0
    $mode=0
    return_scene
  end
  
  def decline
    $menu=0
    $mode=0

    return_scene
  end
end

#-============================================================================-#


#-[Add command to menu]-#=====================================================-#

class Window_MenuCommand < Window_Command
  
  alias quest_add_original_commands add_original_commands
  def add_original_commands
    quest_add_original_commands
    add_command("Quests", :quests, $game_quests.quests_enabled)
  end
  
end

#-============================================================================-#


#-[Add command to menu]-#=====================================================-#

class Scene_Menu < Scene_MenuBase
  alias quest_create_command_window create_command_window
  def create_command_window
    quest_create_command_window
    @command_window.set_handler(:quests, method(:quests))
  end
  
  def quests
    $menu=1
    $mode=1
    $quest_id=0
    SceneManager.call(Scene_Quest)
  end
end

#-============================================================================-#


#-[Add window to map]-#=======================================================-#

class Scene_Map < Scene_Base
  alias quest_create_all_windows create_all_windows
  def create_all_windows
    quest_create_all_windows
    
    @help_window=Window_QuestHelp.new
  end
end

class Window_Complete < Window_Base
  def initialize
    super(0, 0, Graphics.width, Graphics.height)
    self.opacity=0
    Audio.me_play(Complete_ME, Complete_ME_Volume, Complete_ME_Pitch)
    refresh
  end
  
  def refresh
    contents.clear
    contents.font.size=32
    $game_quests.do_un_accept($quest_id)
    change_color(system_color)
    draw_text(0, 0, Graphics.width, 32, "Quest Complete!", 1)
    change_color(normal_color)
    contents.font.size=Font.default_size
    text=sprintf("You earned %d %s and %d %s", $game_quests.exp($quest_id), $exp_name, $game_quests.gold($quest_id), $gold_name)
    draw_text(0, line_height+32, Graphics.width, line_height, text)
    text=sprintf("Items gained: %s", $game_quests.item($quest_id))
    draw_text(0, line_height*2+32, Graphics.width, line_height, text)
    draw_text(0, line_height*3+32, Graphics.width, line_height, "Press confirm key to continue.")
  end

end

#-============================================================================-#


#-[Quest Complete Scene]-#====================================================-#

class Scene_Complete < Scene_MenuBase
  def start
    super
    make_win
  end
  
  def make_win
    @window=Window_Complete.new
    $game_party.all_members.each do |actor|
      actor.gain_exp($game_quests.exp($quest_id))
    end
    $game_party.gain_gold($game_quests.gold($quest_id))
  end
  
  def update
    super
    if Input.trigger?(:C)
      return_scene
    end
  end
end

 

How to use: (Event - Script)

Spoiler

Set up quest: (With ID of 1 by default, change 1 to 0 if first quest.)

$quest_id=1
$game_quests.setname(01, "Veggies!")
$game_quests.setsender(01, "Derik")
$game_quests.setface(01, "People1", 3)
$game_quests.set_type(01, "Food", 298)
$game_quests.set_level(01, 1, 5)
$game_quests.setexp(01, 25)
$game_quests.setgold(01, 50)
$game_quests.setitem(01, "Sample")
$game_quests.setlocation(01, "Eastern Rosia")
$game_quests.setexpired(01, false)
#setFont(18)
$game_quests.setdesc(01, "This is the craziest thing ever. I got this awesome
recipe for some kind of stew, so I decided I'd like to try and make it.
The problem is, I need the vegetables to make it! Do you think you
can get me them?")

$game_quests.set_goals(01, "Carrots", 0, "Onions", "Basil", "Ginger", "Beats")
$game_quests.set_goals_min(01, 0, 0, 0, 0, 0, 0)
$game_quests.set_goals_max(01, 1, 3, 5, 12, 2, 3)

$game_quests.set_quest_points(01, 5)

SceneManager.call(Scene_Quest)

Add progress:
$game_quests.add_goal_progress(1, 1)
$game_quests.add_goal2_progress(1, 3)
$game_quests.add_goal3_progress(1, 5)
$game_quests.add_goal4_progress(1, 12)
$game_quests.add_goal5_progress(1, 2)
$game_quests.add_goal6_progress(1, 3)
 

 


Viewing all articles
Browse latest Browse all 416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>