KBlueMage XP - kyonides - 08-26-2012
KBlueMage XP
Version: 1.2.1
by Kyonides (Kyonides-Arkanthos)
Introduction
This script is simple in premise, too. If you do not know what a blue mage is, then keep in mind that is a mage who learns skills after being hit by them. I know, it is kind of sadomasochist but Final Fantasy games might be as well. I am aware of the fact that there are other blue mage scripts but I did not care for some weird, unknown reason.
You may also like to pick some states to prevent blue mages from learning new skills. You may enable / disable this by editing the STATESSTOPBML constant boolean value.
Now you can make them fail to learn a new skill every so often, the success rates are configurable. Just take a look at the built-in instructive comments.
You could also force the blue mage to equip an specific accessory before learning a specific set of skills
Demo
Nah, it is not necessary, especially if you are using the XP Default BS.
Script Version 1.2.1
Code: # KBlueMage XP - Default BS Version
# v 1.2.1 - 2012-12-23
# v 1.0 - 2012-08-26
# Scripter: Kyonides-Arkanthos
# No script call needed
module BlueSys
# Hero IDs - They will learn skills right after being hit by them
BLUEMAGES = [8]
# Skill IDs - 0 : all IDs, any other number : those skills can be learned
BLUEMAGIC = [0]
# Skill IDs - Any number : Blue mages cannot learn them
NOBMLEARNING = []
# State IDs - States that may prevent blue mages from learning skills
ANTIBMSTATES = []#[3, 6, 12]
# Boolean (true or false) - States may prevent you from learning skills
STATESTOPBML = false#true
# String - Tell the player that he or she learned a new skill
BMLEARNED = ' aprendiĆ³ la habilidad de '
# This version of my script adds the possibility of failing to learn a skill
# Set to true if you want to always learn the skill, false if you feel lucky
IGNORESUCCESSRATES = false
# How probable is it for the Blue Mage to learn a skill after being hit
# First Level..Last Level => Multiples of 5
SUCCESSRATES = { 1..9 => 15, 10..21 => 20,
22..38 => 25, 39..62 => 30,
63..87 => 35, 88..100 => 40 }
# NO NEED TO EQUIP ACCESSORIES to allow BM to learn some skills: true or false
IGNOREACCESSORIES = false
# Accessory ID => Array of Skill IDs
ACCESSORIES = { 28 => [8, 11] }
@bmlearned = [] # Leave It Alone!!
def self.learned_skill(actor_name, skill)
@bmlearned << [actor_name, $data_skills[skill].name]
end
def self.new_skills; @bmlearned end
def self.clear_skills; @bmlearned.clear end
end
class Array
def shuffle
hsh = {}
self.size.times {|n| index = rand(1000000)
index = !hsh.keys.include?(index)? n : n + rand(1000000)
hsh[index] = self[n] }
hsh.values
end
def shuffle!() self[0..-1] = self.shuffle end
end
class Game_Actor
alias kyon_blue_magic_gm_act_sk_eff skill_effect
def skill_effect(user, skill)
effective = kyon_blue_magic_gm_act_sk_eff(user, skill)
afflicted = antibluemagic_states?
learn_blue_magic(skill, afflicted, effective)
return effective
end
def antibluemagic_states?
return false if @states.empty? or !BlueSys::STATESTOPBML
afflicted = @states.map {|s| break if BlueSys::ANTIBMSTATES.include?(s)}
return afflicted.nil?
end
def learn_blue_magic(skill, afflicted, effective)
if !afflicted and effective and BlueSys::BLUEMAGES.include?(self.id) and
(BlueSys::BLUEMAGIC.include?(skill.id) or BlueSys::BLUEMAGIC[0] == 0)
return if BlueSys::NOBMLEARNING.include?(skill.id)
unless BlueSys::IGNORESUCCESSRATES
key = BlueSys::SUCCESSRATES.keys.select {|k| k.include?(@level) }[0]
success = [true] * (BlueSys::SUCCESSRATES[key] / 5)
success += [nil] * (20 - success.size)
success = success[rand(20)]
return unless success
end
unless BlueSys::IGNOREACCESSORIES
req = BlueSys::ACCESSORIES.select{|a, s| s.include?(skill.id)}.flatten
armorid_ok = req.empty? ? nil : req[0] == @armor4_id
return unless req.empty? or armorid_ok
end
learned = learn_skill(skill.id)
BlueSys.learned_skill(self.name, skill.id) if learned
end
end
end
class Scene_Battle
alias kyon_blue_magic_sc_bat_up_ph4_s6 update_phase4_step6
def update_phase4_step6
if @wait_count > 0
@wait_count -= 1
return
end
unless BlueSys.new_skills.empty?
name, skill = BlueSys.new_skills.shift
@help_window.set_text(name + BlueSys::BMLEARNED + skill, 1)
@help_window.visible = true if !@help_window.visible
@wait_count = 60
end
return if @wait_count > 0
kyon_blue_magic_sc_bat_up_ph4_s6
end
end
Script Version 1.1
Code: # KBlueMage XP - Default BS Version
# v 1.1 - 2012-12-22
# v 1.0 - 2012-08-26
# Scripter: Kyonides-Arkanthos
# No script call needed
module BlueSys
# Hero IDs - They will learn skills right after being hit by them
BLUEMAGES = [8]
# Skill IDs - 0 : all IDs, any other number : those skills can be learned
BLUEMAGIC = [0]
# Skill IDs - Any number : Blue mages cannot learn them
NOBMLEARNING = []
# State IDs - States that may prevent blue mages from learning skills
ANTIBMSTATES = []#[3, 6, 12]
# Boolean (true or false) - States may prevent you from learning skills
STATESTOPBML = false#true
# String - Tell the player that he or she learned a new skill
BMLEARNED = ' aprendiĆ³ la habilidad de '
# This version of my script adds the possibility of failing to learn a skill
# Set to true if you want to always learn the skill, false if you feel lucky
IGNORESUCCESSRATES = false
# How probable is it for the Blue Mage to learn a skill after being hit
# First Level..Last Level => Multiples of 5
SUCCESSRATES = {1..9 => 75, 10..21 => 20,
22..38 => 25, 39..62 => 30,
63..87 => 35, 88..100 => 40}
@bmlearned = [] # Leave It Alone!!
def self.learned_skill(actor_name, skill)
@bmlearned << [actor_name, $data_skills[skill].name]
end
def self.new_skills; @bmlearned end
def self.clear_skills; @bmlearned.clear end
end
class Array
def shuffle
hsh = {}
self.size.times {|n| index = rand(1000000)
index = !hsh.keys.include?(index)? n : n + rand(1000000)
hsh[index] = self[n] }
hsh.values
end
def shuffle!() self[0..-1] = self.shuffle end
end
class Game_Actor
alias kyon_blue_magic_gm_act_sk_eff skill_effect
def skill_effect(user, skill)
effective = kyon_blue_magic_gm_act_sk_eff(user, skill)
afflicted = antibluemagic_states?
learn_blue_magic(skill, afflicted, effective)
return effective
end
def antibluemagic_states?
return false if @states.empty? or !BlueSys::STATESTOPBML
afflicted = @states.map {|s| break if BlueSys::ANTIBMSTATES.include?(s)}
return afflicted.nil?
end
def learn_blue_magic(skill, afflicted, effective)
if !afflicted and effective and BlueSys::BLUEMAGES.include?(self.id) and
(BlueSys::BLUEMAGIC.include?(skill.id) or BlueSys::BLUEMAGIC[0] == 0)
return if BlueSys::NOBMLEARNING.include?(skill.id)
key = BlueSys::SUCCESSRATES.keys.select {|k| k.include?(@level) }[0]
success = [true] * (BlueSys::SUCCESSRATES[key] / 5)
success += [nil] * (20 - success.size)
success = success[rand(20)]
return unless success or BlueSys::IGNORESUCCESSRATES
learned = learn_skill(skill.id)
BlueSys.learned_skill(self.name, skill.id) if learned
end
end
end
class Scene_Battle
alias kyon_blue_magic_sc_bat_up_ph4_s6 update_phase4_step6
def update_phase4_step6
if @wait_count > 0
@wait_count -= 1
return
end
unless BlueSys.new_skills.empty?
name, skill = BlueSys.new_skills.shift
@help_window.set_text(name + BlueSys::BMLEARNED + skill, 1)
@help_window.visible = true if !@help_window.visible
@wait_count = 60
end
return if @wait_count > 0
kyon_blue_magic_sc_bat_up_ph4_s6
end
end
Script Version 1.0
Code: # KBlueMage XP - Default BS Version
# v 1.0 - 2012-08-26
# Scripter: Kyonides
# No script call needed
module BlueSys
# Hero IDs - They will learn skills right after being hit by them
BLUEMAGES = [5]
# Skill IDs - 0 : all IDs, any other number : those skills can be learned
BLUEMAGIC = [0]
# Skill IDs - Any number : Blue mages cannot learn them
NOBMLEARNING = []
# State IDs - States that may prevent blue mages from learning skills
ANTIBMSTATES = [3, 6, 12]
# Boolean (true or false) - States may prevent you from learning skills
STATESTOPBML = true
# String - Tell the player that he or she learned a new skill
BMLEARNED = ' aprendiĆ³ la habilidad de '
@bmlearned = [] # Leave It Alone!!
def self.learned_skill(actor_name, skill)
@bmlearned << [actor_name, $data_skills[skill].name]
end
def self.new_skills; @bmlearned end
def self.clear_skills; @bmlearned.clear end
end
class Game_Actor
alias kyon_blue_magic_gm_act_sk_eff skill_effect
def skill_effect(user, skill)
effective = kyon_blue_magic_gm_act_sk_eff(user, skill)
afflicted = antibluemagic_states?
learn_blue_magic(skill, afflicted, effective)
return effective
end
def antibluemagic_states?
return false if @states.empty? or !BlueSys::STATESTOPBML
afflicted = @states.map {|s| break if BlueSys::ANTIBMSTATES.include?(s)}
return afflicted.nil? ? true : false
end
def learn_blue_magic(skill, afflicted, effective)
if !afflicted and effective and BlueSys::BLUEMAGES.include?(self.id) and
(BlueSys::BLUEMAGIC.include?(skill.id) or BlueSys::BLUEMAGIC[0] == 0)
return if BlueSys::NOBMLEARNING.include?(skill.id)
learned = learn_skill(skill.id)
BlueSys.learned_skill(self.name, skill.id) if learned
end
end
end
class Scene_Battle
alias kyon_blue_magic_sc_bat_up_ph4_s6 update_phase4_step6
def update_phase4_step6
if @wait_count > 0
@wait_count -= 1
return
end
unless BlueSys.new_skills.empty?
name, skill = BlueSys.new_skills.shift
@help_window.set_text(name + BlueSys::BMLEARNED + skill, 1)
@help_window.visible = true if !@help_window.visible
@wait_count = 60
end
return if @wait_count > 0
kyon_blue_magic_sc_bat_up_ph4_s6
end
end
Instructions
Paste below Scene_Debug and above Main. After that, check the Constants included in BlueSys module, edit them and that is pretty much all you need to do besides testing your demo.
FAQ
Nothing to say, yet.
Compatibility
Designed for RPG Maker XP. The little window telling you about having learned a new skill as a blue mage is just for XP Default BS.
Terms and Conditions
Free for use but not meant for commercial projects. Due credit is not optional but a must.
RE: KBlueMage XP - kyonides - 12-23-2012
UPDATED!!
Now you can configure the script to let the blue mage fail to learn a new skill, but it's still possible to disable this new feature.
RE: KBlueMage XP - kyonides - 12-23-2012
UPDATED ONCE AGAIN!!
Now you can configure the script to force the blue mage to equip an accessory before learning specific skill(s), but it's still possible to disable this new feature. If the "ignore success rates" feature is disabled, you may still not learn the skill even if you equipped the required accessory because Lady Fortune didn't want to smile at you.
|