The third script in my character system scripts.
This one was suggested by Prexus a while back, I only just finished it, college gave me too much work.
Basically it allows the user of a weapon who is a weapon master to become more adept with weapons of that type, doing more damage and learning skills over time.
Now some instructions...
The weapon master's ids go here.
Name refers to the name of the type of weapon while weapons contains all the ids of the weapons of that type.
You use the weapon type's name and then skill level to return a skill's id which the character will learn at the respective level using that weapon type.
The maximum level of adeptness with weapons.
The damage bonus per level of adeptness.
So enjoy.
This one was suggested by Prexus a while back, I only just finished it, college gave me too much work.
Basically it allows the user of a weapon who is a weapon master to become more adept with weapons of that type, doing more damage and learning skills over time.
Code:
#==============================================================================
# Individual Character Development - Weapon Master by Fomar0153
#==============================================================================
class Game_Party
attr_accessor :icd_weapon_masters
attr_accessor :icd_weapon_type
attr_accessor :icd_weapon_type_skills
attr_accessor :icd_weapon_max_level
attr_accessor :icd_weapon_damage_bonus
alias fomar_icd_weapon_master_initialize initialize
def initialize
fomar_icd_weapon_master_initialize
@icd_weapon_masters = [1]
@icd_weapon_type = [
{'name'=>'Sword', 'weapons'=>[1, 2, 3, 4]},
{'name'=>'Spear', 'weapons'=>[5, 6, 7, 8]}
]
@icd_weapon_type_skills = {'Sword1'=>57, 'Sword2'=>58, 'Sword3'=>59, 'Sword4'=>60,
'Spear1'=>61, 'Spear2'=>62, 'Spear3'=>63, 'Spear4'=>64}
@icd_weapon_max_level = 4
@icd_weapon_damage_bonus = 5
end
end
class Game_Actor < Game_Battler
alias fomar_icd_weapon_master_setup setup
def setup(actor_id)
fomar_icd_weapon_master_setup(actor_id)
@icd_weapon_type_levels = {}
for icd_type in $game_party.icd_weapon_type
@icd_weapon_type_levels[icd_type['name']] = 0
end
end
def damage_multiplier
for icd_type in $game_party.icd_weapon_type
if icd_type['weapons'].include?(@weapon_id)
return ((@icd_weapon_type_levels[icd_type['name']])/100) * $game_party.icd_weapon_damage_bonus
end
end
return 0
end
def improve_weapon_use
for icd_type in $game_party.icd_weapon_type
if icd_type['weapons'].include?(@weapon_id)
unless @icd_weapon_type_levels[icd_type['name']] == 100 * $game_party.icd_weapon_max_level
@icd_weapon_type_levels[icd_type['name']] += 1
if (@icd_weapon_type_levels[icd_type['name']] / 100) == (@icd_weapon_type_levels[icd_type['name']].to_f / 100.00)
self.learn_skill($game_party.icd_weapon_type_skills[icd_type['name'] + (@icd_weapon_type_levels[icd_type['name']] / 100).to_s])
end
end
end
end
end
end
class Game_Enemy < Game_Battler
def attack_effect(attacker)
if $game_party.icd_weapon_masters.include?(attacker.id)
attacker.improve_weapon_use
k = super
x = self.damage
self.damage *= (100 + attacker.damage_multiplier)
self.damage /= 100
self.hp -= (self.damage - x)
return k
else
return super
end
end
end
Now some instructions...
Code:
@icd_weapon_masters = [1]
Code:
@icd_weapon_type = [
{'name'=>'Sword', 'weapons'=>[1, 2, 3, 4]},
{'name'=>'Spear', 'weapons'=>[5, 6, 7, 8]}
]
Code:
@icd_weapon_type_skills = {'Sword1'=>57, 'Sword2'=>58, 'Sword3'=>59, 'Sword4'=>60,
'Spear1'=>61, 'Spear2'=>62, 'Spear3'=>63, 'Spear4'=>64}
Code:
@icd_weapon_max_level = 4
Code:
@icd_weapon_damage_bonus = 5
So enjoy.