In my game, I'm planning for a system where the base damage an actor does with a weapon, further altered by skill formulae, is dependent on his skill (out of 100) with the weapon he has equipped (e.g., value = a.atk * weapskill/50), and where a percentage of each battle's EXP is put towards advancing the actor's weapon rank.
Finding no such script for RMVXA, I came upon a script called "Weapons by Ranks" for RMVX:
http://www.rpgrevolution.com/forums/?showtopic=17705(which requires TagNote(2.0):
http://www.rpgrevolution.com/forums/index.php?showtopic=10804)
Using my rudimentary knowledge of RGSS2/3, I managed to translate/alter enough of it get it to a half-working state, mainly altering things like how RGSS3 handles windows and scenes and changing some terminology here and there. I noticed, however, that the script makes up for features that are now existing in RMVXA that didn't in RMVX, like weapon types and finding terms in notetags. Also, the original script's use of rank titles (e.g., "Rookie", "Master") weren't really what I was going for; trying to have ranks instead of "0", "1", "2" and so-on is kind of impractical. I'm still kind of hung up on how to give the weapon rank its own EXP, as well; that part of the script didn't translate too well.
In short, I would like the script, being inefficient and outdated but still having the functionality that I need, instead of having its own Weapon Types, to access and display the database's "Weapon Types", (thereby not needing to read anything in weapon notetags) as well as have removed the "rank titles" in favor of a straight "out of 100" rank system.
Here is the script I'm using right now, which works right up until the end-of-battle scene where EXP is given, then displaying an error of: "Script 'Weapon By Ranks' line121: TypeError occurred. no implicit conversion from nil to integer."
################################################################################
# Script: Weapons by ranks
# Version: 1.2
# Author: uresk (AKA 332211)
# Requires: Tagnote 2.0+ (by Queex)
################################################################################
#
# Customize: RANKS
# RANKS = [lowest to highest]
# RANKS = ["None","Rookie","Master"]
#
# Customize: $exp_ranks
# $exp_ranks = [0, exp needed for rank 1, exp for rank 2...]
# $exp_ranks = [0,100,5000,10000]
#
# Customize: EXP_rate
# regular experience multiplier:
# Ex: You kill Rat and win 13 exp, exp for ranks will be 13 * EXP_rate
# EXP_rate = number
#
# Customize: $weapon_skills
# names of your skills in weapons; must be one word
# $weapon_skills = ["Swords","Bows","Staffs"]
#
# Change_Damage = true
# True: the actor's rank will afect regular attack damage
# False: nothing happens
#
# Damage_multiplier = [0.75, 1, 1.25]
# Ex: If Ralph is a rookie using swords damage will be reduced to 3/4.
# Ex_2: If ralph is a Master damage will be multiplied by 5/4
#
# Change_crit = true
# True: the actor's rank will afect regular critical chance
# False: nothing happens
#
# Added_crit = [0, 2, 4]
# Ex: If Ralph's a rookie no bonus critical but if he is a master
# the chance for critical will go up by 4%
#
# Critical_Adjustment = 3
# Critical damage multiplier
# Critical damage = damage * Critical_Adjustment
#
# Customize: Class_Limit
# True: a hero can only equip weapons assigned for his class
# False: a hero can equip every weapon, regardless of his class
#
################################################################################
#
# Database
# In the notes field of a weapon write down <mastery Swords> or <mastery Bows>
# to determine weapon 'type' and <rank None>,<rank Rookie> to choose the rank
# needed to equip that weapon.
#
################################################################################
#==============================================================================#
# ** Begin Configuration
#==============================================================================#
module Vocab
Rank_Up = "%s is a %s using %s." #message for when rank goes up
#%s - actor name; new rank; rank type
Show_in_Menu = false #true: rankings can be show in the Menu
#false: rankings are not shown in the menu
#and must be called with '$scene = Scene_weapon_by_ranks.new'
Menu_Ranks = "Rankings" #word that shows up in the menu
end
module Ranks
RANKS = ["0","1","2","3","4","5","6","7","8","9","10"] #ranks from lowest to highest1
$exp_ranks = [0,10,25,45,70,100,135,175,220,270] #defines experience
#needed for each rank
EXP_rate = 1 #experience multiplier
$weapon_skills = ["Unarmed","Sword1H", "Sword2H", "Hammer1H", "Hammer2H", "Axe1H", "Axe2H", ]
Unarmed_tag_id = 0 #"unarmed name positon
Change_Damage = true #the actor's rank will afect regular attack damage
Damage_multiplier = [1,1.05,1.1,1.15,1.2,1.25,1.3,1.35,1.4,1.45,1.5] #damage multiplier
Change_crit = false #the actor's rank will afect regular critical chance
Added_crit = [0, 2, 4] #critical chance = regular critical + Added_critical
Critical_Adjustment = 2 #critical damage multiplier
Class_Limit = false #if true: can only equip weapons checked in the class
#Equippable Weapons list.
#false: can equip every weapon, only depending on the rank
end
#==============================================================================#
# ** End Configuration #
# unless you know what you're doing, don't change the script from here on!
#==============================================================================#
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
include TAGNOTE #include TagNote
include Ranks #get custom defenitions
attr_accessor :weapon_skill_rank #set object
alias initialize_with_ranks initialize #reset actor initialize def
def initialize(actor_id)
initialize_with_ranks(actor_id) #do regular initialize
@weapon_skill_rank = [] #clear weapon_skill_rank
for i in 0...$weapon_skills.size do #sets starting rank
@weapon_skill_rank[i] = RANKS[0] #as the 1st Rank
end
@ws_exp = [] #clear ws_exp
end
alias gain_w_exp gain_exp #redefining gain_exp
def gain_exp(exp)
gain_w_exp(exp) # do regular exp_gain
if @weapon_id != 0 # if weilding a weapon
ws = get_tag($data_weapons[@weapon_id].note,"mastery")
@ws_i = $weapon_skills.index(ws) #turn weapon type into index
else
@ws_i = Unarmed_tag_id
end
if @ws_exp[@ws_i] != nil
then $exp_temp = @ws_exp[@ws_i] + exp * EXP_rate #calcs experience
else #if it's the first time
$exp_temp.to_i #calcs experience
$exp_temp = exp * EXP_rate
end
@ws_exp.delete_at(@ws_i) #deletes old experience
@ws_exp.insert @ws_i,$exp_temp #replaces with new experience value
rank_index = RANKS.index(@weapon_skill_rank[@ws_i]) #weapon rank --> rank index
for i in 1...$exp_ranks.size do # compares experience with exp need to the next rank
if $exp_ranks[i] <= $exp_temp # if exp needed < current exp
if rank_index >= i # and the rank index is not lower
then next # goes to the next rank
else @weapon_skill_rank[@ws_i] = RANKS[i] #else assigns new rank
end
ws = $weapon_skills[Unarmed_tag_id] if ws == nil
text = sprintf(Vocab::Rank_Up,actor.name,RANKS[i],ws) #prints
$game_message.texts.push('\.' + text) #rank up message
end
end
end
end
class Game_Battler
include TAGNOTE
include Ranks
alias wbr_make_damage_value make_damage_value
def make_damage_value(user, item)
value = item.damage.eval(user, self, $game_variables)
if user.is_a?(Game_Actor)
@actor = user
if @actor.equips[0] != nil
if has_tag?(@actor.equips[0].note,"mastery")
mastery = get_tag(user.equips[0].note,"mastery")
mastery_index = $weapon_skills.index(mastery)
actor_rank = @actor.weapon_skill_rank[mastery_index]
rank_index = RANKS.index(actor_rank)
end
else
rank_index = Unarmed_tag_id
end
value *= Damage_multiplier[rank_index]
end
value *= item_element_rate(user, item)
value *= pdr if item.physical?
value *= mdr if item.magical?
value *= rec if item.damage.recover?
value = apply_critical(value) if @result.critical
value = apply_variance(value, item.damage.variance)
value = apply_guard(value)
@result.make_damage(value.to_i, item)
end
end
class Scene_weapon_by_ranks < Scene_MenuBase
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_background
@actor = $game_party.members[@actor_index]
@status_window = Window_Ranks.new(@actor)
@status_window.set_handler(:cancel, method(:return_scene))
@status_window.set_handler(:pagedown, method(:next_actor))
@status_window.set_handler(:pageup, method(:prev_actor))
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def on_actor_change
@status_window.actor = @actor
@status_window.activate
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_background
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def on_actor_change
@status_window.actor = @actor
@status_window.activate
end
#--------------------------------------------------------------------------
# * Next Actor
#--------------------------------------------------------------------------
end
class Window_Ranks < Window_Selectable
include TAGNOTE #includes tagnote
include Ranks
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 544, 416)
@actor = actor
refresh
activate
end
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_face(@actor, 8, 32)
draw_actor_level(@actor, 8, 136)
draw_weapons(8, 160)
draw_weapon_skills(222, 40)
end
#--------------------------------------------------------------------------
# * Draw Weapon(s)
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
#--------------------------------------------------------------------------
def draw_weapons(x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y + 24, 120, 24, "Weapon:")
draw_item_name(@actor.equips[0], x, y + 24 * 2)
self.contents.font.color = system_color
self.contents.draw_text(x, y + 24 * 3, 120, 24, "Type:")
self.contents.font.color = normal_color
if @actor.equips[0] != nil
if has_tag?(@actor.equips[0].note,"mastery") == true
@skill = get_tag(@actor.equips[0].note,"mastery")
end
else
@skill = $weapon_skills[Unarmed_tag_id]
end
self.contents.draw_text( x, y + 24 * 4, 120, 24, @skill)
self.contents.font.color = system_color
self.contents.draw_text(x, y + 24 * 5, 120, 24, "Rank:")
self.contents.font.color = normal_color
if @actor.equips[0] != nil
then if has_tag?(@actor.equips[0].note,"rank") == true
then rank = get_tag(@actor.equips[0].note,"rank")
self.contents.draw_text( x, y + 24 * 6, 120, 24, rank)
end
end
end
#--------------------------------------------------------------------------
# * Draw Weapon Skills
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
#--------------------------------------------------------------------------
def draw_weapon_skills(x, y)
for i in 0...$weapon_skills.size do
if $weapon_skills[i] == @skill #goes through weapon types
then self.contents.font.color = system_color #if matches the current weapon type
else self.contents.font.color = normal_color #has a different color
end
self.contents.draw_text( x, y, 200, 2 * 24 * (i + 1), $weapon_skills[i]) #draws weapon types
self.contents.draw_text( x + 200, y, 50, 2 * 24 * (i + 1), @actor.weapon_skill_rank[i]) #draws weapon ranks
end
end
end
Thanks! Any help is appreciated!