Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Quest Status - My First Script :D

Status
Not open for further replies.
Quest Status


Version: 2


Introduction
Well, this is a very simple script I have made. It's my first script, so don't be too harsh :P

Screenshots
screeny.png


Features
-Can hold up to 15 quests(I can raise the maximum if needed)
-Can hold 2 lines of information for each quest(I can raise the maximum if needed)
-Shows the start point
-Shows if you have started, are in progress or have finished the quest.
-Shows the reward only if you have completed the quest
-Demo comes with 2 mini-quests.

Demo
http://www.savefile.com/files/3177604

Script
Code:
 

#------------------------------------------------------------------------------

#----Quests Window V.2---------------------------------------------------------

#----Made by Sirsk8aton--------------------------------------------------------

#------------------------------------------------------------------------------

#----Instructions--------------------------------------------------------------

#------------------------------------------------------------------------------

# 

# The * are indicate in the script where you need to edit that.

# *- Update how many quests you wish to have in the quests window in

# **- Update the names of the quests. 

# ***- Update the quests start points there.

# ****- Update the quests description there.

# *****- Update the quest's starting switch there.

# ******- Update the quest's ending switch there.

# Everything you need to edit is withing lines 14-30

#----Module--------------------------------------------------------------------

module Quest

  # ** Add Quest Names Here, This would be quest 4: 4 => "Name here", Seperated By Commas

  Names = {1 => "Delivery", 2 => "Kill Bill", 3 => "Quest3", 4 => "Quest4", 5 => "Quest5", 6 => "Quest6", 7 => "Quest7", 8 => "Quest8", 9 => "Quest9", 10 => "Quest10", 11 => "Quest11", 12 => "Quest12", 13 => "Quest13", 14 => "Quest14", 15 => "Quest15"}

  # *** Add Quest Start Points Here, Also Seperated By Commas

  Start = {1 => "Skeleton", 2 => "Lady In Pink Armor", 3 => "Somewhere", 4 => "Somewhere", 5 => "Somewhere", 6 => "Somewhere", 7 => "Somewhere", 8 => "Somewhere", 9 => "Somewhere", 10 => "Somewhere", 11 => "Somewhere", 12 => "Somewhere", 13 => "Somewhere", 14 => "Somewhere", 15 => "Somewhere"} 

  # **** Add the quest's info here

  Info = {1 => "Deliver the pie to the Skeleton's buddy, Casper.", 2 => "Kill Bill and his army!", 3 => "Line 1", 4 => "Line 1", 5 => "Line 1", 6 => "Line 1", 7 => "Line 1", 8 => "Line 1", 9 => "Line 1", 10 => "Line 1", 11 => "Line 1", 12 => "Line 1", 13 => "Line 1", 14 => "Line 1", 15 => "Line 1"} 

  # **** Add the quest's info here(Line2)

  Info2 = {1 => "Don't let it get cold!", 2 => "Leave NO survivors!", 3 => "Line 2", 4 => "Line 2", 5 => "Line 2", 6 => "Line 2", 7 => "Line 2", 8 => "Line 2", 9 => "Line 2", 10 => "Line 2", 11 => "Line 2", 12 => "Line 2", 13 => "Line 2", 14 => "Line 2", 15 => "Line 2"} 

  # ***** Put the starting switch id of each quest here.

  Start_Switch = {1 => 1, 2 => 3}

  # ****** Put the ending switch id of each quest here.

  End_Switch = {1 => 2, 2 => 4}

  Reward = {1 => "1,000 GP", 2 => "Mythril Sword"}

end

#----Scene_Quests--------------------------------------------------------------

class Scene_Quests

  def initialize(menu_index = 0)

    @menu_index = menu_index

    # * Update the number of quests you wish to have in the quest window here.

    @quests = 2

  end

  def main

    s1 = Quest::Names[1]

    s2 = Quest::Names[2]

    s3 = Quest::Names[3]

    s4 = Quest::Names[4]

    s5 = Quest::Names[5]

    s6 = Quest::Names[6]

    s7 = Quest::Names[7]

    s8 = Quest::Names[8]

    s9 = Quest::Names[9]

    s10 = Quest::Names[10]

    s11 = Quest::Names[11]

    s12 = Quest::Names[12]

    s13 = Quest::Names[13]

    s14 = Quest::Names[14]

    s15 = Quest::Names[15]

    if @quests == 1

    $cmd_window = Window_Command.new(160, [s1])

    end

    if @quests == 2

    $cmd_window = Window_Command.new(160, [s1, s2])

    end

    if @quests == 3

    $cmd_window = Window_Command.new(160, [s1, s2, s3])

    end

    if @quests == 4

    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4])

    end

    if @quests == 5

    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5])

    end

    if @quests == 6

    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])

    end

    if @quests == 7

    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])

    end

    if @quests == 8

    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8])

    end

    if @quests == 9

    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9])

    end

    if @quests == 10

    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10])

    end

    if @quests == 11

    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11])

    end

    if @quests == 12

    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12])

    end

    if @quests == 13

    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13])

    end

    if @quests == 14

    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14])

    end

    if @quests == 15

    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15])

    end

    $cmd_window.index = @menu_index

    $cmd_window.y = 0

    $cmd_window.height = 480

    @quests_status = Window_QuestsStatus.new

    @quests_window = Window_Quests.new

    @reward_window = Window_Reward.new

    Graphics.transition

    loop do

      Graphics.update

      Input.update

      update

      if $scene != self

        break

      end

    end

    Graphics.freeze

    $cmd_window.dispose

    @quests_status.dispose

    @quests_window.dispose

    @reward_window.dispose

  end

  def update

    @quests_window.update

    @quests_status.update

    @reward_window.update

    $cmd_window.update

    if Input.trigger?(Input::B)

      $game_system.se_play($data_system.cancel_se)

      $scene = Scene_Map.new

    end

  end

end

#---------Window_Quests--------------------------------------------------------

class Window_Quests < Window_Selectable

  def initialize

    super(160, 60, 480, 340)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = "Tahoma"

    self.contents.font.size = 22

    @switch1 = Quest::Start_Switch[1]

    @switch2 = Quest::End_Switch[1]

    refresh

  end

  def update

    if $cmd_window.active

      self.contents.clear

      update_commands

      return

    end

    loop do

      Graphics.update

      Input.update

      update

      if $scene != self

        break

      end

    end

    Graphics.freeze

    @info.dispose

    @info2.dispose

    @switch1.dispose

    @switch2.dispose

    @start.dispose

  end

  def update_commands

    case $cmd_window.index

    when 0 

      @info = Quest::Info[1]

      @info2 = Quest::Info2[1]

      @start = Quest::Start[1]

      @switch1 = Quest::Start_Switch[1]

      @switch2 = Quest::End_Switch[1]

      refresh

    when 1

      @info = Quest::Info[2]

      @info2 = Quest::Info2[2]

      @start = Quest::Start[2]

      @switch1 = Quest::Start_Switch[2]

      @switch2 = Quest::End_Switch[2]

      refresh

    when 2

      @info = Quest::Info[3]

      @info2 = Quest::Info2[3]

      @start = Quest::Start[3]

      @switch1 = Quest::Start_Switch[3]

      @switch2 = Quest::End_Switch[3]

      refresh

    when 3

      @info = Quest::Info[4]

      @info2 = Quest::Info2[4]

      @start = Quest::Start[4]

      @switch1 = Quest::Start_Switch[4]

      @switch2 = Quest::End_Switch[4]

      refresh

    when 4

      @info = Quest::Info[5]

      @info2 = Quest::Info2[5]

      @start = Quest::Start[5]

      @switch1 = Quest::Start_Switch[5]

      @switch2 = Quest::End_Switch[5]

      refresh

    when 5

      @info = Quest::Info[6]

      @info2 = Quest::Info2[6]

      @start = Quest::Start[6]

      @switch1 = Quest::Start_Switch[6]

      @switch2 = Quest::End_Switch[6]

      refresh

    when 6

      @info = Quest::Info[7]

      @info2 = Quest::Info2[7]

      @start = Quest::Start[7]

      @switch1 = Quest::Start_Switch[7]

      @switch2 = Quest::End_Switch[7]

      refresh

    when 7

      @info = Quest::Info[8]

      @info2 = Quest::Info2[8]

      @start = Quest::Start[8]

      @switch1 = Quest::Start_Switch[8]

      @switch2 = Quest::End_Switch[8]

      refresh

    when 8

      @info = Quest::Info[9]

      @info2 = Quest::Info2[9]

      @start = Quest::Start[9]

      @switch1 = Quest::Start_Switch[9]

      @switch2 = Quest::End_Switch[9]

      refresh

    when 9

      @info = Quest::Info[10]

      @info2 = Quest::Info2[10]

      @start = Quest::Start[10]

      @switch1 = Quest::Start_Switch[10]

      @switch2 = Quest::End_Switch[10]

      refresh

    when 10

      @info = Quest::Info[11]

      @info2 = Quest::Info2[11]

      @start = Quest::Start[11]

      @switch1 = Quest::Start_Switch[11]

      @switch2 = Quest::End_Switch[11]

      refresh

    when 11

      @info = Quest::Info[12]

      @info2 = Quest::Info2[12]

      @start = Quest::Start[12]

      @switch1 = Quest::Start_Switch[12]

      @switch2 = Quest::End_Switch[12]

      refresh

    when 12

      @info = Quest::Info[13]

      @info2 = Quest::Info2[13]

      @start = Quest::Start[13]

      @switch1 = Quest::Start_Switch[13]

      @switch2 = Quest::End_Switch[13]

      refresh

    when 13

      @info = Quest::Info[14]

      @info2 = Quest::Info2[14]

      @start = Quest::Start[14]

      @switch1 = Quest::Start_Switch[14]

      @switch2 = Quest::End_Switch[14]

      refresh

    when 14

      @info = Quest::Info[15]

      @info2 = Quest::Info2[15]

      @start = Quest::Start[15]

      @switch1 = Quest::Start_Switch[15]

      @switch2 = Quest::End_Switch[15]

      refresh

      return

    end

  end

  def refresh

    self.contents.font.color = system_color

    self.contents.draw_text(10, 10, 320, 32, "-Quest Description-")

    self.contents.font.color = normal_color

    self.contents.draw_text(10, 45, 320, 32, @info.to_s)

    self.contents.draw_text(10, 67, 320, 32, @info2.to_s)

    self.contents.font.color = system_color

    self.contents.draw_text(130, 125, 320, 32, "-Starting Location-")

    self.contents.font.color = normal_color

    self.contents.draw_text(130, 160, 320, 32, @start.to_s)

    self.contents.font.color = system_color

    self.contents.draw_text(250, 213, 320, 32, "-Quest Status-")

    self.contents.font.color = normal_color

    if $game_switches[@switch1] == false

      self.contents.draw_text(250, 248, 320, 32, "Not Started")

    elsif $game_switches[@switch1] == true and $game_switches[@switch2] == false

      self.contents.draw_text(250, 248, 320, 32, "In Progress")

    elsif $game_switches[@switch2] == true 

      self.contents.draw_text(250, 248, 320, 32, "Completed")

    end

  end

end

#----Window_QuestsStatus-------------------------------------------------------

class Window_QuestsStatus < Window_Base

  def initialize

    super(160, 0, 480, 60)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = "Tahoma"

    self.contents.font.size = 22

    update_commands

  end

   def update

    if $cmd_window.active

      self.contents.clear

      update_commands

      return

      end

    loop do

      Graphics.update

      Input.update

      update

      if $scene != self

        break

      end

    end

    Graphics.freeze

    @names.dispose

  end

  def update_commands

    case $cmd_window.index

    when 0 

      @names = Quest::Names[1]

      refresh

    when 1

      @names = Quest::Names[2]

      refresh

    when 2

      @names = Quest::Names[3]

      refresh

    when 3

      @names = Quest::Names[4]

      refresh

    when 4

      @names = Quest::Names[5]

      refresh

    when 5

      @names = Quest::Names[6]

      refresh

    when 6

      @names = Quest::Names[7]

      refresh

    when 7

      @names = Quest::Names[8]

      refresh

    when 8

      @names = Quest::Names[9]

      refresh

    when 9

      @names = Quest::Names[10]

      refresh

    when 10

      @names = Quest::Names[11]

      refresh

    when 11

      @names = Quest::Names[12]

      refresh

    when 12

      @names = Quest::Names[13]

      refresh

    when 13

      @names = Quest::Names[14]

      refresh

    when 14

      @names = Quest::Names[15]

      refresh

      return

    end

  end

  def refresh

    self.contents.font.color = system_color

    self.contents.draw_text(200, 0, 320, 32, @names.to_s)

  end

end

  

#----Window_Reward-------------------------------------------------------------

 

class Window_Reward < Window_Base

  

   def initialize

    super(160, 400, 480, 80)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.contents.font.name = "Tahoma"

    self.contents.font.size = 22

    @reward = Quest::Reward[1]

    @switch2 = Quest::End_Switch[1]

    update_commands

  end

  

  def update

    if $cmd_window.active

      self.contents.clear

      update_commands

      return

      end

    loop do

      Graphics.update

      Input.update

      update

      if $scene != self

        break

      end

    end

    Graphics.freeze

    @reward.dispose

  end

  

  def update_commands

    case $cmd_window.index

    when 0 

      @reward = Quest::Reward[1]

      @switch2 = Quest::End_Switch[1]

      refresh

    when 1

      @reward = Quest::Reward[2]

      @switch2 = Quest::End_Switch[2]

      refresh

    when 2

      @reward = Quest::Reward[3]

      @switch2 = Quest::End_Switch[3]

      refresh

    when 3

      @reward = Quest::Reward[4]

      @switch2 = Quest::End_Switch[4]

      refresh

    when 4

      @reward = Quest::Reward[5]

      @switch2 = Quest::End_Switch[5]

      refresh

    when 5

      @reward = Quest::Reward[6]

      @switch2 = Quest::End_Switch[6]

      refresh

    when 6

      @reward = Quest::Reward[7]

      @switch2 = Quest::End_Switch[7]

      refresh

    when 7

      @reward = Quest::Reward[8]

      @switch2 = Quest::End_Switch[8]

      refresh

    when 8

      @reward = Quest::Reward[9]

      @switch2 = Quest::End_Switch[9]

      refresh

    when 9

      @reward = Quest::Reward[10]

      @switch2 = Quest::End_Switch[10]

      refresh

    when 10

      @reward = Quest::Reward[11]

      @switch2 = Quest::End_Switch[11]

      refresh

    when 11

      @reward = Quest::Reward[12]

      @switch2 = Quest::End_Switch[12]

      refresh

    when 12   

      @reward = Quest::Reward[13]

      @switch2 = Quest::End_Switch[13]

      refresh

    when 13  

      @reward = Quest::Reward[14]

      @switch2 = Quest::End_Switch[14]

      refresh

    when 14     

      @reward = Quest::Reward[15]

      @switch2 = Quest::End_Switch[15]

      refresh

      return

    end

  end

  

  

  def refresh

    if $game_switches[@switch2] == false

     self.contents.font.color = system_color

     self.contents.draw_text(10, 10, 320, 32, "Reward:")

     self.contents.font.color = normal_color

      self.contents.draw_text(100, 10, 320, 32, "???")

   elsif if $game_switches[@switch2] == true

     self.contents.font.color = system_color

     self.contents.draw_text(10, 10, 320, 32, "Reward:")

      self.contents.font.color = normal_color

      self.contents.draw_text(100, 10, 320, 32, @reward.to_s)

    end

    end

  end

end

 


Instructions
Inside the script I give brief instructions. If you need any help, just ask :)

Call it with:
Code:
$scene = Scene_Quests.new

Compatibility
Uhm...Not entirely sure, but it should be compatible with anything.

Credit
Sirsk8aton

Author's Notes
Enjoy :D and is anyone needs any help setting it up, please don't hesitate to ask :)
 
No credit? I trusted you......... You have potential and with this nonsence people can steal it! Please give him credit ;)

edit: Nevermind now you want credit.
 
Nice, I like it! It will be perfect in my game. Thanks

EDIT:

Is it possible so that it shows no quests, and when you call it, like "addquest..blah" it adds to the menu. Then its in progress. When you call a script again, to complete it, it stays in the menu.
 
A good first attempt at a script.

A few things I saw a bit off
1)
class Window_Quests < Window_Selectable

#----def initialize-------------
def initialize
super(0, 60, 640, 420)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
refresh
end

if you are going to make a window a selectable window you must set the index to 0 somwhere in the initialize method or somewhere in the methods of the class I don't see that anywhere, so then its not selectable to fix that just define self.index, @column_max (if more than one column), @item_max, and change self.contents to fit all of the data. There are several examples of this in the default classes. (Not doing so will cause problems since if you have many quests the window's contents will not be able to hold it all)

2)
# Quest 1
self.contents.draw_text(5, 2, 320, 32, "Delivery") #Quest Name
self.contents.draw_text(155, 2, 320, 32, "Skeleton") #Quest Start Point
if $game_switches[1] == true #Starting Switch
self.contents.draw_text(258, 2, 320, 33, "...")
self.contents.draw_text(353, 2, 320, 32, "X")
if $game_switches[2] == true #Completion Switch
self.contents.draw_text(425, 2, 320, 33, "...")
self.contents.draw_text(510, 2, 320, 32, "X")
end
end
#End of Quest1

All of this could be simplified by using a for loop all you have to do is somewhere outside of this class have a place where the user can define the quest data and then reference that in the for loop and doing so would increase user friendliness since they won't have to change the actual script but a place where they can edit the data

3) The problem Chopsuey mentioned can be fixed by moving your first conditional statement to cover the whole block like this, that way if the quest hasn't been started its will not appear on the list
Code:
  if $game_switches[1] == true #Starting Switch
    self.contents.draw_text(5, 2, 320, 32, "Delivery") #Quest Name
    self.contents.draw_text(155, 2, 320, 32, "Skeleton") #Quest Start Point
    self.contents.draw_text(258, 2, 320, 33, "...")
    self.contents.draw_text(353, 2, 320, 32, "X")
    if $game_switches[2] == true #Completion Switch
      self.contents.draw_text(425, 2, 320, 33, "...")
      self.contents.draw_text(510, 2, 320, 32, "X")
    end
  end

If you need any help feel free to contact me
 
Thanks for the feedback :D

@Trickster/SephirothSpawn? :
1)Yeah, I just made another script for a request, and I figured out how to do all of the commands.

2)Hmm..I don't know what you mean XD

@ChopSuey!: Look at Trickster's post, the "3)" part :P
 
Here a little example of what I meant my 2) by using a module to hold the data

Code:
module Quest
  #Names syntax {id => name, id => name, ...}
  Names = {1 => "Delivery"}
  #Switches for the Quest syntax {id => [start, end], id => [start, end], ...}
  Switches = {1 => [1,2]}
  #Location for the Quest syntax {id => Location, id => Location, ...}
  Location = {1 => "Skeleton"}
end

then you can refer to the data by using
Quest::Names[id], Quest::Switches[id][type], and Quest::Location[id]
where id is the id of the data to get
and type is the type to get for switches 0: Starting 1: Completion

I won't spoil the fun for you if you use the above code by editing the refresh method for you ;)
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top