Wow, that's embarrassing...
Attempt 2:
CODE
#==============================================================================
# ** VXAce: NR's Accurate Weapon Stats
#------------------------------------------------------------------------------
# History:
# Date Created: 5/July/2012
# Created for: mooshra
# @> http://www.rpgrevolution.com/forums/index.php?showtopic=57099
#
# Description:
# This script allows developers to set a weapons parameters as a decimal
# integer
#
# How to Install:
# Copy this entire script. In your game's editor select Tools >>
# Script Editor. Along the left hand side scroll to the bottom, right
# click on after 'Materials' and select 'Insert'. Paste the code in the
# blank window on the right.
#
# How to Use:
# In the Database, look for the weapon under the 'Weapons' tab.
# Create a Note like so:
# [ATK=0.6]
# (case insensitive), to set the attack to 60%
#==============================================================================
#==============================================================================
# ** DataManager
#------------------------------------------------------------------------------
# Edited to get the parameters specified in the weapons notetag
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# * Alias methods
#--------------------------------------------------------------------------
class << self
alias nr_AccWeaponStats_load_normal_database load_normal_database
alias nr_AccWeaponStats_load_battle_test_database load_battle_test_database
end
#--------------------------------------------------------------------------
# * Load Normal Database
#--------------------------------------------------------------------------
def self.load_normal_database(*args, &block)
# Run the original load_normal_database
nr_AccWeaponStats_load_normal_database
# Update the weapons
self.read_nr_weapons_notetags
end
#--------------------------------------------------------------------------
# * Load Battle Test Database
#--------------------------------------------------------------------------
def self.load_battle_test_database
# Run the original load_battle_test_database
nr_AccWeaponStats_load_battle_test_database
# Update the weapons
self.read_nr_weapons_notetags
end
#--------------------------------------------------------------------------
# * Read Weapons Notetags
#--------------------------------------------------------------------------
def self.read_nr_weapons_notetags
# Loop through each weapon
for weapon in $data_weapons
# Skip if its not a weapon
next if not weapon.is_a?(RPG::Weapon)
# Loop through each change listed in the note
changes = weapon.note.scan(/\[(\w{3})\=([^\]]*)\]/)
for change in changes
# Get the parameter to change
parameter = change[0].upcase
# Get the integer value specified
value = change[1].to_f
# Apply the parameter change, noting its position in the @params array
physical_parameters = ["ATK", "DEF", "MAT", "MDEF", "AGI", "LUK"]
magical_parameters = ["MHP", "MMP"]
if physical_parameters.include?(parameter)
index = physical_parameters.index(parameter) + 2
weapon.params[index] = value
elsif magical_parameters.include?(parameter)
index = magical_parameters.index(parameter)
weapon.params[index] = value
end
end
end
end
end