The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: xbomber on January 19, 2008, 08:17:48 PM

Title: [RESOLVED] Help with Rune's Quest Log please
Post by: xbomber on January 19, 2008, 08:17:48 PM
Hi, I'm trying to use Rune's Quest log : [spoiler]#================================
#                        Quest Log Screen
#                               By Rune
#================================
# Introduction - This script calls a screen that keeps
# track of all your quests using variables.
#================================
# Instructions - Thoughout script
#================================
# To call - $scene = Scene_QuestPage1
#================================
# To start a quest, set it's variable to 1, to end it,
# set it to 2. Any Quest variables at 0 haven't been
# started or discovered
#================================

#++++++++++++++++++++++++++++++++
# Windows
#++++++++++++++++++++++++++++++++

class Window_QuestPage1 < Window_Base
  def initialize
    super(0, 64, 560, 350)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    refresh
  end
#================================
# Here's where you edit what each Quest is and which
# variables turn each one on. Add Quests as you please.
#================================
  def refresh
    self.contents.clear
#================================
# Set variable and "Quest Start" number
#================================
    if $game_variables[51] >= 1
#================================
# Set Quest objective, whenever a new quest is added,
# add 32 to the second number
#================================
      self.contents.draw_text(0, 0, 528, 32, "Quest 1")
    end
#================================
# And repeat until all quests are set
#================================
    if $game_variables[52] >= 1
      self.contents.draw_text(0, 32, 528, 32, "Quest 2")
    end
  end
end
#-----------------------------------------------------------------
class Window_QuestPage2 < Window_Base
  def initialize
    super(0, 64, 560, 350)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    refresh
  end
#================================
# Same here, set variables for Page 2 of the Quest Log
# Do NOT repeat Quests
#================================
  def refresh
    self.contents.clear
    if $game_variables[76] >= 1
      self.contents.draw_text(0, 0, 528, 32, "Quest 3")
    end
    if $game_variables[77] >= 1
      self.contents.draw_text(0, 32, 528, 32, "Quest 4")
    end
  end
end
#-----------------------------------------------------------------
class Window_Quest < Window_Base
  def initialize
    super(0, 0, 560, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    refresh
  end
  def refresh
    self.contents.clear
#================================
# Edit the color of the "Quest Log" at the top of the
# screen  (r, g, b)
#================================
    self.contents.font.color = Color.new(0, 255, 160)
#================================
# Decide what is placed at the top of the screen
#================================
    self.contents.draw_text(0, 0, 496, 32, "Quest Log", 1)
  end
end
#-----------------------------------------------------------------
class Window_Next < Window_Base
  def initialize
    super(0, 416, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    refresh
  end
  def refresh
    self.contents.clear
#================================
# Edit the color of the "Next Page" at the bottom of the
# screen  (r, g, b)
#================================
    self.contents.font.color = Color.new(0, 255, 160)
    self.contents.draw_text(480, 0, 128, 32, "Next Page -->")
  end
end
#-----------------------------------------------------------------
class Window_Complete< Window_Base
  def initialize
    super(560, 0, 80, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    refresh
  end
  def refresh
    self.contents.clear
#================================
# Edit the color of the "Complete?" text in the window
# (r, g, b)
#================================
    self.contents.font.color = Color.new(0, 255, 160)
    self.contents.draw_text(0, 0, 48, 32, "Complete?", 1)
  end
end
#-----------------------------------------------------------------
class Window_Prev < Window_Base
  def initialize
    super(0, 416, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    refresh
  end
  def refresh
    self.contents.clear
#================================
# Edit the color of the "Next Page" at the bottom of the
# screen  (r, g, b)
#================================
    self.contents.font.color = Color.new(0, 255, 160)
    self.contents.draw_text(0, 0, 128, 32, "<-- Prev Page")
  end
end
#-----------------------------------------------------------------
class Window_YN1 < Window_Base
  def initialize
    super(560, 64, 80, 350)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    refresh
  end
  def refresh
    self.contents.clear
#================================
# Set a variable to 2 to end it's quest
#================================
# If Quest is complete
#================================
    if $game_variables[51] == 2
      self.contents.draw_text(0, 0, 42, 32, "YES", 1)
#================================
# If Quest isn't started
#================================
    elsif $game_variables[51] == 0
      self.contents.draw_text(0, 0, 42, 32, "")
#================================
# If Quest is started but incomplete
#================================
    elsif $game_variables[51] == 1
      self.contents.draw_text(0, 0, 42, 32, "NO", 1)
    end
   
    if $game_variables[52] == 2
      self.contents.draw_text(0, 32, 42, 32, "YES", 1)
    elsif $game_variables[52] == 0
      self.contents.draw_text(0, 32, 42, 32, "")
    elsif $game_variables[52] == 1
      self.contents.draw_text(0, 32, 42, 32, "NO", 1)
    end
   
  end
end
#-----------------------------------------------------------------
class Window_YN2 < Window_Base
  def initialize
    super(560, 64, 80, 350)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    refresh
  end
  def refresh
    self.contents.clear
#================================
# Set a variable to 2 to end it's quest
#================================
# If Quest is complete
#================================
    if $game_variables[76] == 2
      self.contents.draw_text(0, 0, 42, 32, "YES", 1)
#================================
# If Quest isn't started
#================================
    elsif $game_variables[76] == 0
      self.contents.draw_text(0, 0, 42, 32, "")
#================================
# If Quest is started but incomplete
#================================
    elsif $game_variables[76] == 1
      self.contents.draw_text(0, 0, 42, 32, "NO", 1)
    end
   
    if $game_variables[77] == 2
      self.contents.draw_text(0, 32, 42, 32, "YES", 1)
    elsif $game_variables[77] == 0
      self.contents.draw_text(0, 32, 42, 32, "")
    elsif $game_variables[77] == 1
      self.contents.draw_text(0, 32, 42, 32, "NO", 1)
    end
   
  end
end
#-----------------------------------------------------------------

#++++++++++++++++++++++++++++++++
# Pages
#++++++++++++++++++++++++++++++++

class Scene_QuestPage1
  def main
    @top_window = Window_Quest.new
    @quest_window = Window_QuestPage1.new
    @next_window = Window_Next.new
    @comp_window = Window_Complete.new
    @check_window = Window_YN1.new
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @top_window.dispose
    @quest_window.dispose
    @next_window.dispose
    @comp_window.dispose
    @check_window.dispose
  end
  def update
    @top_window.update
    @quest_window.update
    @next_window.update
    @comp_window.update
    @check_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    end
    if Input.trigger?(Input::R)
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_QuestPage2.new
    end
  end
end
#-----------------------------------------------------------------
#-----------------------------------------------------------------
#-----------------------------------------------------------------
class Scene_QuestPage2
  def main
    @top_window = Window_Quest.new
    @quest_window = Window_QuestPage2.new
    @next_window = Window_Prev.new
    @comp_window = Window_Complete.new
    @check_window = Window_YN2.new
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @top_window.dispose
    @quest_window.dispose
    @next_window.dispose
    @comp_window.dispose
    @check_window.dispose
  end
  def update
    @top_window.update
    @quest_window.update
    @next_window.update
    @comp_window.update
    @check_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    end
    if Input.trigger?(Input::L)
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_QuestPage1.new
    end
  end
end
[/spoiler] and I receive this error message when I try to trigger the script,
Quote????" "Main" ? 20 ??? NoMethodError ???????
undefined method "main" for Scene_QuestPage1:class.
Here is my Main script [spoiler]#==============================================================================
# ? Main
#------------------------------------------------------------------------------

begin

  # This variable determines the default font type
  $defaultfonttype = "Tahoma"
  # This variable determines the default font size
  $defaultfontsize = 22

  Graphics.freeze
  $scene = Scene_Title.new
  while $scene != nil
    $scene.main
  end
  Graphics.transition(20)
rescue Errno::ENOENT
  filename = $!.message.sub("No such file or directory - ", "")
  print("File #{filename} not found.")
end
[/spoiler]
I have modified the Scene_Menu script to have a "Quests" button right under "Exit," and when the user chooses that button, it executes case @command_window.index
      when 6
        $scene = Scene_QuestPage1

I don't think they affect when I'm working on, but other non-standard scripts I am using are Blizzard's level up notification [spoiler]#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Easy LvlUp Notifier by Blizzard
# Version: 2.0
# Type: Battle Report Display
# Date: 27.8.2006
# Date v1.2b: 3.11.2006
# Date v1.3b: 11.3.2007
# Date v1.4b: 22.8.2007
# Date v2.0: 25.9.2007
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Compatibility:
#
#   98% compatible with SDK v1.x. 80% compatible with SDK 2.x. WILL corrupt old
#   savegames. May cause slight problems with following systems and would need
#   therefore slight recalibration:
#   - exotic CBS-es
#   - exotic skill systems
#   - exotic stat systems (additional stats like Wisdom, Luck etc.)
#
#
# Features:
#
#   - shows increased stats and learned skills at level up
#   - animated
#   - shows EXP gain for each actor (!) only after gaining EXP after a battle
#   - more simple and less laggy than other Level Up Notifiers
#   - you can set up any sound to be played when a higher level is reached or a
#     new skill is learned (LVLUP_SE and LEARN_SE further below)
#
# new in v1.2b:
#   - better window movement
#   - higher compatibility
#   - fixed a few "eventual" bugs
#
# new in v1.3b:
#   - fully compatible with Tons of Add-ons
#
# new in v1.4b:
#   - improved coding
#   - rewritten conditions using classic syntax to avoid RGSS conditioning bug
#
# new in v2.0:
#   - completely overworked and improved
#   - now MUCH more simple than other Level Up Notifiers
#   - halved the number of lines of code
#   - much more compatible: can show increase of any stats after the battle in
#     combination with any script, just put this script below those attribute
#     modifying scripts
#
#
# Instructions:
#
# - Explanation:
#
#   This script will notify you when any character is leveled up after a
#   battle. It will show any stats that were increased and any skills that were
#   learned. The windows are animated, the code is less complex than any other
#   so far and it is most efficient as well as highly optimized and detailed
#   worked out.
#
# - Configuration:
#   
#   There are a few options you can set up below.
#   
#   LVLUP_SE            - sound effect played when a new level was reached
#   LEARN_SE            - sound effect played when a new skill was learned,
#                         keep in mind that the script takes into account that
#                         skills can only be learned after a level up
#   WINDOW_BACK_OPACITY - set this value to the window's back opacity (0-255)
#   NO_EXP_DISPLAY      - set this value to true if you want to disable the EXP
#                         gaining display in the level up windows
#   OLD_EXP_DISPLAY     - set this value to true if you want to display the EXP
#                         in the normal result window again
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#          RPG::AudioFile.new('FILENAME', VOLUME, PITCH)
LVLUP_SE = RPG::AudioFile.new('087-Action02', 80, 100)
LEARN_SE = RPG::AudioFile.new('106-Heal02', 80, 100)
WINDOW_BACK_OPACITY = 160
NO_EXP_DISPLAY = false
OLD_EXP_DISPLAY = false

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

$easy_lvlup_notifier = true

#==============================================================================
# Game_Actor
#==============================================================================

class Game_Actor < Game_Battler

def all_exp
   return @exp
end

def all_exp=(exp)
   @exp = exp
end

end

#==============================================================================
# Window_BattleResult
#==============================================================================

class Window_BattleResult < Window_Base

alias easy_lvlup_notfier_refresh refresh
def refresh
   if $tons_version != nil && $tons_version >= 4.02 &&
       $game_system.WINDOW_BATTLERESULT || OLD_EXP_DISPLAY
     easy_lvlup_notfier_refresh
   else
     self.contents.clear
     x = 4
     self.contents.font.color = system_color
     cx = contents.text_size('Gained').width
     self.contents.draw_text(x, 0, cx+4, 32, 'Gained')
     x += cx + 4
     self.contents.font.color = normal_color
     cx = contents.text_size(@gold.to_s).width
     self.contents.draw_text(x, 0, cx+4, 32, @gold.to_s)
     x += cx + 4
     self.contents.font.color = system_color
     self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
     (0...@treasures.size).each {|i| draw_item_name(@treasures[i], 4, (i+1)*32)}
   end
end

end

#==============================================================================
# Window_LevelUp
#==============================================================================

class Window_LevelUp < Window_Base

attr_reader :limit

def initialize(a, d)
   if $tons_version != nil && $tons_version >= 4.98 &&
       $game_system.CENTER_BATTLER
     x = case $game_party.actors.size
     when 1 then 240
     when 2 then a.index * 320 + 80
     when 3 then a.index * 160 + 80
     when 4 then a.index * 160
     end
   else
     x = a.index * 160
   end
   text = []
   text.push(['Level:', d[0], a.level]) if d[0] != a.level
   text.push([$data_system.words.hp[0, 3], d[1], a.maxhp]) if d[1] != a.maxhp
   text.push([$data_system.words.sp[0, 3], d[2], a.maxsp]) if d[2] != a.maxsp
   text.push([$data_system.words.str[0, 3], d[3], a.str]) if d[3] != a.str
   text.push([$data_system.words.dex[0, 3], d[4], a.dex]) if d[4] != a.dex
   text.push([$data_system.words.agi[0, 3], d[5], a.agi]) if d[5] != a.agi
   text.push([$data_system.words.int[0, 3], d[6], a.int]) if d[6] != a.int
   h = text.size * 24 + (NO_EXP_DISPLAY ? 32 : 56)
   @limit, y = 320 - h, 480 - h + (h/64+1)*64
   super(x, y, 160, h)
   self.z, self.back_opacity = 100, WINDOW_BACK_OPACITY
   self.contents = Bitmap.new(self.width - 32, self.height - 32)
   if $fontface != nil
     self.contents.font.name = $fontface
   elsif $defaultfonttype != nil
     self.contents.font.name = $defaultfonttype
   end
   self.contents.font.size, self.contents.font.bold = 20, true
   unless NO_EXP_DISPLAY
     self.contents.font.color = normal_color
     self.contents.draw_text(0, 0, 128, 24, "#{a.exp - d[7]} EXP", 1)
   end
   text.each_index {|i|
       index = NO_EXP_DISPLAY ? i : i + 1
       self.contents.font.color = system_color
       self.contents.draw_text(0, index*24, 128, 24, text[i][0])
       self.contents.draw_text(80, index*24, 32, 24, '»')
       self.contents.font.color = normal_color
       self.contents.draw_text(0, index*24, 76, 24, text[i][1].to_s, 2)
       if text[i][1] > text[i][2]
         self.contents.font.color = Color.new(255, 64, 0)
       else
         self.contents.font.color = Color.new(0, 255, 64)
       end
       self.contents.draw_text(0, index*24, 128, 24, text[i][2].to_s, 2)}
end

end

#==============================================================================
# Scene_Battle
#==============================================================================

class Scene_Battle

alias main_lvlup_later main
def main
   @lvlup_data = {}
   @moving_windows, @pending_windows = [], []
   (1...$data_actors.size).each {|i|
       actor = $game_actors[i]
       @lvlup_data[actor] = [actor.level, actor.maxhp, actor.maxsp, actor.str,
           actor.dex, actor.agi, actor.int, actor.exp, actor.skills.clone]}
   main_lvlup_later
   (@moving_windows + @pending_windows).each {|win| win.dispose if win != nil}
end

alias start_phase5_lvlup_later start_phase5
def start_phase5
   start_phase5_lvlup_later
   @skill_texts = []
   $game_party.actors.each {|actor|
       actor.remove_states_battle
       if @lvlup_data[actor][0, 7] != [actor.level, actor.maxhp, actor.maxsp,
           actor.str, actor.dex, actor.agi, actor.int]
         @pending_windows.push(Window_LevelUp.new(actor, @lvlup_data[actor]))
         @skill_texts.push('')
         new_skills = actor.skills - @lvlup_data[actor][8]
         if new_skills.size > 0
           new_skills.each {|id|
               @skill_texts.push("#{actor.name} learned #{$data_skills[id].name}!")}
         end
       elsif @lvlup_data[actor][7] != actor.exp && !NO_EXP_DISPLAY
         @moving_windows.push(Window_LevelUp.new(actor, @lvlup_data[actor]))
       end}
end

def update_phase5
   if @phase5_wait_count > 0
     @phase5_wait_count -= 1
     if @phase5_wait_count == 0
       @result_window.visible, $game_temp.battle_main_phase = true, false
       @status_window.refresh
     end
     return
   end
   @moving_windows.each {|win|
       win.y -= [((win.y - win.limit) / 2.0).ceil, 64].min if win.y > win.limit}
   if Input.trigger?(Input::C)
     @result_window.visible = false
     if @skill_texts.size > 0
       text = @skill_texts.shift
       if text == ''
         $game_system.se_play(LVLUP_SE)
         @moving_windows.push(@pending_windows.shift)
         @help_window.visible = false
       else
         $game_system.se_play(LEARN_SE)
         @help_window.set_text(text, 1)
       end
     else
       battle_end(0)
     end
   end
end

end
[/spoiler]
Blizzard's stat distrubution [spoiler] #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Stat Distribution System by Blizzard
# Version: 1.33b
# Type: Actor Attribute Modifier
# Date: 25.3.2007
# Date v1.1b: 6.4.2007
# Date v1.2b: 22.8.2007
# Date v1.3b: 12.9.2007
# Date v1.33b: 5.11.2007
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Compatibility:
#
#   99% compatible with SDK v1.x. 80% compatible with SDK 2.x. WILL corrupt
#   your old savegames. Might cause problems with custom leveling up systems.
#   99% compatibility with everything else.
#
#
# Features:
#
#   - distribute points between different stats
#   - extra scene for point distribution with confirmation window at the end
#   - calls the "caller scene" automatically when finished
#   - add points by easily pressing RIGHT/LEFT
#   - hold Q to add 10 points at once
#   - hold W to add 100 points at once
#   - a Stat Distribution System that actually works like it should...
#
# new in v1.1b:
#   - added option to call the Points Scene after a fight with level ups
#   - customizable icon position and opacity
#
# new in v1.2b:
#   - improved coding and made code shorter
#   - rewritten conditions using classic syntax to avoid RGSS conditioning bug
#
# new in v1.3b:
#   - improved coding
#   - fixed bug with AUTOMATIC_CALL after battle
#   - new AUTOMATIC_MAP_CALL works on the map as well (that means it's fully
#     compatible with Blizz-ABS)
#
# new in v1.33b:
#   - improved coding
#   - improved compatibility
#   - fixed a little glitch
#
#
# Configuration:
#
#   Set up the configuration below.
#
#   STARTING_POINTS    - how many points should the actor have initially at
#                        level 1
#   POINTS_PER_LEVEL   - how many points should the actor gain per level
#   DISPLAY_ICON       - displays an icon on the map if ANY character in the
#                        party has any points to distribute
#   ICON_DATA          - some custom options for your icon: [X, Y, OPACITY]
#                        the default values are [612, 452, 192]
#   OWN_ICON           - use an own icon for display (the icon has to be in the
#                        Icons folder and must be named "point_notify")
#   EVASION            - the name that should be displayed for "Evasion"
#   STR_LIMIT          - max possible STR
#   DEX_LIMIT          - max possible DEX
#   AGI_LIMIT          - max possible AGI
#   INT_LIMIT          - max possible INT
#   WINDOW_MODE        - set to true to have the windows at the left, set to
#                        false to have them to at the right
#   AUTOMATIC_CALL     - set to true to have the scene called automatically
#                        after battles if at least one character got leveled up
#   AUTOMATIC_MAP_CALL - set to true to have the scene called automatically on
#                        the map if at least one character got leveled up
#                        (this works for Blizz-ABS as well), also note that
#                        this will cause the scene to called over and over as
#                        long as not all points were distributed
#
#
#   You can always add stat points yourself by using following syntax:
#
#     $game_party.actors[X].add_stat_points(Z)
#     $game_actors[Y].add_stat_points(Z)
#
#   Or you can remove them (how much sense it does is up to you...):
#
#     $game_party.actors[X].remove_stat_points(Z)
#     $game_actors[Y].remove_stat_points(Z)
#
#   X - position of actor in the party (STARTS FROM ZERO!)
#   Y - ID of actor in the database
#   Z - value
#
#   You can call the Scene by using a "Call script" event command. Type into
#   the editor window this text:
#
#     $scene = Scene_Points.new
#
#
# Side Note:
#
#   Decreasing the level of an actor won't remove his gained stat points. You
#   MUST do it manually.
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

module BlizzCFG

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
STARTING_POINTS = 20
POINTS_PER_LEVEL = 10
DISPLAY_ICON = true
ICON_DATA = [612, 452, 192]
OWN_ICON = false
EVASION = 'EVA'
STR_LIMIT = 999
DEX_LIMIT = 999
AGI_LIMIT = 999
INT_LIMIT = 999
WINDOW_MODE = true
AUTOMATIC_CALL = true
AUTOMATIC_MAP_CALL = false
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
ATTR_LIMITS = [STR_LIMIT, DEX_LIMIT, AGI_LIMIT, INT_LIMIT]
# ensures compatibility
$stat_system = 1.33

end

#==============================================================================
# Array
#==============================================================================

class Array

def sum
   result = 0
   self.each {|i| result += i if i.is_a?(Numeric)}
   return result
end

end

#==============================================================================
# Game_Actor
#==============================================================================

class Game_Actor < Game_Battler

attr_reader :points

alias setup_sds_later setup
def setup(actor_id)
   @points = BlizzCFG::STARTING_POINTS
   setup_sds_later(actor_id)
end

alias exp_sds_later exp=
def exp=(exp)
   old_level = @level
   exp_sds_later(exp)
   add_stat_points((@level - old_level) * BlizzCFG::POINTS_PER_LEVEL)
end

def add_stat_points(val)
   @points += val if val > 0
end

def remove_stat_points(val)
   @points = [@points-val, 0].max
end

end

#==============================================================================
# Window_Base
#==============================================================================

class Window_Base < Window

def draw_actor_battler(actor, x, y)
   bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
   cw, ch = bitmap.width, bitmap.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x - cw/2, y - ch/2, bitmap, src_rect)
end

alias draw_actor_parameter_sds_later draw_actor_parameter
def draw_actor_parameter(actor, x, y, type)
   if type == 7
     self.contents.font.color = system_color
     self.contents.draw_text(x, y, 120, 32, BlizzCFG::EVASION)
     self.contents.font.color = normal_color
     self.contents.draw_text(x + 120, y, 36, 32, actor.eva.to_s, 2)
   else
     draw_actor_parameter_sds_later(actor, x, y, type)
   end
end

end

#==============================================================================
# Window_Distribution_Status
#==============================================================================

class Window_Distribution_Status < Window_Base

attr_accessor :actor

def initialize(actor)
   super(BlizzCFG::WINDOW_MODE ? 160 : 0, 0, 480, 480)
   @actor = actor
   self.contents = Bitmap.new(width - 32, height - 32)
   if $fontface != nil
     self.contents.font.name = $fontface
     self.contents.font.size = $fontsize
   elsif $defaultfonttype != nil
     self.contents.font.name = $defaultfonttype
     self.contents.font.size = $defaultfontsize
   end
   refresh
end

def refresh
   self.contents.clear
   unless @actor == nil
     draw_actor_battler(@actor, 280, 120)
     draw_actor_name(@actor, 4, 0)
     draw_actor_class(@actor, 4, 32)
     draw_actor_level(@actor, 10, 44)
     draw_actor_state(@actor, 4, 96)
     self.contents.font.color = system_color
     self.contents.draw_text(4, 64, 80, 32, 'Lv')
     self.contents.draw_text(4, 128, 80, 32, 'EXP')
     self.contents.draw_text(4, 160, 80, 32, 'next')
     self.contents.font.color = normal_color
     self.contents.draw_text(4, 128, 156, 32, @actor.exp_s, 2)
     self.contents.draw_text(4, 160, 156, 32, @actor.next_rest_exp_s, 2)
     draw_actor_hp(@actor, 4, 224, 172)
     draw_actor_sp(@actor, 4, 256, 172)
     draw_actor_parameter(@actor, 4, 320, 0)
     draw_actor_parameter(@actor, 4, 352, 1)
     draw_actor_parameter(@actor, 4, 384, 2)
     draw_actor_parameter(@actor, 4, 416, 7)
     self.contents.font.color = system_color
     self.contents.draw_text(240, 240, 96, 32, 'Equipment')
     draw_item_name($data_weapons[@actor.weapon_id], 240, 288)
     draw_item_name($data_armors[@actor.armor1_id], 240, 320)
     draw_item_name($data_armors[@actor.armor2_id], 240, 352)
     draw_item_name($data_armors[@actor.armor3_id], 240, 384)
     draw_item_name($data_armors[@actor.armor4_id], 240, 416)
   end
end

end

#==============================================================================
# Window_Distribution
#==============================================================================

class Window_Distribution < Window_Selectable

attr_accessor :actor
attr_reader   :points

def initialize(actor)
   super(BlizzCFG::WINDOW_MODE ? 0 : 480, 160, 160, 320)
   self.contents = Bitmap.new(width - 32, height - 32)
   if $fontface != nil
     self.contents.font.name = $fontface
     self.contents.font.size = $fontsize
   elsif $defaultfonttype != nil
     self.contents.font.name = $defaultfonttype
     self.contents.font.size = $defaultfontsize
   end
   self.active, self.index, = false, 0
   @item_max, @actor, @att, @points = 4, actor, [0, 0, 0, 0], 0
   refresh
end

def set_new_attributes
   @actor.str += @att[0]
   @actor.dex += @att[1]
   @actor.agi += @att[2]
   @actor.int += @att[3]
   @actor.remove_stat_points(@points)
end

def actor=(actor)
   @actor = actor
   @att[0] = @att[1] = @att[2] = @att[3] = @points = 0
end

def refresh
   self.contents.clear
   unless @actor == nil
     self.contents.font.color = system_color
     self.contents.draw_text(52, 0, 72, 32, 'DP left', 2)
     self.contents.draw_text(4, 32, 120, 32, $data_system.words.str)
     self.contents.draw_text(4, 96, 120, 32, $data_system.words.dex)
     self.contents.draw_text(4, 160, 120, 32, $data_system.words.agi)
     self.contents.draw_text(4, 224, 120, 32, $data_system.words.int)
     self.contents.font.color = normal_color
     self.contents.draw_text(4, 0, 48, 32, "#{actor.points-@points}", 2)
     self.contents.draw_text(36, 64, 56, 32, "#{@actor.str+@att[0]}", 2)
     self.contents.draw_text(36, 128, 56, 32, "#{@actor.dex+@att[1]}", 2)
     self.contents.draw_text(36, 192, 56, 32, "#{@actor.agi+@att[2]}", 2)
     self.contents.draw_text(36, 256, 56, 32, "#{@actor.int+@att[3]}", 2)
     self.contents.font.size += 8
     self.contents.font.bold = true
     (0...4).each {|i|
         self.contents.draw_text(0, (i + 1) * 64 - 8, 32, 42, '«', 2)
         self.contents.draw_text(96, (i + 1) * 64 - 8, 32, 42, '»')}
     self.contents.font.bold = false
     self.contents.font.size -= 8
   end
end

def add_points(num)
   attr = [@actor.str, @actor.dex, @actor.agi, @actor.int]
   if @points < @actor.points &&
       attr[index]+@att[index] < BlizzCFG::ATTR_LIMITS[index]
     @points = [@points + num, @actor.points].min
     @att[index] = [@att[index]+num, @points+@att[index]-@att.sum].min
     return true
   end
   return false
end

def remove_points(num)
   if @points > 0 && @att[index] > 0
     @points = [@points - num, 0].max
     @att[index] = [@att[index] - num, 0].max
     return true
   end
   return false
end

def update
   super
   return unless self.active
   if Input.press?(Input::R)
     if Input.repeat?(Input::RIGHT)
       if add_points(100)
         $game_system.se_play($data_system.cursor_se)
         refresh
       else
         $game_system.se_play($data_system.buzzer_se)
       end
     elsif Input.repeat?(Input::LEFT)
       if remove_points(100)
         $game_system.se_play($data_system.cursor_se)
         refresh
       else
         $game_system.se_play($data_system.buzzer_se)
       end
     end
   elsif Input.press?(Input::L)
     if Input.repeat?(Input::RIGHT)
       if add_points(10)
         $game_system.se_play($data_system.cursor_se)
         refresh
       else
         $game_system.se_play($data_system.buzzer_se)
       end
     elsif Input.repeat?(Input::LEFT)
       if remove_points(10)
         $game_system.se_play($data_system.cursor_se)
         refresh
       else
         $game_system.se_play($data_system.buzzer_se)
       end
     end
   elsif Input.repeat?(Input::RIGHT)
     if add_points(1)
       $game_system.se_play($data_system.cursor_se)
       refresh
     else
       $game_system.se_play($data_system.buzzer_se)
     end
   elsif Input.repeat?(Input::LEFT)
     if remove_points(1)
       $game_system.se_play($data_system.cursor_se)
       refresh
     else
       $game_system.se_play($data_system.buzzer_se)
     end
   end
end

def update_cursor_rect
   if @index < 0 || !self.active
     self.cursor_rect.empty
   else
     self.cursor_rect.set(32, (@index+1)*64, 64, 32)
   end
end

end

#==============================================================================
# Window_Sure
#==============================================================================

class Window_Sure < Window_Command

attr_accessor :actor

def initialize(width, commands)
   commands.push('')
   super
   @item_max, self.index = commands.size - 1, 0
   self.x, self.y, self.z = 320-self.width/2, 240-self.height/2, 10000
   refresh
end

def refresh
   super
   self.contents.font.color = system_color
   self.contents.draw_text(4, 0, self.contents.width - 8, 32, 'Are you sure?', 1)
end

def draw_item(index, color)
   self.contents.font.color = color
   rect = Rect.new(4, 32 * (index+1), self.contents.width - 8, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   self.contents.draw_text(rect, @commands[index], 1)
end

def update_cursor_rect
   if @index < 0
     self.cursor_rect.empty
   else
     self.cursor_rect.set(32, (@index+1)*32, self.contents.width - 64, 32)
   end
end

end

#==============================================================================
# Scene_Points
#==============================================================================

class Scene_Points

def initialize
   @actor, @scene = $game_party.actors[0], $scene.class
end

def main
   commands = ['Distribute', 'Next', 'Previous', 'Finish']
   @command_window = Window_Command.new(160, commands)
   @command_window.x = (BlizzCFG::WINDOW_MODE ? 0 : 480)
   @status_window = Window_Distribution_Status.new(@actor)
   @distro_window = Window_Distribution.new(@actor)
   Graphics.transition
   loop do
     Graphics.update
     Input.update
     update
     break if $scene != self
   end
   Graphics.freeze
   [@command_window, @status_window, @distro_window].each {|win| win.dispose}
end

def make_sure_window
   commands = ['Cancel', 'Accept changes', 'Discard changes']
   @sure_window = Window_Sure.new(256, commands)
end

def update
   if @command_window.active
     @command_window.update
     update_main_command
   elsif @sure_window != nil
     @sure_window.update
     update_sure
   elsif @distro_window.active
     @distro_window.update
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       @command_window.active, @distro_window.active = true, false
     end
   end
end

def update_main_command
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     if @distro_window.points != 0
       @command_window.index, @command_window.active = 3, false
       make_sure_window
     else
       $scene = @scene.new
     end
   elsif Input.trigger?(Input::C)
     $game_system.se_play($data_system.decision_se)
     case @command_window.index
     when 0 then @command_window.active, @distro_window.active = false, true
     when 1
       if @distro_window.points != 0
         @command_window.active = false
         make_sure_window
       else
         i = (@actor.index+1) % $game_party.actors.size
         @actor = @status_window.actor = @distro_window.actor = $game_party.actors[i]
         [@status_window, @distro_window].each {|win| win.refresh}
         @distro_window.index = 0
       end
     when 2
       if @distro_window.points != 0
         @command_window.active = false
         make_sure_window
       else
         i = (@actor.index+$game_party.actors.size-1) % $game_party.actors.size
         @actor = @status_window.actor = @distro_window.actor = $game_party.actors[i]
         [@status_window, @distro_window].each {|win| win.refresh}
         @distro_window.index = 0
       end
     when 3
       if @distro_window.points != 0
         @command_window.active = false
         make_sure_window
       else
         $scene = @scene.new
       end
     end
   end
end

def update_sure
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     @sure_window.dispose
     @sure_window, @command_window.active = nil, true
   elsif Input.trigger?(Input::C)
     $game_system.se_play($data_system.decision_se)
     case @command_window.index
     when 1
       if @sure_window.index > 0
         @distro_window.set_new_attributes if @sure_window.index == 1
         i = (@actor.index+1) % $game_party.actors.size
         @actor = @status_window.actor = @distro_window.actor = $game_party.actors[i]
         [@status_window, @distro_window].each {|win| win.refresh}
       end
       @sure_window.dispose
       @sure_window, @command_window.active = nil, true
     when 2
       if @sure_window.index > 0
         @distro_window.set_new_attributes if @sure_window.index == 1
         i = (@actor.index+$game_party.actors.size-1) % $game_party.actors.size
         @actor = @status_window.actor = @distro_window.actor = $game_party.actors[i]
         [@status_window, @distro_window].each {|win| win.refresh}
       end
       @sure_window.dispose
       @sure_window, @command_window.active = nil, true
     when 3
       if @sure_window.index > 0
         @distro_window.set_new_attributes if @sure_window.index == 1
         $scene = @scene.new
       end
       @sure_window.dispose
       @sure_window, @command_window.active = nil, true
     end
   end
end

end

#==============================================================================
# Scene_Battle
#==============================================================================

class Scene_Battle

alias main_sds_later main
def main
   main_sds_later
   if BlizzCFG::AUTOMATIC_CALL &&
       $game_party.actors.any? {|actor| actor.points > 0}
     $scene = Scene_Points.new
   end
end

end

#==============================================================================
# Scene_Map
#==============================================================================

class Scene_Map

alias main_sds_later main
def main
   main_sds_later
   @notify.dispose if @notify != nil
end

alias upd_sds_later update
def update
   check_icon if BlizzCFG::DISPLAY_ICON
   upd_sds_later
   if BlizzCFG::AUTOMATIC_MAP_CALL &&
       $game_party.actors.any? {|actor| actor.points > 0}
     $scene = Scene_Points.new
   end
end

def check_icon
   if $game_party.actors.any? {|actor| actor.points > 0}
     if @notify == nil
       @notify = RPG::Sprite.new
       if BlizzCFG::OWN_ICON
         @notify.bitmap = RPG::Cache.icon('point_notify')
       else
         @notify.bitmap = Bitmap.new(24, 24)
         @notify.bitmap.fill_rect(0, 0, 24, 24, Color.new(255, 255, 255))
         @notify.bitmap.fill_rect(22, 1, 2, 23, Color.new(0, 0, 0))
         @notify.bitmap.fill_rect(1, 22, 23, 2, Color.new(0, 0, 0))
         @notify.bitmap.set_pixel(23, 0, Color.new(0, 0, 0))
         @notify.bitmap.set_pixel(0, 23, Color.new(0, 0, 0))
         @notify.bitmap.fill_rect(2, 2, 20, 20, Color.new(0, 0, 224))
         @notify.bitmap.fill_rect(4, 10, 16, 4, Color.new(255, 255, 255))
         @notify.bitmap.fill_rect(10, 4, 4, 16, Color.new(255, 255, 255))
         @notify.opacity = BlizzCFG::ICON_DATA[2]
       end
       @notify.x, @notify.y = BlizzCFG::ICON_DATA[0, 2]
       @notify.z = 5000
       @notify.blink_on
     end
     @notify.update
   elsif @notify != nil
     @notify.dispose
     @notify = nil
   end
end

end
[/spoiler]
and El Conductor's bars
[spoiler][code]#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Enemy/Actor HP & SP Bars +
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# By: El Conducter +
# Updated: January/08/08 +
# Version: 4.0 +
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# Update History:
# Version 1.0 - Displays enemy & actor HP & SP bars in battle.
#
# Version 2.0 - Made the enemy HP bars more centered aligned with the
# enemy. Actor bars now also show in menu screen.
#
# Version 3.0 - Module added to change bar lengths easier.
#
# Version 4.0 - System Rebuilt, new look for bars, new scrolling ability,
# more customizable features, bars on menu screen is lost,
# SDK compatible
#----------------------------------------------------------------------------

#----------------------------------------------------------------------------
# What it Does:
# See enemy and actor HP/SP bars during battle.
#
#----------------------------------------------------------------------------

#----------------------------------------------------------------------------
# How it Works:
#
# This version of the script works similar to the previous versions,
# however it runs a lot differently. Rather than the invisible window
# to display the bars as in previous versions, sub-sprites are used
# instead. The same effects can be achieved this way with more efficeincy
# and less code. New fetures can be taken advantage of through this new
# system like the ability for visual filling and depletion of bars.
# Though not built directly for the SDK, this script will work with or
# without it.
#
# Lengths and settings for the bars are stored in module Bar_Config.
#
# New and altered scripts are:
#
# - module Bar_Length
# - Sprite_HP_Bar
# - Sprite_SP_Bar
# - Sprite_Battler
# - Game_Battler
# - Scene_Battle
#
#----------------------------------------------------------------------------

#----------------------------------------------------------------------------
# How to Use This Script:
# Just copy it and paste it above Main. If using the SDK, paste below SDK
# and above Main.
#
# To change the bar lengths and other settings go to module Bar_Config
# and change the values there.
#----------------------------------------------------------------------------

#----------------------------------------------------------------------------
# Comments:
# I hope my script is easy for you to use and modify. Study this script
# to learn the ways of RGSS and join the ranks of those known as 'Scripters'.
#----------------------------------------------------------------------------



#==============================================================================
# ** Module Bar_Config
#------------------------------------------------------------------------------
# Contains various configurations for bars. The lengths, colors, and speeds
# are assigned to constants that will be referenced later in the script.
#==============================================================================

module Bar_Config
# CONSTANTS

# Bar Size
LENGTH = 85
WIDTH = 9

# Bar Colors
# Full bar color
GREEN = Color.new(50, 200, 50, 255)
# Bar low color
RED = Color.new(200, 50, 50, 255)
# Colors for HP Bar
YELLOW = Color.new(200, 200, 0, 255)
ORANGE = Color.new(220, 150, 0, 255)
# Colors for SP Bar
INDIGO = Color.new(50, 50, 200, 255)
VIOLET = Color.new(120, 50, 180, 255)
# Color for bar border
BLACK = Color.new(0, 0, 0, 255)

# Bar fill & decrease speed
FASTEST = 10
FAST = Graphics.frame_rate / 2
MEDUIM = Graphics.frame_rate
SLOW = Graphics.frame_rate * 2
SLOWEST = 100
# Set this to the above desired speed
CURRENT_SPEED = MEDUIM

# Visibility for bars. Set which bars you want visible for battle.
ACTOR_HP_USED = true
ACTOR_SP_USED = true
ENEMY_HP_USED = true
ENEMY_SP_USED = false
end

#==============================================================================
# ** Sprite_HP_Bar
#------------------------------------------------------------------------------
# This sprite is used to display the HP_Bar for the battler. It inherits form
# RPG::Sprite.
#==============================================================================

class Sprite_HP_Bar < RPG::Sprite
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :battler
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(viewport, battler)
super(viewport)
# Assign battler and variables used in drawing bar
@battler = battler
@battler_hp = 0
@accu_damages = 0
@counter = 0
# Only call setup method if @battler is not equal to nothing
if @battler != nil
setup
end
end
#--------------------------------------------------------------------------
# * Setup: this prepares the bitmap
#--------------------------------------------------------------------------
def setup
@battler_hp = @battler.hp
self.bitmap = Bitmap.new(Bar_Config::LENGTH + 2, Bar_Config::WIDTH)
# Determine if bar is visible for Actor or Enemy
if @battler.is_a?(Game_Enemy)
self.visible = Bar_Config::ENEMY_HP_USED
elsif @battler.is_a?(Game_Actor)
self.visible = Bar_Config::ACTOR_HP_USED
end
# Set bar placement
self.x = @battler.screen_x
self.y = @battler.screen_y
self.ox = self.bitmap.width / 2
self.oy = self.bitmap.height
# Call method to draw bars
draw_bars
update
end
#--------------------------------------------------------------------------
# * Method that draws the bars
#--------------------------------------------------------------------------
def draw_bars
# Clear previous bars if any
self.bitmap.clear
# Use formula to get length ratio to health
length = Bar_Config::LENGTH * @battler_hp / @battler.maxhp
# Specify bar & border
bar_border = Rect.new(0, 0, Bar_Config::LENGTH + 2, Bar_Config::WIDTH)
bar = Rect.new(1, 1, length, Bar_Config::WIDTH - 2)
# Draw the bar with border
self.bitmap.fill_rect(bar_border, Bar_Config::BLACK)
self.bitmap.fill_rect(bar, get_color)
end
#--------------------------------------------------------------------------
# * Determine the appropriate color based on battler's health
#--------------------------------------------------------------------------
def get_color
# Variables
full = @battler.maxhp
half = @battler.maxhp / 2
quarter = @battler.maxhp / 4
# Change bar color depending on amount HP
case @battler.hp
when full
color = Bar_Config::GREEN # Green when full
when half...full
color = Bar_Config::YELLOW # Yellow when above half
when quarter...half
color = Bar_Config::ORANGE # Orange when below half
when 0...quarter
color = Bar_Config::RED # Red when below quarter
end
# Return the appropriate color
return color
end
#--------------------------------------------------------------------------
# * Process when battler receives damage
#--------------------------------------------------------------------------
def damage_dealing(damages)
# Don't do process if damage is a String "Miss"
unless damages.is_a?(String)
# Add new damage to accumulitive damages
@accu_damages += damages
# Counter will be how many times the bars will be refreshed
# for the 'fill' effect.
@counter = Bar_Config::CURRENT_SPEED
# Rate is how many points will be altered for every refresh
@rate = @accu_damages / @counter
end
end
#--------------------------------------------------------------------------
# * Refresh Method
#--------------------------------------------------------------------------
def refresh
# Do only while @battler i
Title: Re: Help with Rune's Quest Log please
Post by: modern algebra on January 20, 2008, 01:30:05 AM
well, I did not look at this in detail, but I did notice this:

$scene = Scene_QuestPage1

That will not work. Change it to:

$scene = Scene_QuestPage1.new
Title: Re: Help with Rune's Quest Log please
Post by: xbomber on January 20, 2008, 01:39:46 AM
Thanks a bunch, that was what was wrong.