Main Menu
  • Welcome to The RPG Maker Resource Kit.

"Simple" Quest log screen

Started by Sthrattoff, January 12, 2007, 08:55:45 AM

0 Members and 3 Guests are viewing this topic.

Wafflekid

I know, it's just I need that part to finish my game.
Quote from: Me™ on January 31, 2007, 02:46:52 PM
What do you want... you can't force him!



I know, it's just I need that part to finish my game.
Hi...


Sthrattoff

Please wait until I remake the updater or the 2nd version of this script.
Symphony of Alderra : Memoirs of Life

Storyline : 200% (Overimaginatives)
Scripting : 100% (At last...)
Eventing  : 100%
Mapping   : 0.125%

Wafflekid

Hi...

Sthrattoff

Alright, the 2nd version is going to published...
Symphony of Alderra : Memoirs of Life

Storyline : 200% (Overimaginatives)
Scripting : 100% (At last...)
Eventing  : 100%
Mapping   : 0.125%

Wafflekid

Hi...

Sthrattoff

This is it. But not perfect (yet...)
#=============================================================================
# Quest Log Screen
#-----------------------------------------------------------------------------
# ** Version 2.0
# ** Original by Sthrattoff
#=============================================================================
# Description :
# This script enables the ability to show current active quest.

# Features :
# SIMPLIFIED! Now the script is just about 300 lines length.
# Unlimited amount of quest can be added.
# Still use variable to mark quest's progress.

# Limitation :
# Only can store up to 12 progress per quest.

# History :
# Version 1.0 : Initial release.
# Version 1.2 : Add "Types" features.
# Version 2.0 : Changes in programming style and infinite quest support.

# Instruction
# Just put this script above main.

# Configuration :
# To add quest, use Call Script command and type this :
# $names.push "quest name" for the quest's name
# $types.push "quest type" for the quest's type (main or sidequest or something)
# $descriptionm.push "quest description line m" for the quest's description. m is the line
# number (1-5)
# $objectivesm.push "quest objectives m" for the quest's objectives. m is the objective
# number (1-12)
# $var_ID.push value for the quest's game variable marker ID
# To end a quest, set the marker variable's value to 12

# Credits
# See the header + Blizzard and Enterbrain
#=============================================================================

class Scene_Quest
 
  $names = []
  $types = []
  $description0 = []
  $description1 = []
  $description2 = []
  $description3 = []
  $description4 = []
  $objectives0 = []
  $objectives1 = []
  $objectives2 = []
  $objectives3 = []
  $objectives4 = []
  $objectives5 = []
  $objectives6 = []
  $objectives7 = []
  $objectives8 = []
  $objectives9 = []
  $objectives10 = []
  $objectives11 = []
  $var_ID = []
 
  def initialize
    $names.compact
  end
 
  def main
    @quest_list = Window_Command.new(160, $names)
    @quest_window = Window_Quest.new
    @quest_window.x = 160
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    @quest_list.dispose
    @quest_window.dispose
  end
 
  def update
    @quest_list.update
    @quest_window.update
    if @quest_list.active
      update_quest
      return
    end
  end
 
  def update_quest
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(2)
      return
    end
    quest = @quest_list.index
    preview(quest)
  end
 
  def preview(x)
    $preview_name = $names[x]
    $preview_type = $types[x]
    $preview_description0 = $description0[x]
    $preview_description1 = $description1[x]
    $preview_description2 = $description2[x]
    $preview_description3 = $description3[x]
    $preview_description4 = $description4[x]
    $preview_objectives0 = $objectives0[x]
    $preview_objectives1 = $objectives1[x]
    $preview_objectives2 = $objectives2[x]
    $preview_objectives3 = $objectives3[x]
    $preview_objectives4 = $objectives4[x]
    $preview_objectives5 = $objectives5[x]
    $preview_objectives6 = $objectives6[x]
    $preview_objectives7 = $objectives7[x]
    $preview_objectives8 = $objectives8[x]
    $preview_objectives9 = $objectives9[x]
    $preview_objectives10 = $objectives10[x]
    $preview_objectives11 = $objectives11[x]
    $preview_variable = $var_ID[x]
    return
  end
 
end

class Window_Quest < Window_Base
 
  def initialize
    super(0, 0, 480, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 32, self.width - 32, 32, $preview_type.to_s, 1)
    self.contents.draw_text(0, 224, self.width - 32, 32, "Objectives", 1) if $types.size != 0
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 0, self.width - 32, 32, $preview_name.to_s, 1)
    self.contents.draw_text(0, 64, self.width - 32, 32 * 5, $preview_description0.to_s)
    self.contents.draw_text(0, 96, self.width - 32, 32 * 5, $preview_description1.to_s)
    self.contents.draw_text(0, 128, self.width - 32, 32 * 5, $preview_description2.to_s)
    self.contents.draw_text(0, 160, self.width - 32, 32 * 5, $preview_description3.to_s)
    self.contents.draw_text(0, 192, self.width - 32, 32 * 5, $preview_description4.to_s)
    case $game_variables[$preview_variable.to_i]
    when 0
      self.contents.font.color = normal_color
      self.contents.draw_text(0, 256, self.width / 2, 32, "•" + $preview_objectives0.to_s) if $types.size != 0
    when 1
      self.contents.font.color = normal_color
      self.contents.draw_text(0, 288, self.width / 2, 32, "•" + $preview_objectives1.to_s)
      self.contents.font.color = disabled_color
      self.contents.draw_text(0, 256, self.width / 2, 32, "•" + $preview_objectives0.to_s)
    when 2
      self.contents.font.color = normal_color
      self.contents.draw_text(0, 320, self.width / 2, 32, "•" + $preview_objectives2.to_s)
      self.contents.font.color = disabled_color
      self.contents.draw_text(0, 288, self.width / 2, 32, "•" + $preview_objectives1.to_s)
      self.contents.draw_text(0, 256, self.width / 2, 32, "•" + $preview_objectives0.to_s)
    when 3
      self.contents.font.color = normal_color
      self.contents.draw_text(0, 352, self.width / 2, 32, "•" + $preview_objectives3.to_s)
      self.contents.font.color = disabled_color
      self.contents.draw_text(0, 320, self.width / 2, 32, "•" + $preview_objectives2.to_s)
      self.contents.draw_text(0, 288, self.width / 2, 32, "•" + $preview_objectives1.to_s)
      self.contents.draw_text(0, 256, self.width / 2, 32, "•" + $preview_objectives0.to_s)
    when 4
      self.contents.font.color = normal_color
      self.contents.draw_text(0, 384, self.width / 2, 32, "•" + $preview_objectives4.to_s)
      self.contents.font.color = disabled_color
      self.contents.draw_text(0, 352, self.width / 2, 32, "•" + $preview_objectives3.to_s)
      self.contents.draw_text(0, 320, self.width / 2, 32, "•" + $preview_objectives2.to_s)
      self.contents.draw_text(0, 288, self.width / 2, 32, "•" + $preview_objectives1.to_s)
      self.contents.draw_text(0, 256, self.width / 2, 32, "•" + $preview_objectives0.to_s)
    when 5
      self.contents.font.color = normal_color
      self.contents.draw_text(0, 416, self.width / 2, 32, "•" + $preview_objectives5.to_s)
      self.contents.font.color = disabled_color
      self.contents.draw_text(0, 384, self.width / 2, 32, "•" + $preview_objectives4.to_s)
      self.contents.draw_text(0, 352, self.width / 2, 32, "•" + $preview_objectives3.to_s)
      self.contents.draw_text(0, 320, self.width / 2, 32, "•" + $preview_objectives2.to_s)
      self.contents.draw_text(0, 288, self.width / 2, 32, "•" + $preview_objectives1.to_s)
      self.contents.draw_text(0, 256, self.width / 2, 32, "•" + $preview_objectives0.to_s)
    when 6
      self.contents.font.color = normal_color
      self.contents.draw_text(240, 256, self.width / 2, 32, "•" + $preview_objectives6.to_s)
      self.contents.font.color = disabled_color
      self.contents.draw_text(0, 416, self.width / 2, 32, "•" + $preview_objectives5.to_s)
      self.contents.draw_text(0, 384, self.width / 2, 32, "•" + $preview_objectives4.to_s)
      self.contents.draw_text(0, 352, self.width / 2, 32, "•" + $preview_objectives3.to_s)
      self.contents.draw_text(0, 320, self.width / 2, 32, "•" + $preview_objectives2.to_s)
      self.contents.draw_text(0, 288, self.width / 2, 32, "•" + $preview_objectives1.to_s)
      self.contents.draw_text(0, 256, self.width / 2, 32, "•" + $preview_objectives0.to_s)
    when 7
      self.contents.font_color = normal_color
      self.contents.draw_text(240, 288, self.width / 2, 32, "•" + $preview_objectives7.to_s)
      self.contents.font.color = disabled_color
      self.contents.draw_text(240, 256, self.width / 2, 32, "•" + $preview_objectives6.to_s)
      self.contents.draw_text(0, 416, self.width / 2, 32, "•" + $preview_objectives5.to_s)
      self.contents.draw_text(0, 384, self.width / 2, 32, "•" + $preview_objectives4.to_s)
      self.contents.draw_text(0, 352, self.width / 2, 32, "•" + $preview_objectives3.to_s)
      self.contents.draw_text(0, 320, self.width / 2, 32, "•" + $preview_objectives2.to_s)
      self.contents.draw_text(0, 288, self.width / 2, 32, "•" + $preview_objectives1.to_s)
      self.contents.draw_text(0, 256, self.width / 2, 32, "•" + $preview_objectives0.to_s)
    when 8
      self.contents.font.color = normal_color
      self.contents.draw_text(240, 320, self.width / 2, 32, "•" + $preview_objectives8.to_s)
      self.contents.font.color = disabled_color
      self.contents.draw_text(240, 288, self.width / 2, 32, "•" + $preview_objectives7.to_s)
      self.contents.draw_text(240, 256, self.width / 2, 32, "•" + $preview_objectives6.to_s)
      self.contents.draw_text(0, 416, self.width / 2, 32, "•" + $preview_objectives5.to_s)
      self.contents.draw_text(0, 384, self.width / 2, 32, "•" + $preview_objectives4.to_s)
      self.contents.draw_text(0, 352, self.width / 2, 32, "•" + $preview_objectives3.to_s)
      self.contents.draw_text(0, 320, self.width / 2, 32, "•" + $preview_objectives2.to_s)
      self.contents.draw_text(0, 288, self.width / 2, 32, "•" + $preview_objectives1.to_s)
      self.contents.draw_text(0, 256, self.width / 2, 32, "•" + $preview_objectives0.to_s)
    when 9
      self.contents.font.color = normal_color
      self.contents.draw_text(240, 352, self.width / 2, 32, "•" + $preview_objectives9.to_s)
      self.contents.font.color = disabled_color
      self.contents.draw_text(240, 320, self.width / 2, 32, "•" + $preview_objectives8.to_s)
      self.contents.draw_text(240, 288, self.width / 2, 32, "•" + $preview_objectives7.to_s)
      self.contents.draw_text(240, 256, self.width / 2, 32, "•" + $preview_objectives6.to_s)
      self.contents.draw_text(0, 416, self.width / 2, 32, "•" + $preview_objectives5.to_s)
      self.contents.draw_text(0, 384, self.width / 2, 32, "•" + $preview_objectives4.to_s)
      self.contents.draw_text(0, 352, self.width / 2, 32, "•" + $preview_objectives3.to_s)
      self.contents.draw_text(0, 320, self.width / 2, 32, "•" + $preview_objectives2.to_s)
      self.contents.draw_text(0, 288, self.width / 2, 32, "•" + $preview_objectives1.to_s)
      self.contents.draw_text(0, 256, self.width / 2, 32, "•" + $preview_objectives0.to_s)
    when 10
      self.contents.font.color = normal_color
      self.contents.draw_text(240, 384, self.width / 2, 32, "•" + $preview_objectives10.to_s)
      self.contents.font.color = disabled_color
      self.contents.draw_text(240, 352, self.width / 2, 32, "•" + $preview_objectives9.to_s)
      self.contents.draw_text(240, 320, self.width / 2, 32, "•" + $preview_objectives8.to_s)
      self.contents.draw_text(240, 288, self.width / 2, 32, "•" + $preview_objectives7.to_s)
      self.contents.draw_text(240, 256, self.width / 2, 32, "•" + $preview_objectives6.to_s)
      self.contents.draw_text(0, 416, self.width / 2, 32, "•" + $preview_objectives5.to_s)
      self.contents.draw_text(0, 384, self.width / 2, 32, "•" + $preview_objectives4.to_s)
      self.contents.draw_text(0, 352, self.width / 2, 32, "•" + $preview_objectives3.to_s)
      self.contents.draw_text(0, 320, self.width / 2, 32, "•" + $preview_objectives2.to_s)
      self.contents.draw_text(0, 288, self.width / 2, 32, "•" + $preview_objectives1.to_s)
      self.contents.draw_text(0, 256, self.width / 2, 32, "•" + $preview_objectives0.to_s)
    when 11
      self.contents.font.color = normal_color
      self.contents.draw_text(240, 416, self.width / 2, 32, "•" + $preview_objectives11.to_s)
      self.contents.font.color = disabled_color
      self.contents.draw_text(240, 384, self.width / 2, 32, "•" + $preview_objectives10.to_s)
      self.contents.draw_text(240, 352, self.width / 2, 32, "•" + $preview_objectives9.to_s)
      self.contents.draw_text(240, 320, self.width / 2, 32, "•" + $preview_objectives8.to_s)
      self.contents.draw_text(240, 288, self.width / 2, 32, "•" + $preview_objectives7.to_s)
      self.contents.draw_text(240, 256, self.width / 2, 32, "•" + $preview_objectives6.to_s)
      self.contents.draw_text(0, 416, self.width / 2, 32, "•" + $preview_objectives5.to_s)
      self.contents.draw_text(0, 384, self.width / 2, 32, "•" + $preview_objectives4.to_s)
      self.contents.draw_text(0, 352, self.width / 2, 32, "•" + $preview_objectives3.to_s)
      self.contents.draw_text(0, 320, self.width / 2, 32, "•" + $preview_objectives2.to_s)
      self.contents.draw_text(0, 288, self.width / 2, 32, "•" + $preview_objectives1.to_s)
      self.contents.draw_text(0, 256, self.width / 2, 32, "•" + $preview_objectives0.to_s)
    end
  end   
 
  def update
    refresh
  end
 
end
Symphony of Alderra : Memoirs of Life

Storyline : 200% (Overimaginatives)
Scripting : 100% (At last...)
Eventing  : 100%
Mapping   : 0.125%

modern algebra

#32
This is a great script. I know it's from a while back but I'd like to recommend it for Scripts Database. Any mods around?

Blizzard

#33
I'm in the credits? :o
Can't remember that I did something in this script. I only remember making you that other Quest logger, but I don't see any code from it in your script, lol! *moves*

EDIT:

I updated your first post, BTW. :)
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

Karo Rushe

Wondering...
How do I make it so when the Player finished the Quest it puts as Mission completed or something like that ?_?

modern algebra


Karo Rushe

Quote from: modern algebra on February 24, 2007, 04:50:48 AM
Quote from: Sthrattoff on January 12, 2007, 08:55:45 AM
# To end a quest, set the marker variable's value to 12


?_? The Marker Variable? I have to set in the Variable a 12?

modern algebra

yeah, $var_ID.push value identifies an in-game variable which is used to mark progress in a quest. i.e. if you put $var_ID.push 1, then variable 001 is used to mark progress.If you set that variable to 12, it should disable the quest. At least, that's what I understand from the instructions. It might be better if you ask Sthrattoff though, as he can help you better than I can.

Sthrattoff

#38
First of all, I apologize for my terrible English...
modern algebra is right!
Blizzard : Oh, perhaps you're forgot if you're teach me, not givin' the code.

And...
Here's the version 2.2!
#=============================================================================
# Quest Log Screen
#-----------------------------------------------------------------------------
# ** Version 2.2
# ** Original by Sthrattoff
#=============================================================================
# Description :
# This script enables the ability to show current active quest.

# Features :
# EXTREMELY SIMPLIFIED! Now the script is just about 150 lines length.
# Unlimited amount of quest can be added.
# Use variable to mark quest's progress.

# Limitation :
# Only can store up to 12 progress per quest.

# History :
# Version 1.0 : Initial release.
# Version 1.2 : Add "Types" features.
# Version 2.0 : Changes in programming style and infinite quest support.
# Version 2.2 : Cut the script length to about 150 lines.

# Instruction
# Just put this script above main.

# Configuration :
# To add a quest, fill these information by using .push
# $names.push "Name"
# $types.push "Type"
# $description.push (["line1", "line2", ..., "Line5"])
# $objectives.push (["onjective1", ..., "objective12"])
# $var_ID.push ID_NUMBER

# Credits
# See the header + Blizzard and Enterbrain
#=============================================================================

class Scene_Quest
 
  $names = []
  $types = []
  $description = []
  $objectives = []
  $var_ID = []
 
  def main
    @quest_list = Window_Command.new(160, $names)
    @quest_window = Window_Quest.new
    @quest_window.x = 160
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    @quest_list.dispose
    @quest_window.dispose
  end
 
  def update
    @quest_list.update
    @quest_window.update
    if @quest_list.active
      update_quest
      return
    end
  end
 
  def update_quest
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(2)
      return
    end
    $id = @quest_list.index
    return
  end
 
end   

class Window_Quest < Window_Base
 
  def initialize
    super(0, 0, 480, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
        self.contents.draw_text(0, 0, self.width - 32, 32, $names[$id.to_i].to_s, 1)
    self.contents.draw_text(0, 224, self.width - 32, 32, "Objectives", 1)
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 32, self.width - 32, 32, $types[$id.to_i].to_s, 1)
    for i in 0..4
      self.contents.draw_text(0, i * 32 + 64, self.width - 32, 32, $description[$id.to_i][i].to_s)
    end
    a = b = $game_variables[$var_ID[$id.to_i]]
    if a > 5
      self.contents.draw_text(240, (a - 6) * 32 + 256, 240, 32, "• " + $objectives[$id.to_i][a].to_s)
    else
      self.contents.draw_text(0, a * 32 + 256, 240, 32, "• " + $objectives[$id.to_i][a].to_s)
    end
    self.contents.font.color = disabled_color
    if b > 0
      for j in 0..(b - 1)
        if j > 5
          self.contents.draw_text(240, (j - 6) * 32 + 256, 240, 32, "• " + $objectives[$id.to_i][j].to_s)
        else
          self.contents.draw_text(0, j * 32 + 256, 240, 32, "• " + $objectives[$id.to_i][j].to_s)
        end
      end
    end
  end
 
  def update
    refresh
  end
 
end


And before you're call the script, use this :

size = $names.size
  for i in 0..size
    var = $var_ID[i]
    if $game_variables[var.to_i] >= 12
      $names.delete_at i
      $types.delete_at i
      $description.delete_at i
      $objectives.delete_at i
      $var_ID.delete_at i
    end
  end


Personally, I used this script on the initialize method on Scene_Menu.
And still... Set the variable to 12 to disable the quest.
Symphony of Alderra : Memoirs of Life

Storyline : 200% (Overimaginatives)
Scripting : 100% (At last...)
Eventing  : 100%
Mapping   : 0.125%

Blizzard

Awesome, you've shorten it even more! ;8
BTW, you don't need to give me credit for my help, lol!
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

Valcos

I used the other script of this..but now I dont know how to open the quest log ??? Also where do you put the  # $names.push "Name"   things?
Im to cool to have my own signature!!!

Karo Rushe

Quoteclass Scene_Quest
 
  $names = []
  $types = []
  $description = []
  $objectives = []
  $var_ID = []
 
My Question, is this the Configuartion part? For Each Quest? ???

Sion_Barzad

I don't understand ANY of it!  :'( :'( ???
Some help would be appericated!
Like, one time, I played RPG Maker, and I liked it.

Sthrattoff

#43
Example, if you want to add quest named "Welcome to the Black Parade", you must use this syntax

$names.push "Welcome to the Black Parade"

Information, Id of variable used to control quest progress must be saved on $var_ID

$var_ID 4 # 4 is the variable's id

To enter those code, use Call Script event command.
Symphony of Alderra : Memoirs of Life

Storyline : 200% (Overimaginatives)
Scripting : 100% (At last...)
Eventing  : 100%
Mapping   : 0.125%

Sthrattoff

#44
I found some bugs.
To fix it, please add this line on Scene_Save below the last line of Marshal.dump

Marshal.dump($names, file)
Marshal.dump($types, file)
Marshal.dump($description, file)
Marshal.dump($objectives, file)
Marshal.dump($var_ID, file)
Marshal.dump($end_val, file)


and this one below the last line of Marshal.load on Scene_Load

$names = Marshal.load(file)
$types = Marshal.load(file)
$description = Marshal.load(file)
$objectives = Marshal.load(file)
$var_ID = Marshal.load(file)
$end_val = Marshal.load(file)


and this one somewhere on new game method on Scene_Title

$names.clear
$types.clear
$description.clear
$objectives.clear
$var_ID.clear
$end_val.clear


Any question can be pointed to me or Blizzard.
It will fix when you play a new game...
Symphony of Alderra : Memoirs of Life

Storyline : 200% (Overimaginatives)
Scripting : 100% (At last...)
Eventing  : 100%
Mapping   : 0.125%

Blizzard

Hey, Sthrattoff, I have a better idea. Use the Game_System class for your extra variables. That way they'll get saved automatically. (~_^)d

[spoiler=Template for add stuff to Game_System]
class Game_System
 
  attr_accessor :better_than_another_global_number
  attr_accessor :better_than_another_global_string
  attr_accessor :better_than_another_global_boolean
  attr_accessor :better_than_another_global_array
 
  alias init_your_script_whatever initialize
  def initialize
    init_your_script_whatever
    @better_than_another_global_number = 12345
    @better_than_another_global_string = "54321"
    @better_than_another_global_boolean = true
    @better_than_another_global_array = [1, "That's", " ", "sweet.", true]
  end
 
end


Reference is of course $game_system.better_than_another_global_number, etc.
[/spoiler]
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

noian

would it be possible to add this to the menu somehow? (it probably is, but i have no idea how to)
>Current Project: Time Killer 2<
Description: Random, plotless project designed to kill spare time. No storyline, just a building to explore.

Status: Fascinated by how appalling the default database is balance wise.

modern algebra


Sthrattoff

Just open the menu script, find this code
s6=exit #Or whatever, I forgot
and add this line:
s7="quest"
on update command, below when 5's statement and end, add
when 6
$game_system.se_play($data_system.decision_se)
$scene=Scene_Quest.new

Still not understand? Ask blizzard. He explain better.
Symphony of Alderra : Memoirs of Life

Storyline : 200% (Overimaginatives)
Scripting : 100% (At last...)
Eventing  : 100%
Mapping   : 0.125%

Blizzard

In the tutorial section, stickied topic "Blizzard's little Tricks", look under 6. a) if you didn't get what Sthrathoff said.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!