06-30-2009, 01:00 PM
Passive Skills
Leon Westbrooke
Jun 30 2009
Purpose:
This script allows passive skills to add to base stats on a percentage basis. So if you want a skill to add 5% to HP, you can do so with this script.
Additional Features
Stat Enhancement skills, Elemental defense skills, Elemental Absorb skills, and State Defense skills.
Instructions
Place this script above main, but below all other default scripts. Then follow the examples in the module, to create more skills that add passive bonuses. Like this example:
Skill 1 will add 5% to the bearer's base HP. Skill 2 adds 5% to the actors base HP and SP.
Credits
Just.. to Leon_Westbrooke, i guess. lol
Leon Westbrooke
Jun 30 2009
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Purpose:
This script allows passive skills to add to base stats on a percentage basis. So if you want a skill to add 5% to HP, you can do so with this script.
Additional Features
Stat Enhancement skills, Elemental defense skills, Elemental Absorb skills, and State Defense skills.
Instructions
Place this script above main, but below all other default scripts. Then follow the examples in the module, to create more skills that add passive bonuses. Like this example:
Code:
#--------------------------------------------------------------------
# Passive_Skills = { skill_id => {'stat' => amount,..},..}
# stats: 'hp', 'sp', 'str', 'dex', 'agi', 'int', 'eva', 'atk', 'pdef', 'mdef'
#--------------------------------------------------------------------
Passive_Skills = {
1 => {'hp' => 5},
2 => {'hp' => 5, 'sp' => 5}
}
Skill 1 will add 5% to the bearer's base HP. Skill 2 adds 5% to the actors base HP and SP.
Credits
Just.. to Leon_Westbrooke, i guess. lol
code
Code:
#===============================================================================
# Passive Skills, by Leon_Westbrooke
# v. 1.2
#----------------------------------------------------------------------
# Instructions: Put below all default scripts, and above Main
#
# Features: Creates passive skills that adds to the stats:
# HP, SP, STR, DEX, AGI, INT, EVA, Atk, PDef, MDef
#
# Adds stats based on a percentage. (so, 100% will double that stat.)
#
# To have a skill lower stats, make the number negative in the module.
#
# Compatability:
# There are no known clashes with other scripts.
#
# Notes:
# This script aliases the stats in Game_Actor, and rewrites the refresh
# method in Window_Skill.
#===============================================================================
#===============================================================================
# module Passive_Skills
#===============================================================================
module Passive_Skills
#--------------------------------------------------------------------
# Passive_Skills = { skill_id => {'stat' => amount,..},..}
# stats: 'hp', 'sp', 'str', 'dex', 'agi', 'int', 'eva', 'atk', 'pdef', 'mdef'
#--------------------------------------------------------------------
Passive_Skills = {
134 => {'hp' => 5},
135 => {'hp' => 10},
136 => {'hp' => 15},
137 => {'hp' => 25},
139 => {'sp' => 5},
140 => {'sp' => 10},
141 => {'sp' => 15},
142 => {'sp' => 25},
144 => {'str' => 5},
145 => {'str' => 10},
146 => {'str' => 15},
148 => {'dex' => 5},
149 => {'dex' => 10},
150 => {'dex' => 15},
152 => {'agi' => 3},
153 => {'agi' => 5},
154 => {'agi' => 10},
155 => {'agi' => 15},
157 => {'int' => 5},
158 => {'int' => 10},
159 => {'int' => 15},
161 => {'atk' => 3},
162 => {'atk' => 5},
163 => {'atk' => 10},
165 => {'pdef' => 3},
166 => {'pdef' => 5},
167 => {'pdef' => 10},
168 => {'pdef' => 15},
170 => {'eva' => 3},
171 => {'eva' => 5}
}
#--------------------------------------------------------------------
# Elemental_Defense = { skill_id => element_id
#--------------------------------------------------------------------
Elemental_Defense = {
173 => 1,
174 => 2,
175 => 3,
176 => 4,
177 => 6,
178 => 5,
179 => 8,
180 => 7
}
#--------------------------------------------------------------------
# Absorb_Element = { skill_id => element_id
#--------------------------------------------------------------------
Absorb_Element = {
193 => 2,
200 => 1,
207 => 5,
214 => 6,
221 => 4,
228 => 3
}
#--------------------------------------------------------------------
# State_Defense = { skill_id => state
#--------------------------------------------------------------------
State_Defense = {
182 => 3,
183 => 5,
184 => 18,
185 => 17,
186 => 19
}
end
#===============================================================================
# END module Passive_Skills
#===============================================================================
#===============================================================================
# Game_Actor
#===============================================================================
class Game_Actor < Game_Battler
attr_accessor :passive_hp
attr_accessor :passive_sp
attr_accessor :passive_str
attr_accessor :passive_dex
attr_accessor :passive_agi
attr_accessor :passive_int
attr_accessor :passive_eva
attr_accessor :passive_atk
attr_accessor :passive_pdef
attr_accessor :passive_mdef
alias leon_passiveskills_gameactor_setup setup
alias leon_passiveskills_gameactor_basehp base_maxhp
alias leon_passiveskills_gameactor_basesp base_maxsp
alias leon_passiveskills_gameactor_basestr base_str
alias leon_passiveskills_gameactor_basedex base_dex
alias leon_passiveskills_gameactor_baseagi base_agi
alias leon_passiveskills_gameactor_baseint base_int
alias leon_passiveskills_gameactor_baseeva base_eva
alias leon_passiveskills_gameactor_baseatk base_atk
alias leon_passiveskills_gameactor_basepdef base_pdef
alias leon_passiveskills_gameactor_basemdef base_mdef
def setup(actor_id)
@passive_hp = 0
@passive_sp = 0
@passive_str = 0
@passive_dex = 0
@passive_agi = 0
@passive_int = 0
@passive_eva = 0
@passive_atk = 0
@passive_pdef = 0
@passive_mdef = 0
leon_passiveskills_gameactor_setup(actor_id)
end
def passive_bonus
ps = Passive_Skills
hp = 0
sp = 0
str = 0
dex = 0
agi = 0
int = 0
eva = 0
atk = 0
pdef = 0
mdef = 0
for i in 0...@skills.size
if ps::Passive_Skills.keys.include?(@skills[i])
for j in 0...ps::Passive_Skills[@skills[i]].size
case ps::Passive_Skills[@skills[i]].keys[j]
when 'hp'
hp += ps::Passive_Skills[@skills[i]]['hp']
when 'sp'
sp += ps::Passive_Skills[@skills[i]]['sp']
when 'str'
str += ps::Passive_Skills[@skills[i]]['str']
when 'dex'
dex += ps::Passive_Skills[@skills[i]]['dex']
when 'agi'
agi += ps::Passive_Skills[@skills[i]]['agi']
when 'int'
int += ps::Passive_Skills[@skills[i]]['int']
when 'eva'
eva += ps::Passive_Skills[@skills[i]]['eva']
when 'atk'
atk += ps::Passive_Skills[@skills[i]]['atk']
when 'pdef'
pdef += ps::Passive_Skills[@skills[i]]['pdef']
when 'mdef'
mdef += ps::Passive_Skills[@skills[i]]['mdef']
end
end
end
end
@passive_hp = hp
@passive_sp = sp
@passive_str = str
@passive_dex = dex
@passive_agi = agi
@passive_int = int
@passive_eva = eva
@passive_atk = atk
@passive_pdef = pdef
@passive_mdef = mdef
end
def base_maxhp
ps = Passive_Skills
n = leon_passiveskills_gameactor_basehp
n = n + (n * @passive_hp * 0.01)
passive_bonus
return n.round
end
def base_maxsp
ps = Passive_Skills
n = leon_passiveskills_gameactor_basesp
n = n + (n * @passive_sp * 0.01)
return n.round
end
def base_str
ps = Passive_Skills
n = leon_passiveskills_gameactor_basestr
n = n + (n * @passive_str * 0.01)
return n.round
end
def base_dex
ps = Passive_Skills
n = leon_passiveskills_gameactor_basedex
n = n + (n * @passive_dex * 0.01)
return n.round
end
def base_agi
ps = Passive_Skills
n = leon_passiveskills_gameactor_baseagi
n = n + (n * @passive_agi * 0.01)
return n.round
end
def base_int
ps = Passive_Skills
n = leon_passiveskills_gameactor_baseint
n = n + (n * @passive_int * 0.01)
return n.round
end
def base_atk
ps = Passive_Skills
n = leon_passiveskills_gameactor_baseatk
n = n + (n * @passive_atk * 0.01)
return n.round
end
def base_pdef
ps = Passive_Skills
n = leon_passiveskills_gameactor_basepdef
n = n + (n * @passive_pdef * 0.01)
if n < 0.5
n = 1
end
return n.round
end
def base_mdef
ps = Passive_Skills
n = leon_passiveskills_gameactor_basemdef
n = n + (n * @passive_mdef * 0.01)
return n.round
end
def element_rate(element_id)
# Get values corresponding to element effectiveness
table = [0,200,150,100,50,0,-100]
ps = Passive_Skills
result = table[$data_classes[@class_id].element_ranks[element_id]]
# If this element is protected by armor, then it's reduced by half
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
if armor != nil and armor.guard_element_set.include?(element_id)
result /= 2
end
end
for i in 0...@skills.size
if ps::Elemental_Defense.has_key?(@skills[i])
if ps::Elemental_Defense[@skills[i]] == element_id
result /= 2
end
end
end
for i in 0...@skills.size
if ps::Absorb_Element.has_key?(@skills[i])
if ps::Absorb_Element[@skills[i]] == element_id
result = -100
return result
end
end
end
# If this element is protected by states, then it's reduced by half
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
end
# End Method
return result
end
def state_guard?(state_id)
ps = Passive_Skills
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
end
for i in 0...@skills.size
if ps::State_Defense.has_key?(@skills[i])
if ps::State_Defense[@skills[i]] == state_id
return true
end
end
end
return false
end
end
#===============================================================================
# END Game_Actor
#===============================================================================