Scrolling Window_Help
Version: 1.1a
Author: cozziekuns
Date: 06/12/2011
Version History
- <Version 1.0> 06.12.2011 - Original Release
- <Version 1.1> 07.09.2011 - Updated with a bugfix.
- <Version 1.1a> 09.29.2011 - Updated with a small bugfix.
Planned Future Versions
None at the moment.
Description
This script allows you to auto scroll the text in Window_Help if it becomes too long for the window to hold. Originally, RPG Maker would auto resize the text to make it thin and aesthetically displeasing to the eye.
Screenshots
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi51.tinypic.com%2Fibkhh1.png&hash=a5830253666f956bce973142ce47d52dca344b74)
Instructions
See Script.
Script
#===============================================================================
# Scrolling Window_Help
#-------------------------------------------------------------------------------
# Version: 1.1a
# Author: Cozziekuns (rmrk)
# Last Date Updated: 12/6/2011
#===============================================================================
# Description:
#-------------------------------------------------------------------------------
# This script allows you to auto scroll the text in Window_Help if it becomes
# too long for the window to hold. Originally, RPG Maker would auto resize the
# text to make it thin and aesthetically displeasing to the eye.
#===============================================================================
# Updates
# ------------------------------------------------------------------------------
# o 12/06/2011 - Started Script
# o 09/07/2011 - Updated script with a bugfix.
#===============================================================================
# Instructions
# ------------------------------------------------------------------------------
# Copy and paste this script above ? Main Process but below ? Materials, and
# edit the modules to your liking.
#===============================================================================
module COZZIEKUNS
module SCROLLING_WINDOW_HELP
SCROLL_SPEED = 1 # The higher the scroll speed, the faster the text will scroll.
SCROLL_REFRESH_RATE = 1 # The lower the refresh rate, the faster the text will scroll.
SCROLL_INITIAL_WAIT = 60 # The amount of time before the text starts to scroll (in milliseconds)
end
end
#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias coz_scrolltxt_wh_14199_initialize initialize
def initialize(*args)
coz_scrolltxt_wh_14199_initialize
@scroll = false
@frames = 0
end
#--------------------------------------------------------------------------
# * Set Text
# text : character string displayed in window
# align : alignment (0..flush left, 1..center, 2..flush right)
#--------------------------------------------------------------------------
def set_text(text, align = 0)
if text != @text or align != @align
text_width = contents.text_size(text).width + 40 > self.contents.width - 40
text_width = false if align != 0
if text_width
self.contents = Bitmap.new(self.width + contents.text_size(text).width + 8, self.height - 32)
@scroll = true
else
self.contents = Bitmap.new(self.width - 32, self.height - 32)
@scroll = false
end
self.ox = 0
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, text_width ? self.contents.text_size(text).width : self.width - 40, WLH, text, align)
@text = text
@align = align
@frames = 0
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@frames += 1
f_refresh = COZZIEKUNS::SCROLLING_WINDOW_HELP::SCROLL_REFRESH_RATE
f_wait = COZZIEKUNS::SCROLLING_WINDOW_HELP::SCROLL_INITIAL_WAIT
speed = COZZIEKUNS::SCROLLING_WINDOW_HELP::SCROLL_SPEED
if @scroll == true
if (Graphics.frame_count % f_refresh == 0) and @frames >= f_wait
self.ox += speed
end
if self.ox >= self.contents.text_size(@text).width
self.ox = -self.contents.text_size(@text).width / 2
end
end
end
end
Credit
Thanks
- Arlen (I was looking through his Senior Recital vid and saw how ugly the thin text was).
- Kyriaki, for showing me some incompatabilities.
Support
Just post down below.
Known Compatibility Issues
None so far, but probably will not work with anything that utilises Window_Help.
Nice Script, I used an old one by Dragor I think it is? That was incompatible with quite a bit of things since it was never updated, but just throwing out compatibility notice:
Compatible with Modern Algebra's Advanced Text System and the Yanfly/YED etc overhauls. Long as they're above it.
Great idea cozzie! Good work.
:O
Nice stuff! Looks great!
Hello first of all, nice to meet you, I am new around here and it's a pleasure to be in such a nice forum.
Second, sorry for bringing back this thread from the deadland, but I have a little problem with this script and was hoping for a little help.
I am using Modern Algebra's "Learn Skills By Use" script and Zeriab's "Dialog System" script to make skills that "evolve" when they're used a number of times.
The problem is a little glitch that comes when the dialog box from the "Dialog system" script appears in the screen telling that you have learned the new skill:
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi54.tinypic.com%2F2i20ltl.png&hash=8b4e45bdb7cc7b00ee79f276fcb2dec7e9df1f40)
Here it shoul say: "Oscar has learned Double attack" but the text is "cut"
I am using various scripts in my project, but when I remove the "Scrolling Window_Help" script, the glitch disappears, so my guess is that the problem is whitin this script, but I am no expert in this matter, so excuse me if I am mistaken.
I also tried to put the scripts in different order but the result is the same.
Here are the other scripts if you need to check them:
#==============================================================================
# Learn Skills By Use
# Version: 2.0b
# Author: modern algebra (rmrk.net)
# Date: October 29, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# NB: If you wish to use the learn immediately option of the script, then
# Zeriab's Dialog System is required and he should be credited. You can find
# it here: http://rmrk.net/index.php/topic,24828.0.html
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
#
# This script allows you to have actors learn skills by using other skills.
# For instance, you could set it so that an actor will learn Fire II only
# after he has used Fire 50 times. You can also set it so that there can be
# multiple paths to learning a skill and multiple skill requirements. For
# instance, that same actor could also learn Fire II if he has used Flame
# 60 times and Flame II 25 times. However, you can also set class
# prohibitions and level requirements, so if you never want a Paladin to
# learn Fire II no matter how many times he uses its root skills, then it is
# easy to set that up, and if you don't want Fire II to be learned by any
# actor until they are at least level 7, then that can be setup too. You may
# also set it up so that it is like an upgrade - Fire becomes obsolete once
# Fire II is learned, and so you can simply forget Fire once you have Fire II
# It also has two options of ways to show the number of times you've used a
# skill.
#
# Also, you can set it so that the actor either learns the new skill
# immediately upon meeting use requirements, or at his/her next level.
#
# Further, this doesn't interfere with the regular skill learning system, so
# if you set it that a mage will learn Fire II at level 6 in the Class Tab
# of the database, than the mage will learn Fire II at level 6 no matter if
# she has met the use requirements of its root skills, and no matter what
# the class prohibitions or level requirements are.
#
# There are also a number of options you can set regarding how to show the
# number of uses in the help window, and you can do it by either pressing a
# button or it will show up at the same time as the description. There is
# also a new set of mastery options.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# Place this script above Main and below Materials in the Editor. It should
# also be below any custom levelup scripts you may have. If set to learn
# immediately, then Zeriab's Dialog System is required above this script:
# http://rmrk.net/index.php/topic,24828.0.html
#
# To set up a skill to be learned through use, you must use this code in a
# notes box:
#
# \ROOT_SKILL[skill_id, number_of_uses, <supplement_skills>, forget]
# skill_id : The ID of the root skill that leads to this skill.
# number_of_uses : An integer - the number of times the root skill has
# be used before it teaches this skill.
# <supplement_skills> : a list of skill IDs that also have to have their
# root requirements fulfilled before the skill will be learned. It is
# of the format: <x, y, z> where x, y, and z are the IDs of the other
# skills that must have usage requirements met. You can have as many
# as you like. Note, however, that you must set up one of these
# requirements notes for each of the other skills as well, and you
# must cross-reference the skills in this path. Defaults to <>,
# meaning that the only usage requirements needed to be filled is this
# one
# forget : If this is set to 1, then the root skills will be forgotten
# once this skill is learned. If left blank or set to any other digit,
# than the root skills will be retained.
#
# EXAMPLE A:
#
# This code in the notebox of a skill:
#
# \ROOT_SKILL[9, 100]
#
# There is only one path to learning this skill:
# (i) Use the skill with ID 9 at least 100 times.
#
# No skill is forgotten
#
# EXAMPLE B:
#
# These codes in the notebox of a skill:
#
# \ROOT_SKILL[1, 20, 1]
# \ROOT_SKILL[4, 15, <5>]
# \ROOT_SKILL[5, 8, <4>]
#
# With these codes, there are two paths to learning this skill.
# (i) Use the skill with ID 1 at least 20 times.
# (ii) Use the skill with ID 4 at least 15 times and use the skill with
# ID 5 at least 8 times.
#
# No matter which path is taken to the skill, the skill with ID 1 will be
# forgotten as soon as the new skill is learned.
#
# EXAMPLE C:
#
# The following codes in the notebox of a skill:
#
# \ROOT_SKILL[6, 100]
# \ROOT_SKILL[7, 100]
# \ROOT_SKILL[6, 20, <7, 8>]
# \ROOT_SKILL[7, 25, <6, 8>]
# \ROOT_SKILL[8, 15, <6, 7>]
#
# With these codes, there are three paths to learning this skill.
# (i) Use the skill with ID 6 at least 100 times
# (ii) Use the skill with ID 7 at least 100 times
# (iii) Use the skill with ID 6 at least 20 times, the skill with ID 7 at
# least 25 times, and the skill with ID 8 at least 15 times.
#
# No matter which path is taken, no skills will be forgotten.
#
# To prohibit a class from learning a skill through usage requirements,
# put this code in a notebox of a skill:
#
# \PROHIBIT_CLASS[class_id]
# class_id : ID of class not allowed to learn this skill through use
#
# To set a minimum level for learning a skill through usage requirements,
# put this code in the notebox of a skill:
#
# \MIN_LEVEL[x]
# x : an integer that is the minimum level. An actor cannot learn
# the skill until his level is at least equal to x.
#
# Next, you may want to setup if and how the use count is displayed. To, set the text that you
# want to signify the count under LSU_VOCAB_USECOUNT at line 159, and you can
# set the color of the text at line 165 - LSU_COUNT_FONTCOLOR. If this is an
# integer, it takes the color from the windowskin palette. You could also set
# it as an array of the form: [red, green, blue, alpha].
# Alternatively, you could set it up to only show the skill count if the
# player presses a specified button. You would not get to choose the color in
# that case, but would get to specify alignment.
#
# Lastly, there is now an option to show "Mastery". You can specify a number
# of uses to meet this threshold. When showing use count, it will show up as
# # of uses / mastery threshold, and once reached, it will be replaced by any
# text you choose. Those options are between lines 162 and 168. To set the
# threshold for a skill individually, use the following code:
# \MASTER[x]
# x : the number of uses to reach mastery.
#==============================================================================
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# EDITABLE REGION
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LSU_LEARN_IMMEDIATELY = true # Whether to learn the skill immediately upon
# meeting usage requirements or to wait for level
# If true, you MUST have Zeriab's Dialog System:
# http://rmrk.net/index.php/topic,24828.0.html
LSU_VOCAB_OBTAIN_SKILL = "%n has learned %s!" # The message shown when an actor
# learns a new skill if immediate and not on level
LSU_SE_OBTAIN_SKILL = "Skill" # The SE that plays when an actor learns a new
# skill. Again, only applies if on immediate.
#``````````````````````````````````````````````````````````````````````````````
LSU_SHOW_USE = true # Whether or not to show use count at all in the
# the help window.
LSU_VOCAB_USECOUNT = "Used: " # Text to label skill count
LSU_BUTTONSHOW = true # Whether or not it shows up with the description
# or is drawn only when pressing a button
LSU_BUTTON = Input::Z # If LSU_BUTTONSHOW is true, what button needs to
# be pressed to show the skill use count
LSU_SHOWCOUNT_ALIGN = 0 # Alignment of text if LSU_BUTTONSHOW is true
LSU_COUNT_FONTCOLOR = 16 # Font color if LSU_BUTTONSHOW is false
#``````````````````````````````````````````````````````````````````````````````
LSU_SHOW_MASTERY = false # Whether or not to show some the word for mastery
# when a script has been used to its maximum
# efficiency or to a stated goal.
LSU_DEFAULT_MASTERY = 100 # The default number of uses for mastery
LSU_VOCAB_MASTERY = "[MASTERED]" # The word to show once skill use reaches goal
LSU_MASTER_REPLACE = true # Whether to replace the Used: x text or simply be
# placed after it.
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# END EDITABLE REGION
#//////////////////////////////////////////////////////////////////////////////
if LSU_LEARN_IMMEDIATELY
#==============================================================================
# ** Dialog_DiscoverFavourite
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# This class processes when a favourite item is discovered
#==============================================================================
class Dialog_LearnSkill < Dialog
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * A show method
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize(actor, skill)
@actor = actor
@skill = skill
begin
(RPG::SE.new (*skill.ma_learn_se)).play
rescue
(RPG::SE.new ("Skill")).play
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Create the windows
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def main_window
text = help_text
tw = [@background_sprite.bitmap.text_size (text).width + 40, Graphics.width].min
@learn_window = Window_Help.new
@learn_window.width = tw
@learn_window.create_contents
@learn_window.x = (Graphics.width - tw) / 2
@learn_window.y = (Graphics.height - @learn_window.height) / 2
@learn_window.z = STARTING_Z_VALUE + 1
@learn_window.set_text (text, 1)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Help Text
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def help_text
text = LSU_VOCAB_OBTAIN_SKILL.gsub (/%s/) { @skill.name }
text.gsub! (/%n/) { @actor.name }
return text
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Dispose the windows
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def main_dispose
@learn_window.dispose
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Frame Update
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def update
if Input.trigger?(Input::B) || Input.trigger?(Input::C)
mark_to_close
self.value = false
end
end
end
end
#==============================================================================
# ** Skill
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new public variables - ma_root_skills; ma_descendant_skills;
# ma_level_requirement; ma_prohibited classes
# new methods - ma_learn_se; ma_cache_lsu_skill_stats
#==============================================================================
class RPG::Skill
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_accessor :ma_root_skills
attr_accessor :ma_descendant_skills
attr_accessor :ma_level_requirement
attr_accessor :ma_prohibited_classes
attr_accessor :ma_master_uses
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Learn SE
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_learn_se
# Not cached because it will only rarely be accessed. Better to use RAM
if self.note[/\\LEARN_SE\[(.+?),?\s*(\d*?),?\s*(\d*?)\]/i] != nil
learn_se = [$1.to_s]
learn_se.push ($2.to_i) unless $2.empty?
learn_se.push ($3.to_i) unless $3.empty?
else
return LSU_SE_OBTAIN_SKILL
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Cache LSU stats
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_cache_lsu_skill_stats
# Get skill paths and descendants
@ma_root_skills, @ma_prohibited_classes = [], []
@ma_descendant_skills = [] if @ma_descendant_skills.nil?
@ma_master_uses, @ma_level_requirement = LSU_DEFAULT_MASTERY, 1
# Level Requirements
@ma_level_requirement = $1.to_i if self.note[/\\MIN_LEVEL\[(\d+)\]/i] != nil
@ma_master_uses = $1.to_i if self.note[/\\MASTERY?\[(\d+)\]/i] != nil && $1.to_i > 0
root_paths = {}
root_skills = []
(self.note.scan (/\\ROOT_SKILL\[(\d+),?\s*(\d*),?\s*?<?([\d ,;:]*?)>?,?\s*?([F1]?)\]/i)).each { |match|
id = match[0].to_i
n = match[1].to_i
supplement_skills = []
(match[2].scan (/\d+?/)).each { |id2| supplement_skills.push (id2.to_i) } unless match[2].empty?
forget = !match[3].empty?
root_skills.push ([id, n, forget, supplement_skills])
}
root_skills.each { |array|
key = ([array[0]] + array[3]).sort
root_paths[key] = [] if !root_paths[key]
root_paths[key].push (array[0, 3])
}
root_paths.each { |key, path|
if path.size < key.size
key.each { |key2|
exists = false
path.each { |array| exists = true if path[0] == key2 }
path.push ([key2, 0, false]) if !exists
}
end
path.sort! { |a, b| a[0] <=> b[0] }
@ma_root_skills.push (path)
}
@ma_root_skills.each { |path|
path.each { |d_id, n, forget|
$data_skills[d_id].ma_descendant_skills = [] if $data_skills[d_id].ma_descendant_skills.nil?
d_skills = $data_skills[d_id].ma_descendant_skills
d_skills.push (self.id) unless d_skills.include? (self.id)
}
}
# Prohibited Classes
(self.note.scan (/\\PROHIBIT_CLASS\[(\d+)\]/i)).each { |id|
@ma_prohibited_classes.push (id[0].to_i)
}
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Compatibility with Note Editor + General Compatibility Patch
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if self.method_defined? (:ma_reset_note_values)
alias malg_lsu_rsetnote_8uk2 ma_reset_note_values
def ma_reset_note_values (*args)
malg_lsu_rsetnote_8uk2 (*args) # Run Original Method
@ma_root_skills.each { |path|
path.each { |a| $data_skills[a[0]].ma_descendant_skills.delete (self.id) }
}
ma_cache_lsu_skill_stats # Recache skill stats for LSU
end
end
end
#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - initialize; level_up
# new method - lsu_skill_requirements_met?; learn_skill_by_use; skill_count;
# increase_skill_count; skill_mastered?
#==============================================================================
class Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_brnchskill_stp_1xc3 setup
def setup (*args)
@lsbu_skill_count = []
# Run Original Method
modalg_brnchskill_stp_1xc3(*args)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Level Up
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias malg_skl_brnches_byuse_lvlplus_0kb2 level_up
def level_up (*args)
# Run Original Method
malg_skl_brnches_byuse_lvlplus_0kb2 (*args)
# Check all skills to see if requirements have been met to learn the skill
skills.each { |skill|
skill.ma_descendant_skills.each { |descendant_id|
descen = $data_skills[descendant_id]
if !@skills.include? (descen.id) && lsu_skill_requirements_met? (descen)
# Learn Skill
learn_skill_by_use (descen.id)
end
}
}
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Check if this actor meets requirements to learn skill
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def lsu_skill_requirements_met? (skill)
return false if skill.ma_prohibited_classes.include? (@class_id)
return false if @level < skill.ma_level_requirement
skill.ma_root_skills.each { |path|
path_complete = true
path.each { |reqs|
if skill_count (reqs[0]) < reqs[1]
path_complete = false
break
end
}
return true if path_complete # If all requirements met
}
return false
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Learn Skill By Use
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def learn_skill_by_use (skill_id)
forgets = []
$data_skills[skill_id].ma_root_skills.each { |path|
path.each { |reqs| forgets.push (reqs[0]) if reqs[2] }
}
forgets.each { |forget_id| forget_skill (forget_id) }
learn_skill (skill_id)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Retrieve Skill Count
# skill_id : ID of skill checked
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def skill_count (skill_id)
@lsbu_skill_count[skill_id] = 0 if @lsbu_skill_count[skill_id].nil?
return @lsbu_skill_count[skill_id]
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Increase Skill Count
# skill_id : ID of skill increased
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def increase_skill_count (skill_id)
@lsbu_skill_count[skill_id] = skill_count (skill_id) + 1
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Skill Mastered?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def skill_mastered? (skill)
return skill_count (skill.id) >= skill.ma_master_uses
end
end
#==============================================================================
# ** Window_Help
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - lsu_set_secondary_text
#==============================================================================
class Window_Help
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Set Secondary Text
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def lsu_insert_secondary_text (text, align = 2)
# Check if real text has changed
if (@lsu_changed_text != @text) || (@lsu_changed_align != @align)
if LSU_COUNT_FONTCOLOR.is_a? (Integer)
self.contents.font.color = text_color (LSU_COUNT_FONTCOLOR)
else
self.contents.font.color = Color.new (*LSU_COUNT_FONTCOLOR)
end
self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
@lsu_changed_text, @lsu_changed_align = @text, @align
end
end
end
#==============================================================================
# ** Window_Skill
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - update_help
#==============================================================================
class Window_Skill
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Help Text
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias ma_lsu_updhelp_uses_8kh2 update_help
def update_help (*args)
if LSU_BUTTONSHOW
if Input.press? (LSU_BUTTON) && @actor
@help_window.set_text (ma_use_text, LSU_SHOWCOUNT_ALIGN)
else
ma_lsu_updhelp_uses_8kh2 (*args)
end
else
ma_lsu_updhelp_uses_8kh2 (*args)
return unless @actor && skill
@help_window.lsu_insert_secondary_text (ma_use_text)
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Use Text
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_use_text
add = ""
if LSU_SHOW_MASTERY
if @actor.skill_mastered? (skill)
return LSU_VOCAB_MASTERY if LSU_MASTER_REPLACE
add = LSU_VOCAB_MASTERY
else
add = " / #{skill.ma_master_uses}"
end
end
return LSU_VOCAB_USECOUNT + @actor.skill_count(skill.id).to_s + add
end
end
#==============================================================================
# ** Scene_Base
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - lsu_advance_skill_count
#==============================================================================
class Scene_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Advance Skill Count
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def lsu_advance_skill_count (user, skill)
# Increase skill count
user.increase_skill_count (skill.id)
if LSU_LEARN_IMMEDIATELY
new_skills = []
skill.ma_descendant_skills.each { |descendant_id|
descendant = $data_skills[descendant_id]
# Check requirements
if !user.skill_learn? (descendant) && user.lsu_skill_requirements_met? (descendant)
new_skills.push (descendant)
end
}
for new_skill in new_skills
user.learn_skill_by_use (new_skill.id)
Dialog_LearnSkill.show (user, new_skill)
end
end
end
end
#==============================================================================
# ** Scene_Title
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - load_database; load_bt_database
#==============================================================================
class Scene_Title
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Load Database
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias malsu_lddata_5yj7 load_database
def load_database (*args)
malsu_lddata_5yj7 (*args) # Run Original Method
$data_skills.each { |skill| skill.ma_cache_lsu_skill_stats if !skill.nil? }
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Load Battle Test Database
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias malg_lsu_btdat_6yh1 load_bt_database
def load_bt_database (*args)
malg_lsu_btdat_6yh1 (*args) # Run Original Method
$data_skills.each { |skill| skill.ma_cache_lsu_skill_stats if !skill.nil? }
end
end
#==============================================================================
# ** Scene_Skill
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - use_skill_nontarget
#==============================================================================
class Scene_Skill
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Use Skill Nontarget
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias ma_lsu_uskll_7uj2 use_skill_nontarget
def use_skill_nontarget (*args)
ma_lsu_uskll_7uj2 (*args) # Run Original Method
lsu_advance_skill_count (@actor, @skill) # Advance Skill Count
end
end
#==============================================================================
# ** Scene Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - execute_action_skill
#==============================================================================
class Scene_Battle
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Execute Skill
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdrnalg_exctskl_lsbu_4nv2 execute_action_skill
def execute_action_skill (*args)
mdrnalg_exctskl_lsbu_4nv2 (*args) # Run Original Method
# Increase User's skill count if actor
lsu_advance_skill_count (@active_battler, @active_battler.action.skill) if @active_battler.actor?
end
end
#==============================================================================
# ** Dialog system - RMVX
#------------------------------------------------------------------------------
# Zeriab
# Version 1.0
# 2008-02-16 (Year-Month-Day)
#------------------------------------------------------------------------------
# * Description :
#
# A small framework like script for dialogs
#------------------------------------------------------------------------------
# * License :
#
# Copyright (C) 2008 Zeriab
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser Public License for more details.
#
# For the full license see <http://www.gnu.org/licenses/>
# The GNU General Public License: http://www.gnu.org/licenses/gpl.txt
# The GNU Lesser General Public License: http://www.gnu.org/licenses/lgpl.txt
#------------------------------------------------------------------------------
# * Instructions :
#
# You can place this script pretty much anyway you like.
# Place it above any other Dialogs you might be using.
# Increase the STARTING_Z_VALUE if you have trouble with the dialog not
# on top.
#==============================================================================
class Dialog
STARTING_Z_VALUE = 1500 # Default value is 1500
attr_accessor :value
attr_writer :marked_to_close
#--------------------------------------------------------------------------
# * Getter with 'false' as default value
#--------------------------------------------------------------------------
def marked_to_close
@marked_to_close = false if @marked_to_close.nil?
return @marked_to_close
end
#--------------------------------------------------------------------------
# * Mark the dialog to close
#--------------------------------------------------------------------------
def mark_to_close
self.marked_to_close = true
end
#--------------------------------------------------------------------------
# * Show the dialog
# Returns the value from the dialog
#--------------------------------------------------------------------------
def self.show(*args, &block)
dialog = self.new(*args, &block)
dialog.marked_to_close = false
return dialog.main
end
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize(*args, &block)
# For subclasses to overwrite
end
#--------------------------------------------------------------------------
# * Main processing
#--------------------------------------------------------------------------
def main
# Create the dimmed background
create_background
# Create Windows
main_window
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if the dialog should close
if marked_to_close
break
end
end
# Dispose of windows
main_dispose
# Dispose of background
dispose_background
# Update input information
Input.update
# Returns the acquired value
return self.value
end
#--------------------------------------------------------------------------
# * Create the dimmed background
#--------------------------------------------------------------------------
def create_background
bitmap = Bitmap.new(Graphics.width,Graphics.height)
bitmap.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(0,0,0,128))
@background_sprite = Sprite.new
@background_sprite.z = STARTING_Z_VALUE
@background_sprite.bitmap = bitmap
end
#--------------------------------------------------------------------------
# * Create the windows
#--------------------------------------------------------------------------
def main_window
# For the subclasses to override
# Remember to set their z.value to at least STARTING_Z_VALUE + 1
end
#--------------------------------------------------------------------------
# * Dispose the background
#--------------------------------------------------------------------------
def dispose_background
@background_sprite.dispose
end
#--------------------------------------------------------------------------
# * Dispose the windows
#--------------------------------------------------------------------------
def main_dispose
# For the subclasses to override
# Dispose your windows here
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# For the subclasses to override
if Input.trigger?(Input::B)
mark_to_close
end
end
end
I hope that this can be fixed.
Thanks in advance for your help :)
Thanks and hopefully fixed. In hindsight, I should have seen this problem coming earlier.
Hello again, thanks for your quick reply.
I have just replaced the script, but the glitch is still there.
I noticed the script still says: "Version: 1.1" is this the fixed version? or did you forgot to replace the old one? :)
Ugh my apologies. I forgot to replace the old script.
I just tested it, and it works like a charm, thank you very much for your help :D