collapse collapse

 Community


 User Info




Willkommen Gast. Bitte einloggen oder registrieren.

 Partnerseiten

rpgvx.net

Das Forum ist offline

Autor Thema: hellMinors Simple Questlog  (Gelesen 24873 mal)

Offline Onkel Hell

  • Sol Invictus
  • Administrator
  • VX-Kenner
  • ****
  • Beiträge: 562
  • You can't shoot me, I'm AIDS !
hellMinors Simple Questlog
« am: April 09, 2008, 13:34:11 »
Beschreibung
ich hab mir mal für meine zwecke ein kleines questlogbuch geschrieben , is jetz nich sonderlich aufwendig aber erfüllt gut seinen zweck denk ich ma

Last Update : v1.3a - 03.06.09
changelog
Spoiler for Hiden:
-----------------------------------------------------------------------------------
v1.3
-----------------------------------------------------------------------------------
bilder-bug bei verschlüsselten projekten gefixed
-----------------------------------------------------------------------------------
v1.2
-----------------------------------------------------------------------------------
quest-status wurde hinzufügt
es kann jetz optional ein quest status mit angegeben werden
dieser quest status kann mit $questlog.getQuestState abgefragt werden
wird kein status mit angegeben wird er automatisch auf leer gesetzt
-----------------------------------------------------------------------------------
v1.12
-----------------------------------------------------------------------------------
speicherbug und questmap bug gefixed
-----------------------------------------------------------------------------------
v1.0
-----------------------------------------------------------------------------------
ein kleiner versionssprung, also nicht wundern, will damit nur zeigen
dass das script keineswegs beta status oder so etwas hat
besserer schreib iterator
der fehler bei den umlauten wurde behoben und nun ist es auch möglich
bilder zu den quests anzeigen zu lassen,
wie das geht steht in der FAQ
-----------------------------------------------------------------------------------
v0.1.1
-----------------------------------------------------------------------------------
kleiner bugfix und man kann jetz die schriftgröße des quest fensters
über SIZE_VAR einstellen
-----------------------------------------------------------------------------------
v0.1
-----------------------------------------------------------------------------------
erster public release

Screenshots
Spoiler for Hiden:



Anleitung
Wie immer gibts nich viel zu erklären
#==============================================================================
# F.A.Q.
#==============================================================================
# Der Globale Questlogname ist $questlog
# Um das Questlog vom Menu zu öffnen einfach $scene = Scene_Questlog.new ausführen
# Um das Questlog von einem Event zu öffnen $scene = Scene_Questlog.new(false) ausführen
#
# Um eine Quest zu erstellen kann man dieses Template benutzen :
# $questlog.addQuest("Unique ID","Quest Titel","Quest Beschreibung")
#
# Um eine Questbeschreibung zu updaten kann man dieses Template benutzen :
# $questlog.updateQuest("unique ID","Quest Description")
#
# Um eine Quest zu den abgeschlossenen Quests zu schieben kann man dieses Template benutzen :
# $questlog.completeQuest("Unique ID")
#
# Um eine Quest aus den aktiven Quests zu löschen kann man dieses Template benutzen :
# $questlog.deleteQuest("Unique ID")
#
# Du kannst den aktuell Quest-Status abfragen mit diesem Template :
# $questlog.getQuestState("Unique ID")
# Das kann eventuell nützlich sein in einem Conditional Branch damit ein Event
# nur bei einem bestimmten Quest-Status auslöst
#
# Wenn ihr eine Questkarte hinzufügen wollt, erstellt einen order namens
# Questmaps in eurem Graphics Verzeichnis. Der Name der Questkarte muss
# dem Questnamen im Spiel entsprechen. Seit auch sicher dass das richtige
# Format in der MAP_FORMAT gewählt wurde.
# Die Questkarten sollten eine gräße vom 265*200 pixel haben.
# z.B. : Wenn du eine Quest names QuestXYZ hast muss das bild im Questmaps
# Verzeichnis QuestXYZ.png heißen wenn png das format ist
#==============================================================================
# Setup
#==============================================================================
QUESTLOGNAME = "Questlog"               # Questlog Menü name
QUEST_MENU_ITEM_1 = "Active Quests"     # Active Quest name
QUEST_MENU_ITEM_2 = "Completed Quests"  # Completed Quest name
SIZE_VAR = 20                           # Schriftgröße
MAP_FORMAT = "png"                      # Quest-Map format/endung

Script v1.3a
Spoiler for Hiden:
#==============================================================================
#  Simple Quest-Log
#
#  Version : 1.3a - 04.04.08
#  Created by : hellMinor
#  Do NOT redistribute without my permission
#  Description : A simple script for a Quest-Log
#
#==============================================================================
#==============================================================================
# F.A.Q.
#==============================================================================
# The Global Questlog-Name is $questlog
# To open the Questlog from the menu just do $scene = Scene_Questlog.new
# To open the Questlog from an event $scene = Scene_Questlog.new(false)
#
# To add a quest make a new call script with this Template :
# $questlog.addQuest("Unique ID","Quest Title","Quest Description","State")
#
# To update a Quest description make a new call script with this Template :
# $questlog.updateQuest("unique ID","Quest Description","State")
#
# To move a Quest to Completed Quests make new call script with this Template :
# $questlog.completeQuest("Unique ID")
#
# To delete a Quest from the Active-Questlog make a call script with this
# Template :
# $questlog.deleteQuest("Unique ID")
#
# You can get the current state of a Quest with this Template :
# $questlog.getQuestState("Unique ID")
# This may be useful in a conditional branch if you want to react with a
# special Quest-State
#
# If u want to add a Questmap, create a folder named Questmaps in your
# Graphics folder. The name of the Questmap must be the same as the Quest
# in the Game. Be sure that you set the correct MAP_FORMAT.
# A Quest-Map should have a size of 265*200 px !
# I.E. : If your Quest is named QuestYXZ , the picture in the Questmap folder
# has to be QuestYXZ.png if your map is a .png
#==============================================================================
# Setup
#==============================================================================
QUESTLOGNAME = "Questlog"               # Questlog Menu name
QUEST_MENU_ITEM_1 = "Active Quests"     # Active Quest name
QUEST_MENU_ITEM_2 = "Completed Quests"  # Completed Quest name
SIZE_VAR = 20                           # Character Size
MAP_FORMAT = "png"                      # Quest-Map Ending
#==============================================================================
class Questlog
#==============================================================================
  def addQuest(id,header,description,state = "")
    $activelog << [id,header,description,state]
  end
#------------------------------------------------------------------------------ 
  def updateQuest(id,description,state = "")
    for i in 0..$activelog.size-1
      if $activelog[i][0] == id
        $activelog[i][2] = description
        $activelog[i][3] = state
        break
      end
    end
  end
#------------------------------------------------------------------------------
  def completeQuest(id)
    for i in 0..$activelog.size-1
      if $activelog[i][0] == id
        $completedlog << $activelog[i]
        $activelog.delete_at(i)
        break
      end
    end
  end
#------------------------------------------------------------------------------
  def deleteQuest(id)
    for i in 0..$activelog.size-1
      if $activelog[i][0] == id
        $activelog.delete_at(i)
        break
      end
    end
  end
#------------------------------------------------------------------------------
  def getQuestState(id)
    for i in 0..$activelog.size-1
      if $activelog[i][0] == id
        return $activelog[i][3]
        break
      end
    end
  end
 
end
#==============================================================================
class Scene_Questlog < Scene_Base
#==============================================================================
  def initialize(from_menu = true)
    @from_menu = from_menu
  end
 
  def start
    super
    create_menu_background
    @help_window = Window_Help.new
    @help_window.set_text(QUESTLOGNAME,1)
   
    s1 = QUEST_MENU_ITEM_1
    s2 = QUEST_MENU_ITEM_2
   
    @select_window = Window_Command.new(544,[s1,s2],2,1)
    @select_window.y = 55
    @select_window.active = true
   
  end
#------------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @help_window.dispose
    @select_window.dispose
  end
#------------------------------------------------------------------------------ 
  def kill_questwindows
    @quest_window.dispose
  end 
#------------------------------------------------------------------------------
  def return_scene
    if @from_menu
      $scene = Scene_Menu.new
    else
      $scene = Scene_Map.new
    end
  end
#------------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @help_window.update
    if @select_window.active
      @select_window.update
      update_select_selection
    elsif @quest_window.active
      @quest_window.update
      update_quest_selection
    end
  end
#------------------------------------------------------------------------------
  def update_select_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      case @select_window.index
      when 0
        $oldlog = false
        @quest_window = Window_Quest.new(0,110,272,(24*11)+42)
        @select_window.active = false
        @quest_window.active = true
      when 1
        $oldlog = true
        @quest_window = Window_Quest.new(0,110,272,(24*11)+42)
        @select_window.active = false
        @quest_window.active = true
      end     
    end
  end
#------------------------------------------------------------------------------ 
  def update_quest_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      kill_questwindows
      @select_window.active = true
    end
  end

end
#==============================================================================
class Scene_Title < Scene_Base
#==============================================================================
  alias create_game_objects_additions create_game_objects
  def create_game_objects
    create_game_objects_additions
    $questlog = Questlog.new
    $activelog = Array.new
    $completedlog = Array.new
  end
 
end
#==============================================================================
class Window_Help < Window_Base
#==============================================================================
  def initialize(x = 0,y = 0, width = 544, height = WLH+32)
    super(x, y, width, height)
  end
 
end
#==============================================================================
class Window_Description < Window_Base
#==============================================================================
  def initialize(x = 0,y = 0, width = 544, height = WLH+32)
    super(x, y, width, height)
    @text = nil
    @contents_x = 0
    @contents_y = 0
    @line_count = 0             # Line count drawn up until now
    update
  end
#------------------------------------------------------------------------------ 
  def new_line
    @contents_x = 0
    @contents_y += WLH
    @line_count += 1
    @line_show_fast = false
  end
#------------------------------------------------------------------------------ 
  def finish_message
    @text = nil
    @line_count = 0
    @contents_x = 0
    @contents_y = 0
  end
#------------------------------------------------------------------------------ 
  def write_text(str)
    if str != nil || str != ""
      create_contents
      update_msg(str)
    end
  end
#------------------------------------------------------------------------------ 
  def update_msg(str)
    str.each_line{|str2|iterator(str2)}
    finish_message
  end
#------------------------------------------------------------------------------   
  def iterator(str2)
    contents.font.size = SIZE_VAR
    contents.draw_text(@contents_x, @contents_y, str2.size*40, WLH, str2.delete("\n"))
    c_width = contents.text_size(str2).width
    @contents_x += c_width
    new_line
  end
 
end
#==============================================================================
class Window_Quest < Window_Selectable
#==============================================================================
  def initialize(x, y, width, height)
    super(x, y, width, height)
    @column_max = 1
    self.index = 0
   
    @quest_helper = Window_Description.new(271,110,273,(24*11)+42)
   
    refresh
  end
#------------------------------------------------------------------------------
  def refresh
    @data = []
    if !$oldlog
      for i in (0..$activelog.size-1)
        @data.push($activelog[i])
      end
    else
      for i in (0..$completedlog.size-1)
        @data.push($completedlog[i])
      end
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
#------------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index][1]
    if item != nil
      rect.width -= 4
      self.contents.draw_text(rect.x, rect.y, 172, WLH, item)
    end
  end
#------------------------------------------------------------------------------
  alias update_addition update
  def update
    update_addition
    update_description(@index)
    update_selection
  end
#------------------------------------------------------------------------------
  def update_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @quest_helper.dispose
      if @quest_map != nil
        @quest_map_bitmap.bitmap.dispose
        @quest_map_bitmap.dispose
        @quest_map.dispose
        @quest_map_viewport.dispose
        @quest_map = nil
      end
    end
  end
#------------------------------------------------------------------------------   
  def update_description(id)
    if defined?(@data[id][2])
      @quest_helper.write_text(@data[id][2])
      if @quest_map == nil
        if Cache.questmaps(@data[id][1]).is_a?(Bitmap)
          self.height /= 3
          @quest_map = Window_Description.new(0,210,272,(24*7)+38)
          @quest_map_bitmap = Sprite.new
          @quest_map_viewport = Viewport.new(3,213,268,(24*7)+35)
          @quest_map_bitmap.viewport = @quest_map_viewport
          @quest_map_bitmap.bitmap = Cache.questmaps(@data[id][1])
          @quest_map_bitmap.viewport.z = 150
        end
      else
        if Cache.questmaps(@data[id][1]).is_a?(Bitmap)
          @quest_map_bitmap.bitmap = Cache.questmaps(@data[id][1])
        else
          self.height *= 3
          @quest_map_bitmap.bitmap.dispose
          @quest_map_bitmap.dispose
          @quest_map.dispose
          @quest_map_viewport.dispose
          @quest_map = nil
        end
      end
     
    end
  end
 
end
#==============================================================================
class Scene_File < Scene_Base
#==============================================================================
  alias write_save_data_adds write_save_data
  def write_save_data(file)
    write_save_data_adds(file)   
    Marshal.dump($activelog,           file)
    Marshal.dump($completedlog,        file)
    Marshal.dump($questlog,            file)
  end
 
  alias read_save_data_adds read_save_data
  def read_save_data(file)
    read_save_data_adds(file)
    $activelog           = Marshal.load(file)
    $completedlog        = Marshal.load(file)
    $questlog            = Marshal.load(file)
  end
end
#==============================================================================
module Cache
#============================================================================== 
  def self.questmaps(filename)
    begin
      load_bitmap("Graphics/Questmaps/", filename)
    rescue
      return nil
    end
  end
 
end

Script v1.2
Spoiler for Hiden:
#==============================================================================
#  Simple Quest-Log
#
#  Version : 1.2 - 02.04.08
#  Created by : hellMinor
#  Do NOT redistribute without my permission
#  Description : A simple script for a Quest-Log
#
#==============================================================================
#==============================================================================
# F.A.Q.
#==============================================================================
# The Global Questlog-Name is $questlog
# To open the Questlog from the menu just do $scene = Scene_Questlog.new
# To open the Questlog from an event $scene = Scene_Questlog.new(false)
#
# To add a quest make a new call script with this Template :
# $questlog.addQuest("Unique ID","Quest Title","Quest Description","State")
#
# To update a Quest description make a new call script with this Template :
# $questlog.updateQuest("unique ID","Quest Description","State")
#
# To move a Quest to Completed Quests make new call script with this Template :
# $questlog.completeQuest("Unique ID")
#
# To delete a Quest from the Active-Questlog make a call script with this
# Template :
# $questlog.deleteQuest("Unique ID")
#
# You can get the current state of a Quest with this Template :
# $questlog.getQuestState("Unique ID")
# This may be useful in a conditional branch if you want to react with a
# special Quest-State
#
# If u want to add a Questmap, create a folder named Questmaps in your
# Graphics folder. The name of the Questmap must be the same as the Quest
# in the Game. Be sure that you set the correct MAP_FORMAT.
# A Quest-Map should have a size of 265*200 px !
# I.E. : If your Quest is named QuestYXZ , the picture in the Questmap folder
# has to be QuestYXZ.png if your map is a .png
#==============================================================================
# Setup
#==============================================================================
QUESTLOGNAME = "Questlog"               # Questlog Menu name
QUEST_MENU_ITEM_1 = "Active Quests"     # Active Quest name
QUEST_MENU_ITEM_2 = "Completed Quests"  # Completed Quest name
SIZE_VAR = 20                           # Character Size
MAP_FORMAT = "png"                      # Quest-Map Ending
#==============================================================================
class Questlog
#==============================================================================
  def addQuest(id,header,description,state = "")
    $activelog << [id,header,description,state]
  end
#------------------------------------------------------------------------------ 
  def updateQuest(id,description,state = "")
    for i in 0..$activelog.size-1
      if $activelog[i][0] == id
        $activelog[i][2] = description
        $activelog[i][3] = state
        break
      end
    end
  end
#------------------------------------------------------------------------------
  def completeQuest(id)
    for i in 0..$activelog.size-1
      if $activelog[i][0] == id
        $completedlog << $activelog[i]
        $activelog.delete_at(i)
        break
      end
    end
  end
#------------------------------------------------------------------------------
  def deleteQuest(id)
    for i in 0..$activelog.size-1
      if $activelog[i][0] == id
        $activelog.delete_at(i)
        break
      end
    end
  end
#------------------------------------------------------------------------------
  def getQuestState(id)
    for i in 0..$activelog.size-1
      if $activelog[i][0] == id
        return $activelog[i][3]
        break
      end
    end
  end
 
end
#==============================================================================
class Scene_Questlog < Scene_Base
#==============================================================================
  def initialize(from_menu = true)
    @from_menu = from_menu
  end
 
  def start
    super
    create_menu_background
    @help_window = Window_Help.new
    @help_window.set_text(QUESTLOGNAME,1)
   
    s1 = QUEST_MENU_ITEM_1
    s2 = QUEST_MENU_ITEM_2
   
    @select_window = Window_Command.new(544,[s1,s2],2,1)
    @select_window.y = 55
    @select_window.active = true
   
  end
#------------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @help_window.dispose
    @select_window.dispose
  end
#------------------------------------------------------------------------------ 
  def kill_questwindows
    @quest_window.dispose
  end 
#------------------------------------------------------------------------------
  def return_scene
    if @from_menu
      $scene = Scene_Menu.new
    else
      $scene = Scene_Map.new
    end
  end
#------------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @help_window.update
    if @select_window.active
      @select_window.update
      update_select_selection
    elsif @quest_window.active
      @quest_window.update
      update_quest_selection
    end
  end
#------------------------------------------------------------------------------
  def update_select_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      case @select_window.index
      when 0
        $oldlog = false
        @quest_window = Window_Quest.new(0,110,272,(24*11)+42)
        @select_window.active = false
        @quest_window.active = true
      when 1
        $oldlog = true
        @quest_window = Window_Quest.new(0,110,272,(24*11)+42)
        @select_window.active = false
        @quest_window.active = true
      end     
    end
  end
#------------------------------------------------------------------------------ 
  def update_quest_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      kill_questwindows
      @select_window.active = true
    end
  end

end
#==============================================================================
class Scene_Title < Scene_Base
#==============================================================================
  alias create_game_objects_additions create_game_objects
  def create_game_objects
    create_game_objects_additions
    $questlog = Questlog.new
    $activelog = Array.new
    $completedlog = Array.new
  end
 
end
#==============================================================================
class Window_Help < Window_Base
#==============================================================================
  def initialize(x = 0,y = 0, width = 544, height = WLH+32)
    super(x, y, width, height)
  end
 
end
#==============================================================================
class Window_Description < Window_Base
#==============================================================================
  def initialize(x = 0,y = 0, width = 544, height = WLH+32)
    super(x, y, width, height)
    @text = nil
    @contents_x = 0
    @contents_y = 0
    @line_count = 0             # Line count drawn up until now
    update
  end
#------------------------------------------------------------------------------ 
  def new_line
    @contents_x = 0
    @contents_y += WLH
    @line_count += 1
    @line_show_fast = false
  end
#------------------------------------------------------------------------------ 
  def finish_message
    @text = nil
    @line_count = 0
    @contents_x = 0
    @contents_y = 0
  end
#------------------------------------------------------------------------------ 
  def write_text(str)
    if str != nil || str != ""
      create_contents
      update_msg(str)
    end
  end
#------------------------------------------------------------------------------ 
  def update_msg(str)
    str.each_line{|str2|iterator(str2)}
    finish_message
  end
#------------------------------------------------------------------------------   
  def iterator(str2)
    contents.font.size = SIZE_VAR
    contents.draw_text(@contents_x, @contents_y, str2.size*40, WLH, str2.delete("\n"))
    c_width = contents.text_size(str2).width
    @contents_x += c_width
    new_line
  end
 
end
#==============================================================================
class Window_Quest < Window_Selectable
#==============================================================================
  def initialize(x, y, width, height)
    super(x, y, width, height)
    @column_max = 1
    self.index = 0
   
    @quest_helper = Window_Description.new(271,110,273,(24*11)+42)
   
    refresh
  end
#------------------------------------------------------------------------------
  def refresh
    @data = []
    if !$oldlog
      for i in (0..$activelog.size-1)
        @data.push($activelog[i])
      end
    else
      for i in (0..$completedlog.size-1)
        @data.push($completedlog[i])
      end
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
#------------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index][1]
    if item != nil
      rect.width -= 4
      self.contents.draw_text(rect.x, rect.y, 172, WLH, item)
    end
  end
#------------------------------------------------------------------------------
  alias update_addition update
  def update
    update_addition
    update_description(@index)
    update_selection
  end
#------------------------------------------------------------------------------
  def update_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @quest_helper.dispose
      if @quest_map != nil
        @quest_map_bitmap.bitmap.dispose
        @quest_map_bitmap.dispose
        @quest_map.dispose
        @quest_map_viewport.dispose
        @quest_map = nil
      end
    end
  end
#------------------------------------------------------------------------------   
  def update_description(id)
    if defined?(@data[id][2])
      @quest_helper.write_text(@data[id][2])
      if @quest_map == nil
        if File.exist?("Graphics/Questmaps/"+@data[id][1]+"."+MAP_FORMAT)
          self.height /= 3
          @quest_map = Window_Description.new(0,210,272,(24*7)+38)
          @quest_map_bitmap = Sprite.new
          @quest_map_viewport = Viewport.new(3,213,268,(24*7)+35)
          @quest_map_bitmap.viewport = @quest_map_viewport
          @quest_map_bitmap.bitmap = Cache.questmaps(@data[id][1])
          @quest_map_bitmap.viewport.z = 150
        end
      else
        if File.exist?("Graphics/Questmaps/"+@data[id][1]+"."+MAP_FORMAT)
          @quest_map_bitmap.bitmap = Cache.questmaps(@data[id][1])
        else
          self.height *= 3
          @quest_map_bitmap.bitmap.dispose
          @quest_map_bitmap.dispose
          @quest_map.dispose
          @quest_map_viewport.dispose
          @quest_map = nil
        end
      end
    end
  end
 
end
#==============================================================================
class Scene_File < Scene_Base
#==============================================================================
  alias write_save_data_adds write_save_data
  def write_save_data(file)
    write_save_data_adds(file)   
    Marshal.dump($activelog,           file)
    Marshal.dump($completedlog,        file)
    Marshal.dump($questlog,            file)
  end
 
  alias read_save_data_adds read_save_data
  def read_save_data(file)
    read_save_data_adds(file)
    $activelog           = Marshal.load(file)
    $completedlog        = Marshal.load(file)
    $questlog            = Marshal.load(file)
  end
end
#==============================================================================
module Cache
#============================================================================== 
  def self.questmaps(filename)
    load_bitmap("Graphics/Questmaps/", filename)
  end
 
end
Script v1.12
Spoiler for Hiden:
#==============================================================================
#  Simple Quest-Log
#
#  Version : 1.12 - 26.04.08
#  Created by : hellMinor
#  Do NOT redistribute without my permission
#  Description : A simple script for a Quest-Log
#
#==============================================================================
#==============================================================================
# F.A.Q.
#==============================================================================
# The Global Questlog-Name is $questlog
# To open the Questlog from the menu just do $scene = Scene_Questlog.new
# To open the Questlog from an event $scene = Scene_Questlog.new(false)
#
# To add a quest make a new call script with this Template :
# $questlog.addQuest("Unique ID","Quest Title","Quest Description")
#
# To update a Quest description make a new call script with this Template :
# $questlog.updateQuest("unique ID","Quest Description")
#
# To move a Quest to Completed Quests make new call script with this Template :
# $questlog.completeQuest("Unique ID")
#
# To delete a Quest from the Active-Questlog make a call script with this
# Template :
# $questlog.deleteQuest("Unique ID")
#
# If u want to add a Questmap, create a folder named Questmaps in your
# Graphics folder. The name of the Questmap must be the same as the Quest
# in the Game. Be sure that you set the correct MAP_FORMAT.
# A Quest-Map should have a size of 265*200 px !
# I.E. : If your Quest is named QuestYXZ , the picture in the Questmap folder
# has to be QuestYXZ.png if your map is a .png
#==============================================================================
# Setup
#==============================================================================
QUESTLOGNAME = "Questlog"               # Questlog Menu name
QUEST_MENU_ITEM_1 = "Active Quests"     # Active Quest name
QUEST_MENU_ITEM_2 = "Completed Quests"  # Completed Quest name
SIZE_VAR = 20                           # Character Size
MAP_FORMAT = "png"                      # Quest-Map Ending
#==============================================================================
class Questlog
#==============================================================================

#------------------------------------------------------------------------------ 
  def addQuest(id,header,description)
    $activelog << [id,header,description]
  end
#------------------------------------------------------------------------------ 
  def updateQuest(id,description)
    for i in 0..$activelog.size-1
      if $activelog[i][0] == id
        $activelog[i][2] = description
        break
      end
    end
  end
#------------------------------------------------------------------------------ 
  def completeQuest(id)
    for i in 0..$activelog.size-1
      if $activelog[i][0] == id
        $completedlog << $activelog[i]
        $activelog.delete_at(i)
        break
      end
    end
  end
#------------------------------------------------------------------------------
  def deleteQuest(id)
    for i in 0..$activelog.size-1
      if $activelog[i][0] == id
        $activelog.delete_at(i)
        break
      end
    end
  end
 
end
#==============================================================================
class Scene_Questlog < Scene_Base
#==============================================================================
  def initialize(from_menu = true)
    @from_menu = from_menu
  end
 
  def start
    super
    create_menu_background
    @help_window = Window_Help.new
    @help_window.set_text(QUESTLOGNAME,1)
   
    s1 = QUEST_MENU_ITEM_1
    s2 = QUEST_MENU_ITEM_2
   
    @select_window = Window_Command.new(544,[s1,s2],2,1)
    @select_window.y = 55
    @select_window.active = true
   
  end
#------------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @help_window.dispose
    @select_window.dispose
  end
#------------------------------------------------------------------------------ 
  def kill_questwindows
    @quest_window.dispose
  end 
#------------------------------------------------------------------------------
  def return_scene
    if @from_menu
      $scene = Scene_Menu.new
    else
      $scene = Scene_Map.new
    end
  end
#------------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @help_window.update
    if @select_window.active
      @select_window.update
      update_select_selection
    elsif @quest_window.active
      @quest_window.update
      update_quest_selection
    end
  end
#------------------------------------------------------------------------------
  def update_select_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      case @select_window.index
      when 0
        $oldlog = false
        @quest_window = Window_Quest.new(0,110,272,(24*11)+42)
        @select_window.active = false
        @quest_window.active = true
      when 1
        $oldlog = true
        @quest_window = Window_Quest.new(0,110,272,(24*11)+42)
        @select_window.active = false
        @quest_window.active = true
      end     
    end
  end
#------------------------------------------------------------------------------ 
  def update_quest_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      kill_questwindows
      @select_window.active = true
    end
  end

end
#==============================================================================
class Scene_Title < Scene_Base
#==============================================================================
  alias create_game_objects_additions create_game_objects
  def create_game_objects
    create_game_objects_additions
    $questlog = Questlog.new
    $activelog = Array.new
    $completedlog = Array.new
  end
 
end
#==============================================================================
class Window_Help < Window_Base
#==============================================================================
  def initialize(x = 0,y = 0, width = 544, height = WLH+32)
    super(x, y, width, height)
  end
 
end
#==============================================================================
class Window_Description < Window_Base
#==============================================================================
  def initialize(x = 0,y = 0, width = 544, height = WLH+32)
    super(x, y, width, height)
    @text = nil
    @contents_x = 0
    @contents_y = 0
    @line_count = 0             # Line count drawn up until now
    update
  end
#------------------------------------------------------------------------------ 
  def new_line
    @contents_x = 0
    @contents_y += WLH
    @line_count += 1
    @line_show_fast = false
  end
#------------------------------------------------------------------------------ 
  def finish_message
    @text = nil
    @line_count = 0
    @contents_x = 0
    @contents_y = 0
  end
#------------------------------------------------------------------------------ 
  def write_text(str)
    if str != nil || str != ""
      create_contents
      update_msg(str)
    end
  end
#------------------------------------------------------------------------------ 
  def update_msg(str)
    str.each_line{|str2|iterator(str2)}
    finish_message
  end
#------------------------------------------------------------------------------   
  def iterator(str2)
    contents.font.size = SIZE_VAR
    contents.draw_text(@contents_x, @contents_y, str2.size*40, WLH, str2.delete("\n"))
    c_width = contents.text_size(str2).width
    @contents_x += c_width
    new_line
  end
 
end
#==============================================================================
class Window_Quest < Window_Selectable
#==============================================================================
  def initialize(x, y, width, height)
    super(x, y, width, height)
    @column_max = 1
    self.index = 0
   
    @quest_helper = Window_Description.new(271,110,273,(24*11)+42)
   
    refresh
  end
#------------------------------------------------------------------------------
  def refresh
    @data = []
    if !$oldlog
      for i in (0..$activelog.size-1)
        @data.push($activelog[i])
      end
    else
      for i in (0..$completedlog.size-1)
        @data.push($completedlog[i])
      end
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
#------------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index][1]
    if item != nil
      rect.width -= 4
      self.contents.draw_text(rect.x, rect.y, 172, WLH, item)
    end
  end
#------------------------------------------------------------------------------
  alias update_addition update
  def update
    update_addition
    update_description(@index)
    update_selection
  end
#------------------------------------------------------------------------------
  def update_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @quest_helper.dispose
      if @quest_map != nil
        @quest_map_bitmap.bitmap.dispose
        @quest_map_bitmap.dispose
        @quest_map.dispose
        @quest_map_viewport.dispose
        @quest_map = nil
      end
    end
  end
#------------------------------------------------------------------------------   
  def update_description(id)
    if defined?(@data[id][2])
      @quest_helper.write_text(@data[id][2])
      if @quest_map == nil
        if File.exist?("Graphics/Questmaps/"+@data[id][1]+"."+MAP_FORMAT)
          self.height /= 3
          @quest_map = Window_Description.new(0,210,272,(24*7)+38)
          @quest_map_bitmap = Sprite.new
          @quest_map_viewport = Viewport.new(3,213,268,(24*7)+35)
          @quest_map_bitmap.viewport = @quest_map_viewport
          @quest_map_bitmap.bitmap = Cache.questmaps(@data[id][1])
          @quest_map_bitmap.viewport.z = 150
        end
      else
        if File.exist?("Graphics/Questmaps/"+@data[id][1]+"."+MAP_FORMAT)
          @quest_map_bitmap.bitmap = Cache.questmaps(@data[id][1])
        else
          self.height *= 3
          @quest_map_bitmap.bitmap.dispose
          @quest_map_bitmap.dispose
          @quest_map.dispose
          @quest_map_viewport.dispose
          @quest_map = nil
        end
      end
    end
  end
 
end
#==============================================================================
class Scene_File < Scene_Base
#==============================================================================
  alias write_save_data_adds write_save_data
  def write_save_data(file)
    write_save_data_adds(file)   
    Marshal.dump($activelog,           file)
    Marshal.dump($completedlog,        file)
  end
 
  alias read_save_data_adds read_save_data
  def read_save_data(file)
    read_save_data_adds(file)
    $activelog           = Marshal.load(file)
    $completedlog        = Marshal.load(file)
  end
end
#==============================================================================
module Cache
#============================================================================== 
  def self.questmaps(filename)
    load_bitmap("Graphics/Questmaps/", filename)
  end
 
end

Beispiel um das Questlog zum Menü zu adden
Scene_Menu von Evil95
Spoiler for Hiden:
#==============================================================================
# ** Scene_Menu_for_Simple_Questlog_by_Evil95
#------------------------------------------------------------------------------
#  This class performs the menu screen processing.
#==============================================================================
class Scene_Menu < Scene_Base
  def create_command_window
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s7 = "Questlog"
    s5 = Vocab::save
    s6 = Vocab::game_end
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s7, s5, s6])
    @command_window.index = @menu_index
    if $game_party.members.size == 0          # If number of party members is 0
      @command_window.draw_item(0, false)     # Disable item
      @command_window.draw_item(1, false)     # Disable skill
      @command_window.draw_item(2, false)     # Disable equipment
      @command_window.draw_item(3, false)     # Disable status
    end
    if $game_system.save_disabled             # If save is forbidden
      @command_window.draw_item(4, false)     # Disable save
    end
  end
  #--------------------------------------------------------------------------
  # * Update Command Selection
  #--------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      if $game_party.members.size == 0 and @command_window.index < 4
        Sound.play_buzzer
        return
      elsif $game_system.save_disabled and @command_window.index == 4
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      case @command_window.index
      when 0      # Item
        $scene = Scene_Item.new
      when 1,2,3  # Skill, equipment, status
        start_actor_selection
      when 5      # Save
        $scene = Scene_File.new(true, false, false)
      when 6      # End Game
        $scene = Scene_End.new
      when 4
        $scene = Scene_Questlog.new
      end
    end
  end
end
class Scene_File < Scene_Base
  def return_scene
    if @from_title
      $scene = Scene_Title.new
    elsif @from_event
      $scene = Scene_Map.new
    else
      $scene = Scene_Menu.new(5)
    end
  end
end

class Scene_End < Scene_Base
  def return_scene
    $scene = Scene_Menu.new(6)
  end
end

class Scene_Questlog < Scene_Base
  def return_scene
    if @from_menu
      $scene = Scene_Menu.new(4)
    else
      $scene = Scene_Map.new
    end
  end
end
« Letzte Änderung: März 28, 2010, 03:33:04 von Ðeity »
Verborgen in der Dunkelheit
Ich kenne nur die Einsamkeit
Auf das kein Gott mich sieht, ich bin ein Eremit


Mega Man Battle Engine


hellMinors Simple Questlog

Offline Silvanus

  • Der längste regestrierte User hier xD
  • VX-Großmeister
  • *****
  • Beiträge: 984
  • Makerer im Ruhezustand
hellMinors Simple Questlog
« Antwort #1 am: April 09, 2008, 14:04:54 »
Hab schon eins gesucht =)
Mal schauen ob iche s verwenden werde ;)
BIG THX!

hellMinors Simple Questlog

Dainreth

  • Gast
hellMinors Simple Questlog
« Antwort #2 am: April 09, 2008, 14:30:51 »
Na das sieht doch schon richtig nett aus hM, schlicht, aber erfüllt seinen Zweck.
Ist es auch möglich, eine Anzeige von Pictures reinzubringen, die möglicherweise als Hilfestellung für einen Quest dienen?

hellMinors Simple Questlog

Offline eugene222

  • König der Lügner
  • VX-Meister
  • ****
  • Beiträge: 675
hellMinors Simple Questlog
« Antwort #3 am: April 09, 2008, 15:18:33 »
wow, ich glaub, dass ich es benutzen werde, echt cool.

hellMinors Simple Questlog

Angelos

  • Gast
hellMinors Simple Questlog
« Antwort #4 am: April 09, 2008, 15:19:40 »
Das sieht echt cool aus, werde es mal ausprobieren und wens mir gefällt werde es das wohl auch benutzen :)

Nice Work  excl.gif\" style=\"vertical-align:middle\" emoid=\":excl:\" border=\"0\" alt=\"excl.gif\" /]

hellMinors Simple Questlog

Offline Herendil

  • Jarl Turindo
  • Moderator
  • Mr. MACK-Tile
  • ***
  • Beiträge: 283
  • Jarl Turindo
hellMinors Simple Questlog
« Antwort #5 am: April 09, 2008, 15:26:00 »
sehr schön endlich hab ich ne verwendung für das über flüßige 'status' im menu hoffendlich klappt das mit den überschreiben

edit: hat geklappt! ich freue mich so! danke hM

edit vom edit: ich habe das verbesserte menu also wo man exp und so auf der hauptseite sieht.
« Letzte Änderung: April 09, 2008, 15:29:41 von Herendil »

hellMinors Simple Questlog

Onkel Hans

  • Gast
hellMinors Simple Questlog
« Antwort #6 am: April 09, 2008, 16:42:24 »
Herendil, könntest du mir vielleicht erklären wie ich das "Status" Menü überschreiben kann? Wäre echt nett von dir, bin nämlich ein Vollblut-Noob in Sachen Scripts!  :lol:

hellMinors Simple Questlog

Offline Onkel Hell

  • Sol Invictus
  • Administrator
  • VX-Kenner
  • ****
  • Beiträge: 562
  • You can't shoot me, I'm AIDS !
hellMinors Simple Questlog
« Antwort #7 am: April 09, 2008, 16:57:58 »
könnt noch den code adden um das direkt ins menü zu pappen bzw ein tut schreiben wie man custom menu commands setzt wenns paar brauchen

@dainreth : wie meinst du das genau mit den pictures? zb ne landkarte wo gezeigt wird wo man hin muss? theoretisch schon, könnt ich bissl umbauen dann könnt ich noch ein kleines window fürn pic adden
Verborgen in der Dunkelheit
Ich kenne nur die Einsamkeit
Auf das kein Gott mich sieht, ich bin ein Eremit


Mega Man Battle Engine


hellMinors Simple Questlog

ERZENGEL

  • Gast
hellMinors Simple Questlog
« Antwort #8 am: April 09, 2008, 17:03:45 »
Er meint es wohl so:
Spoiler for Hiden:
Jedoch wenn du damit anfängst es einzubauen, will jeder ein Feature (z.B. die Textbefehle \v[n] benützen in der Beschreibung oder Icons wie auf dem Bild vor dem Titel der Quest) und dann ist es  ja nicht mehr simpel? Heißt jetzt aber nicht, dass ich was dagegen habe, würde mich sogar sehr darüber freuen :)
« Letzte Änderung: April 09, 2008, 17:04:58 von ERZENGEL »

hellMinors Simple Questlog

Onkel Hans

  • Gast
hellMinors Simple Questlog
« Antwort #9 am: April 09, 2008, 17:08:04 »
Also ich wäre dir auf jedenfall sehr dankbar wenn du den code adden bzw. Tuts schreiben würdest! :)

hellMinors Simple Questlog

Angelos

  • Gast
hellMinors Simple Questlog
« Antwort #10 am: April 09, 2008, 17:18:52 »
Habn problemm...

Script "Quest menü" line 243: NoMethodError occurred.
undefined method size for nil:NilClass

sagte ich das ich RGSS noob bin ^^

hellMinors Simple Questlog

Offline Onkel Hell

  • Sol Invictus
  • Administrator
  • VX-Kenner
  • ****
  • Beiträge: 562
  • You can't shoot me, I'm AIDS !
hellMinors Simple Questlog
« Antwort #11 am: April 09, 2008, 17:48:03 »
hast du vllt irgendwas drin was an der scene_title rumbaut?
Verborgen in der Dunkelheit
Ich kenne nur die Einsamkeit
Auf das kein Gott mich sieht, ich bin ein Eremit


Mega Man Battle Engine


hellMinors Simple Questlog

Angelos

  • Gast
hellMinors Simple Questlog
« Antwort #12 am: April 09, 2008, 17:52:22 »
Jup thx, das war das problemm, funktioniert einwandfrei :)
Habs jetzt rausgenommen wollte ich eh früher oder später
« Letzte Änderung: April 09, 2008, 17:52:35 von Angelos »

hellMinors Simple Questlog

Offline Onkel Hell

  • Sol Invictus
  • Administrator
  • VX-Kenner
  • ****
  • Beiträge: 562
  • You can't shoot me, I'm AIDS !
hellMinors Simple Questlog
« Antwort #13 am: April 09, 2008, 17:55:44 »
man kann schon am scene_title rumbauen , ich initialisier nur zusätzlich zu den variablen im spiel halt noch 3 für das questlog , die wurden dann halt nich initialisiert und deshalb kannte der den befehl net, sollte aber eigentlich mit dem meisten kompaktibel sein da ich nur ein alias gesetzt hab

btw : oben findet man jetz den code wo man das im menü direkt hinzufügen kann
« Letzte Änderung: April 09, 2008, 17:56:09 von hellMinor »
Verborgen in der Dunkelheit
Ich kenne nur die Einsamkeit
Auf das kein Gott mich sieht, ich bin ein Eremit


Mega Man Battle Engine


hellMinors Simple Questlog

Dainreth

  • Gast
hellMinors Simple Questlog
« Antwort #14 am: April 09, 2008, 18:07:12 »
Zitat von: hellMinor
@dainreth : wie meinst du das genau mit den pictures? zb ne landkarte wo gezeigt wird wo man hin muss? theoretisch schon, könnt ich bissl umbauen dann könnt ich noch ein kleines window fürn pic adden

Jop, genau sowas meine ich. Im Questlog von Cäsar (siehe EE Post) ist zwar ein Bild drinnen, aber irgendwie hat es mir nie gefallen, dass sich dieses im Beschreibungsfenster befindet. Das Bildfenster müsste auch nicht allzu groß sein..nur so eine Idee, falls du vielleicht mal Zeit hast :)

 


 Bild des Monats

rooftop party

Views: 3581
By: papilion

 Umfrage

  • Wer soll das BdM gewinnen?
  • Dot Kandidat 1
  • 3 (25%)
  • Dot Kandidat 2
  • 1 (8%)
  • Dot Kandidat 3
  • 2 (16%)
  • Dot Kandidat 4
  • 0 (0%)
  • Dot Kandidat 5
  • 6 (50%)
  • Stimmen insgesamt: 12
  • View Topic

 Schnellsuche





SimplePortal 2.3.3 © 2008-2010, SimplePortal