Here is a script that will allow you to power up your skills, and even allow passive skills.
To call it, use $scene = Scene_Skill_Level.new
Bon Appetit.
#----------------------------------------------------------------------
# Skill Level System
#----------------------------------------------------------------------
# Leon
# 2006-09-16
# v1.5
#----------------------------------------------------------------------
=begin
Features:
1. You can set skill level's and skill max's custom to each actor.
2. You can set skills to have a standard skill max and starting point.
3. Shows skills in detail.
4. Skill points per level can be customized.
5. You can change skill levels and skill max's through events.
6. You can have level and Skill prerequisites (sorry, only one each.)
7. Skill Power goes up per level.
Added Feature:
You can add status ailments, status curatives, and elements to skills.
INSTRUCTIONS:
1. Place this script under all your others and above Main.
2. Set Beginning_Default to the level you want all skills to start at.
3. Set Max_Default to the max level of the average skill
4. Level_Req sets the a required level for skills.
5. Skill_Req sets required skills.
7. Set all instances of INCREASE_PER_LEVEL to the same number, (Use Ctrl + F to find all instances)
8. Set all instances of PASSIVE_SKILL_ID to the same number. (Use Ctrl + F to find all instances)
9. Use Ctrl + F and search for Leon_Edit for the final pieces to edit (only 2 other locales)
10. Set the additive element ailments, curatives and elements in their respective places.
Use this to add to current skill levels:
x = actor's number, y = skill id, z = amount.
use $game_actors[x].skill_level[y] += z
use this to add to current skill max's:
x = actor's number, y = skill id, z = amount.
use $game_actors[x].skill_max[y] += z
To subtract from the totals, change the '+' to '-'
=end
module Skill_Level
#--------------------------------------------------------------------
# Skill_Default_Beginning_Level
#--------------------------------------------------------------------
Beginning_Default = 0
#--------------------------------------------------------------------
# Skill default max level
#--------------------------------------------------------------------
Max_Default = 5
#--------------------------------------------------------------------
# Actor Level Requirements
# skill_id => actor.level
#--------------------------------------------------------------------
Level_Req = {
2 => 2
}
#--------------------------------------------------------------------
# Skill Level Requirements
# skill_id => [required skill_id, required skill_level, skill name of required skill]
#--------------------------------------------------------------------
Skill_Req = {
57 => [1, 2, "Heal"]
}
#--------------------------------------------------------------------
# Skill Infliction Status Additions
# skill_id => [skill_level, plus_state_set id]
#--------------------------------------------------------------------
Skill_Add = {
57 => [2, 3]
}
#--------------------------------------------------------------------
# Skill Cure Status Removals
# skill_id => [skill_level, minus_state_set id]
#--------------------------------------------------------------------
Skill_Minus = {
1 => [2, 2]
}
#--------------------------------------------------------------------
# Skill Element Addition
# skill_id => [skill_level, element_set]
#--------------------------------------------------------------------
Skill_Element = {
1 => [2, 4]
}
#--------------------------------------------------------------------
# HP Max Plus skills
# skill.id => %change per level
#--------------------------------------------------------------------
Skill_HP = {
1 => 5,
81 => 25
}
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Game_Battler
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Battler
#--------------------------------------------------------------------
# Set's Percentage Increase
# Set each INCREASE_PER_LEVEL in the script to the same number
#--------------------------------------------------------------------
INCREASE_PER_LEVEL = 10
#--------------------------------------------------------------------
# Alias Listings
#--------------------------------------------------------------------
alias leon_gb_skilleffect skill_effect
#--------------------------------------------------------------------
# Skill Effect
#--------------------------------------------------------------------
def skill_effect(user, skill)
self.critical = false
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
return false
end
effective = false
effective |= skill.common_event_id > 0
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
effective |= hit < 100
if hit_result == true
if user.is_a?(Game_Actor)
power = (skill.power + (INCREASE_PER_LEVEL * user.skill_level[skill.id][0] * 0.01 * skill.power)) + user.atk * skill.atk_f / 100
else
power = skill.power + user.atk * skill.atk_f / 100
end
power = power.round
if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
self.damage = power * rate / 20
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
if self.damage > 0
if self.guarding?
self.damage /= 2
end
end
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
eva = 8 * self.agi / user.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
effective |= hit < 100
end
if hit_result == true
if skill.power != 0 and skill.atk_f > 0
remove_states_shock
effective = true
end
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)
if skill.power == 0
self.damage = ""
unless @state_changed
self.damage = "Miss"
end
end
else
self.damage = "Miss"
end
unless $game_temp.in_battle
self.damage = nil
end
return effective
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Actor < Game_Battler
#--------------------------------------------------------------------
# Constant Variables
# Leon_Edit
# Set the BASE_MAXHP, BASE_MAXSP, BASE_STR, etc...
# to the skill id's of those passive skills. Only 1 id each.
# Set SKILL_POINTS equal to the number of skill points per level.
# Set SKILL_POINTS equal to 0 if none are to be earned.
#--------------------------------------------------------------------
INCREASE_PER_LEVEL = 10
BASE_MAXSP = 2 #SP
BASE_STR = 2 #STR
BASE_DEX = 2 #DEX
BASE_AGI = 2 #AGI
BASE_INT = 2 #INT
SKILL_POINTS = 1
#--------------------------------------------------------------------
# Attribute Listings
#--------------------------------------------------------------------
attr_accessor :skill_level
attr_accessor :skill_max
attr_accessor :skill_points
attr_accessor :hp_percent
#--------------------------------------------------------------------
# Alias Listings
#--------------------------------------------------------------------
alias leon_ga_skill_level_setup setup
alias leon_ga_skill_level_skill_learn? skill_learn?
alias leon_ga_skill_level_exp exp
alias leon_ga_skill_level_basehp base_maxhp
alias leon_ga_skill_level_basesp base_maxsp
alias leon_ga_skill_level_basestr base_str
alias leon_ga_skill_level_basedex base_dex
alias leon_ga_skill_level_baseagi base_agi
alias leon_ga_skill_level_baseint base_int
#--------------------------------------------------------------------
# Setup
#--------------------------------------------------------------------
def setup(actor_id)
#--------------------------------------------------------------------
# Leon_Edit
# Put in unique beginning levels here.
# skill_id => starting_level
#--------------------------------------------------------------------
@skill_level = {
1 => 2,
57 => 0
}
#--------------------------------------------------------------------
# Leon_Edit
# Put unique ending levels here.
# skill_id => skill_end
#--------------------------------------------------------------------
@skill_max = {
1 => 3,
57 => 7
}
@skill_points = 0
@hp_percent = 0
leon_ga_skill_level_setup(actor_id)
end
def base_maxhp
reqs = Skill_Level
n = leon_ga_skill_level_basehp
if skills.include?(reqs::Skill_HP)
print ("True")
end
if reqs::Skill_HP.has_key?(skills)
n += (reqs::Skill_HP[skills] * 0.01 * n)
end
return n
end
def base_maxsp
n = leon_ga_skill_level_basesp
if skills.include?(BASE_MAXSP)
n += (INCREASE_PER_LEVEL * 0.01 * n * skill_level[BASE_MAXSP])
end
return n
end
def base_str
n = leon_ga_skill_level_basestr
if skills.include?(BASE_STR)
n += (INCREASE_PER_LEVEL * 0.01 * n * skill_level[BASE_STR])
end
return n
end
def base_dex
n = leon_ga_skill_level_basedex
if skills.include?(BASE_DEX)
n += (INCREASE_PER_LEVEL * 0.01 * n * skill_level[BASE_DEX])
end
return n
end
def base_int
n = leon_ga_skill_level_baseint
if skills.include?(BASE_INT)
n += (INCREASE_PER_LEVEL * 0.01 * n * skill_level[BASE_INT])
end
return n
end
def base_agi
n = leon_ga_skill_level_baseagi
if skills.include?(BASE_AGI)
n += (INCREASE_PER_LEVEL * 0.01 * n * skill_level[BASE_AGI])
end
return n
end
def skill_learn?(skill_id)
reqs = Skill_Level
unless @skill_level.include?(skill_id)
@skill_level[skill_id] = reqs::Beginning_Default
end
unless @skill_max.include?(skill_id)
@skill_max[skill_id] = reqs::Max_Default
end
leon_ga_skill_level_skill_learn?(skill_id)
end
def skill_can_learn?(skill_id)
reqs = Skill_Level
if reqs::Level_Req.has_key?(skill_id)
unless level >= reqs::Level_Req[skill_id]
return false
end
end
if reqs::Skill_Req.has_key?(skill_id)
unless level >= reqs::Skill_Req[skill_id][0]
return false
end
end
return true
end
def skill_can_use?(skill_id)
reqs = Skill_Level
if reqs::Skill_Add.has_key?(skill_id)
if skill_level[skill_id] >= reqs::Skill_Add[skill_id][0]
$data_skills[skill_id].plus_state_set.push(reqs::Skill_Add[skill_id][1])
end
end
if reqs::Skill_Minus.has_key?(skill_id)
if skill_level[skill_id] >= reqs::Skill_Minus[skill_id][0]
$data_skills[skill_id].minus_state_set.push(reqs::Skill_Minus[skill_id][1])
end
end
if reqs::Skill_Element.has_key?(skill_id)
if skill_level[skill_id] >= reqs::Skill_Element[skill_id][0]
unless $data_skills[skill_id].element_set.include?(reqs::Skill_Element[skill_id][1])
$data_skills[skill_id].element_set.push(reqs::Skill_Element[skill_id][1])
end
end
end
return false unless leon_skill_level_levelcheck(skill_id)
return false unless leon_skill_level_skillcheck(skill_id)
if not skill_learn?(skill_id)
return false
end
if skill_level[skill_id] == 0
return false
end
return super
end
def leon_skill_level_levelcheck(skill_id)
reqs = Skill_Level
if reqs::Level_Req.has_key?(skill_id)
unless level >= reqs::Level_Req[skill_id]
return false
end
end
return true
end
def leon_skill_level_skillcheck(skill_id)
reqs = Skill_Level
if reqs::Skill_Req.has_key?(skill_id)
skill_number = reqs::Skill_Req[skill_id][0]
unless skill_level[skill_number] >= reqs::Skill_Req[skill_id][1]
return false
end
end
return true
end
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
@skill_points += SKILL_POINTS
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
end
while @exp < @exp_list[@level]
@level -= 1
end
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Window_Skill
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Window_Skill
#--------------------------------------------------------------------
# Constant Listings
#--------------------------------------------------------------------
PASSIVE_SKILL_ID = 19
#--------------------------------------------------------------------
# Alias Listings
#--------------------------------------------------------------------
alias leon_ws_skill_level_refresh refresh
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
if @actor.skill_level[skill.id] > 0
unless skill.element_set.include?(PASSIVE_SKILL_ID)
@data.push(skill)
end
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
for i in 0...@item_max
draw_item(i)
end
end
end
end
#----------------------------------------------------------------------
# Window_Skillinfo Info Window
#----------------------------------------------------------------------
class Window_Skillinfo < Window_Base
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
def update(help_text)
self.contents.clear
self.contents.draw_text(0, 0, 600, 32, help_text)
end
end
#----------------------------------------------------------------------
# Window_Skillhero Hero Window
#----------------------------------------------------------------------
class Window_Skillhero < Window_Base
def initialize(actor)
super(0, 64, 180, 128)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@actor = actor
refresh
end
def refresh
self.contents.clear
draw_actor_name(@actor, 50, 0)
draw_actor_class(@actor, 50, 32)
self.contents.draw_text(100, 64, 40, 32, @actor.skill_points.to_s)
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 45, 32, "Name:")
self.contents.draw_text(0, 32, 45, 32, "Class:")
self.contents.draw_text(0, 64, 95, 32, "Skill Points:")
end
end
#----------------------------------------------------------------------
# Window_Skillpre Prerequisite Window
#----------------------------------------------------------------------
class Window_Skillpre < Window_Base
def initialize(skill)
super(0, 288, 180, 192)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
def update(skill)
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 140, 32, "Prerequisites:")
self.contents.draw_text(4, 32, 140, 32, "Level:")
self.contents.draw_text(4, 64, 45, 32, "Skill:")
self.contents.font.color = normal_color
reqs = Skill_Level
if reqs::Level_Req.has_key?(skill.id)
self.contents.draw_text(55, 32, 140, 32, reqs::Level_Req[skill.id].to_s)
else
self.contents.draw_text(55, 32, 140, 32, "None")
end
if reqs::Skill_Req.has_key?(skill.id)
self.contents.draw_text(8, 96, 140, 32, reqs::Skill_Req[skill.id][2].to_s)
self.contents.draw_text(8, 128, 140, 32, "Lvl: " + reqs::Skill_Req[skill.id][1].to_s)
else
self.contents.draw_text(8, 96, 140, 32, "None")
end
end
def update1
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 140, 32, "Prerequisites:")
self.contents.draw_text(4, 32, 140, 32, "Level:")
self.contents.draw_text(4, 64, 45, 32, "Skill:")
end
end
#----------------------------------------------------------------------
# Window_Skilllist List Window
#----------------------------------------------------------------------
class Window_Skilllist < Window_Selectable
#--------------------------------------------------------------------
# Set Passive Skill ID here.
#--------------------------------------------------------------------
PASSIVE_SKILL_ID = 19
def initialize(actor)
super(180, 64, 460, 416)
@column_max = 2
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@actor = actor
self.active = false
self.index = -1
end
def skill
if @data !=nil
return @data[@index]
end
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
unless skill.element_set.include?(PASSIVE_SKILL_ID)
@data.push(skill)
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
skill = @data[index]
if @actor.skill_can_learn?(skill.id) == true
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
unless skill.element_set.include?(PASSIVE_SKILL_ID)
x = 4 + index % 2 * (195 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 134, 32, skill.name, 0)
if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
self.contents.font.color = Color.new(40, 250, 40, 255)
self.contents.draw_text(x +155, y, 100, 32, "Max")
else
self.contents.font.color = Color.new(250, 250, 13, 255)
self.contents.draw_text(x + 159, y, 100, 32,
(@actor.skill_level[skill.id].to_s) + "/" + (@actor.skill_max[skill.id].to_s))
end
end
end
def refresh1
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
if skill.element_set.include?(PASSIVE_SKILL_ID)
@data.push(skill)
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
for i in 0...@item_max
draw_item1(i)
end
end
end
def draw_item1(index)
skill = @data[index]
if @actor.skill_can_learn?(skill.id) == true
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
if skill.element_set.include?(PASSIVE_SKILL_ID)
x = 4 + index % 2 * (195 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 134, 32, skill.name, 0)
if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
self.contents.font.color = Color.new(40, 250, 40, 255)
self.contents.draw_text(x +155, y, 100, 32, "Max")
else
self.contents.font.color = Color.new(250, 250, 13, 255)
self.contents.draw_text(x + 159, y, 100, 32,
(@actor.skill_level[skill.id].to_s) + "/" + (@actor.skill_max[skill.id].to_s))
end
end
end
end
#----------------------------------------------------------------------
# Window_Skilldesc
#----------------------------------------------------------------------
class Window_Skilldesc < Window_Base
#--------------------------------------------------------------------
# Set Passive skill ID to the same as above.
# Set INCREASE_PER_LEVEL the same as the ones above
#--------------------------------------------------------------------
PASSIVE_SKILL_ID = 19
INCREASE_PER_LEVEL = 10
def initialize(actor, skill)
super(45, 40, 550, 400)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@actor = actor
self.visible = false
self.z = 1000
end
def refresh(skill)
self.contents.clear
@actor.skill_can_use?(skill.id)
bitmap = RPG::Cache.icon(skill.icon_name)
self.contents.font.color = system_color
#Draws 'Elements:'
self.contents.draw_text(205, 96, 120, 32, "Elements:")
#Draws the word for SP
self.contents.draw_text(410, 0, 80, 32, $data_system.words.sp + ":")
#Draws 'Skill Level:'
self.contents.draw_text(200, 0, 120, 32, "Skill Level:")
#Draws 'Cures:'
self.contents.draw_text(0, 96, 120, 32, "Cures:")
#Draws 'Inflicts:'
self.contents.draw_text(0, 228, 120, 32, "Inflicts:")
#Draws 'Next Level's Range:'
self.contents.draw_text(355, 96, 165, 32, "Next Level's Range:", 1)
#Attack Influence
self.contents.font.size = 18
#Draws 'Increase per Level:'
self.contents.draw_text(145, 324, 150, 32, "Increase per Level:")
#Draws 'Range'
self.contents.draw_text(345, 304, 165, 32, "Range:")
#Draws Attack Type
self.contents.draw_text(345, 324, 120, 32, "Skill Type:")
#Draws 'Attack' influence
self.contents.draw_text(145, 228, 120, 32, "Atk Influence:")
#Draws 'PDEF' influence
self.contents.draw_text(145, 247, 120, 32, "P-DEF Influence:")
#Draws 'MDEF' influence
self.contents.draw_text(145, 266, 120, 32, "M-DEF Influence:")
#Draws 'Accuracy'
self.contents.draw_text(145, 285, 120, 32, "Accuracy:")
self.contents.font.size = $defaultfontsize
self.contents.font.color = normal_color
#Sets Icon Opacity
opacity = self.contents.font.color == normal_color ? 255 : 128
#Draws Icon
self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
#Draws Skill Name
self.contents.draw_text(28, 0, 184, 32, skill.name, 0)
#Draws SP cost
self.contents.draw_text(450, 0, 90, 32, skill.sp_cost.to_s)
#Draws Skill Level Number
self.contents.font.color = Color.new(250, 250, 13, 255)
self.contents.draw_text(290, 0, 50, 32,
(@actor.skill_level[skill.id]).to_s + "/" + (@actor.skill_max[skill.id]).to_s)
self.contents.font.color = normal_color
#Draws Skill Description
self.contents.draw_text(4, 48, 330, 32, skill.description)
#Draws Atk Influence
self.contents.font.size = 18
#Draws Skill Type
if skill.atk_f > 0
self.contents.draw_text(420, 324, 80, 32, "Physical")
else
self.contents.draw_text(420, 324, 80, 32, "Magical")
end
self.contents.draw_text(235, 228, 30, 32, skill.atk_f.to_s, 2)
self.contents.draw_text(254, 247, 30, 32, skill.pdef_f.to_s, 2)
self.contents.draw_text(257, 266, 30, 32, skill.mdef_f.to_s, 2)
self.contents.draw_text(210, 285, 30, 32, skill.hit.to_s, 2)
#Draws % increase
self.contents.draw_text(277, 324, 50, 32, "+" + INCREASE_PER_LEVEL.to_s + "%")
#Draws Range
case skill.scope
when 0
self.contents.draw_text(399, 304, 165, 32, "None")
when 1
self.contents.draw_text(399, 304, 165, 32, "One Enemy")
when 2
self.contents.draw_text(399, 304, 165, 32, "All Enemies")
when 3
self.contents.draw_text(399, 304, 165, 32, "One Ally")
when 4
self.contents.draw_text(399, 304, 165, 32, "All Allies")
when 5
self.contents.draw_text(399, 304, 165, 32, "Ko'ed Allies")
when 6
self.contents.draw_text(399, 304, 165, 32, "User")
end
self.contents.font.size = $defaultfontsize
#Formulas for Next Level Range #Formula for when skills level up
power1 = (((INCREASE_PER_LEVEL * 0.01 * @actor.skill_level[skill.id])* skill.power) + skill.power)
power2 = (((INCREASE_PER_LEVEL * 0.01 * (@actor.skill_level[skill.id] +1))* skill.power) + skill.power)
#Draws Range
next_level_range = (power2 * (skill.variance * -0.01) + power2).to_s + " - " + (power2 * (skill.variance * 0.01) + power2).to_s
next_level_range2 = ((power2 * (skill.variance * -0.01) + power2) * -1).to_s + " - " + ((power2 * (skill.variance * 0.01) + power2) * -1).to_s
#Draws skill elements.
elements = []
skill.element_set.each do |i|
unless [PASSIVE_SKILL_ID].include?(i)
elements << $data_system.elements[i]
end
end
for i in 0...elements.size
self.contents.font.size = 16
self.contents.draw_text(165 + ((i % 2) * 94), 120 + (i / 2 * 12), 120, 32, elements[i])
end
#Draws negated effects
minus_status_data = []
for i in 1...$data_states.size
if skill.minus_state_set.include?(i)
minus_status_data.push($data_states[i].name)
end
end
for i in 0...minus_status_data.size
self.contents.font.size = 16
self.contents.draw_text(0 + ((i % 2) * 85), 120 + (i / 2 * 12), 120, 32, minus_status_data[i])
end
#Draws added statuses
plus_status_data = []
for i in 1...$data_states.size
if skill.plus_state_set.include?(i)
plus_status_data.push($data_states[i].name)
end
end
for i in 0...plus_status_data.size
self.contents.font.size = 16
self.contents.draw_text(0 + ((i % 2) * 85), 252 + (i / 2 * 12), 120, 32, plus_status_data[i])
end
#If skill is a heal skill...
if skill.power < 0
self.contents.font.size = $defaultfontsize
self.contents.font.color = system_color
self.contents.draw_text(355, 32, 165, 32, "Heal Range:", 1)
self.contents.draw_text(355, 160, 170, 32, "Level's Healing Avg:")
self.contents.draw_text(355, 228, 165, 32, "Next Level's Avg:", 1)
self.contents.font.color = Color.new(64, 245, 128, 255)
#If skill_level is higher than 0...
if @actor.skill_level[skill.id] > 0
#Draw level's Heal Range
self.contents.draw_text(355, 64, 165, 32, (((skill.variance * -0.01) * power1 + power1) * -1).to_s + " - " + (((skill.variance * 0.01) * power1 + power1) * -1).to_s, 1)
else
#Draw level 0's heal range
self.contents.draw_text(355, 64, 165, 32, 0.to_s + " - " + 0.to_s, 1)
end
#If skill_level is higher than 0...
if @actor.skill_level[skill.id] > 0
#Draw's Level's current average power
self.contents.draw_text(355, 192, 165, 32, (power1 * -1).to_s, 1)
else
#Draws Level's Healing Average Power
self.contents.draw_text(355, 192, 165, 32, 0.to_s, 1)
end
#Draws Next level's Healing Average
if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
self.contents.draw_text(355, 260, 165, 32, "----------", 1)
else
self.contents.draw_text(355, 260, 165, 32, (power2 * -1).to_s, 1)
end
#Draws Next level's range
if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
self.contents.draw_text(355, 128, 165, 32, "----------", 1)
else
self.contents.draw_text(355, 128, 165, 32, next_level_range2, 1)
end
self.contents.font.color = normal_color
else
self.contents.font.size = $defaultfontsize
self.contents.font.color = system_color
self.contents.draw_text(355, 32, 165, 32, "Power Range:", 1)
self.contents.draw_text(355, 160, 165, 32, "Level's Power Avg:", 1)
self.contents.draw_text(355, 228, 165, 32, "Next Level's Avg:", 1)
self.contents.font.color = Color.new(210, 37, 2, 255)
#If skill_level is higher than 0...
if @actor.skill_level[skill.id] > 0
#Draw Damage Range
self.contents.draw_text(355, 64, 165, 32, ((skill.variance * -0.01) * power1 + power1).to_s + " - " + ((skill.variance * 0.01) * power1 + power1).to_s, 1)
else
#Draw level 0's range
self.contents.draw_text(355, 64, 165, 32, 0.to_s + " - " + 0.to_s, 1)
end
#If skill_level is higher than 0...
if @actor.skill_level[skill.id] > 0
#Draw Damage Average
self.contents.draw_text(355, 192, 165, 32, power1.to_s, 1)
else
#Draw level 0's Avg
self.contents.draw_text(355, 192, 165, 32, 0.to_s, 1)
end
#Draw's Next Level's Avg.
if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
self.contents.draw_text(355, 260, 165, 32, "----------", 1)
else
self.contents.draw_text(355, 260, 165, 32, power2.to_s, 1)
end
#Draw's Next Level's Range
if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
self.contents.draw_text(355, 128, 165, 32, "----------", 1)
else
self.contents.draw_text(355, 128, 165, 32, next_level_range, 1)
end
self.contents.font.color = normal_color
end
end
end
#===================================
# Window_Confirm
#===================================
class Window_Skillconfirm < Window_Selectable
def initialize
super(256, 192, 128, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
self.visible = false
self.z = -1000
self.index = -1
self.active = false
end
def refresh
self.contents.clear
@data = [self.contents.draw_text(0, 0, 96, 32, "Yes", 1), self.contents.draw_text(0, 32, 96, 32, "No", 1)]
@item_max = @data.size
end
end
#+++++++++++++++++++++++++++++++++++
# Scene_Skill_Level
#+++++++++++++++++++++++++++++++++++
class Scene_Skill_Level
def initialize(actor_index = 0, skilltype_index = 0)
@actor_index = actor_index
@skilltype_index = skilltype_index
end
def main
@actor = $game_party.actors[@actor_index]
@skillinfo_window = Window_Skillinfo.new
@skillhero_window = Window_Skillhero.new(@actor)
@skilllist_window = Window_Skilllist.new(@actor)
@skillpre_window = Window_Skillpre.new(@skilllist_window.skill)
@skilldesc_window = Window_Skilldesc.new(@actor, @skilllist_window.skill)
@confirm_window = Window_Skillconfirm.new
@skill = @skilllist_window.skill
c1 = "Active"
c2 = "Passive"
@skilltype_window = Window_Command.new(180, [c1, c2])
@skilltype_window.y = 192
@skilltype_window.index = @skilltype_index
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@skillinfo_window.dispose
@skillhero_window.dispose
@skillpre_window.dispose
@skilllist_window.dispose
@skilltype_window.dispose
@skilldesc_window.dispose
@confirm_window.dispose
end
def update
@skillhero_window.update
@skilltype_window.update
@skilldesc_window.update
@skillpre_window.update1
if @skilltype_window.active
update_skilltype
return
end
if @skilllist_window.active
update_skilllist
return
end
if @skilldesc_window.visible
update_skilldesc
return
end
if @confirm_window.active
update_confirm
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill_level.new
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill_level.new
end
end
def update_skilltype
if @skilltype_window.index == 0
@skillinfo_window.update("Shows active skills.")
@skilllist_window.refresh
if Input.trigger?(Input::C)
@skilltype_window.active = false
@skilllist_window.active = true
@skilllist_window.index = 0
end
else
@skillinfo_window.update("Shows passive skills.")
@skilllist_window.refresh1
if Input.trigger?(Input::C)
@skilltype_window.active = false
@skilllist_window.active = true
@skilllist_window.index = 0
end
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill_level.new(@actor_index)
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill_level.new(@actor_index)
end
if Input.trigger?(Input::B)
$scene = Scene_Map.new
end
end
def update_skilllist
@skillpre_window.update(@skilllist_window.skill)
@skilllist_window.update
@confirm_window.z = -1000
@skillinfo_window.update("Press 'A' for Skill Description")
if Input.trigger?(Input::B)
@skilllist_window.index = -1
@skilllist_window.active = false
@skilltype_window.active = true
return
end
if Input.trigger?(Input::A)
if @skilllist_window.skill != nil
@skilldesc_window.refresh(@skilllist_window.skill)
@skilllist_window.active = false
@skilldesc_window.visible = true
else
$game_system.se_play($data_system.buzzer_se)
end
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill_level.new(@actor_index)
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill_level.new(@actor_index)
end
if Input.trigger?(Input::C)
skill = @skilllist_window.skill
if skill != nil
if @actor.skill_can_learn?(skill.id) == true
if @actor.skill_level[@skilllist_window.skill.id] < @actor.skill_max[@skilllist_window.skill.id]
if @actor.skill_points > 0
@confirm_window.refresh
@skilllist_window.active = false
@confirm_window.active = true
@confirm_window.visible = true
@confirm_window.index = 0
else
$game_system.se_play($data_system.buzzer_se)
end
else
$game_system.se_play($data_system.buzzer_se)
end
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
end
def update_skilldesc
if @skilldesc_window.visible == true
@skilllist_window.active = false
if Input.trigger?(Input::B)
@skilldesc_window.visible = false
@skilllist_window.active = true
end
end
end
def update_confirm
@skillpre_window.update(@skilllist_window.skill)
@confirm_window.z = 1000
@confirm_window.update
@skillinfo_window.update("Are you sure?")
if Input.trigger?(Input::B)
@confirm_window.active = false
@confirm_window.visible = false
@skilllist_window.active = true
end
if Input.trigger?(Input::C)
if @skilltype_window.index == 0
case @confirm_window.index
when 0
@actor.skill_level[@skilllist_window.skill.id] += 1
@actor.skill_points -= 1
@skillhero_window.refresh
@skilllist_window.refresh
@confirm_window.visible = false
@skilllist_window.active = true
@confirm_window.index = -1
return
when 1
@confirm_window.visible = false
@skilllist_window.active = true
@confirm_window.index = -1
end
else
case @confirm_window.index
when 0
@actor.skill_level[@skilllist_window.skill.id] += 1
@actor.skill_points -= 1
@skillhero_window.refresh
@skilllist_window.refresh1
@confirm_window.visible = false
@skilllist_window.active = true
@confirm_window.index = -1
return
when 1
@confirm_window.visible = false
@skilllist_window.active = true
@confirm_window.index = -1
end
end
end
end
end