Weapon Damage Formulas
Version: 1.0.0
Author: modern algebra
Date: 22 September 2012
Version History
- <Version 1.0> 2012.09.22 - Original Release
Description
By default, every weapon invokes Skill 1 when it is used, which means that every weapon has the same damage formula. This script makes it so that you can customize what skill is invoked when a weapon is used, thus allowing you to control any aspect of that attack just as you could any skill. If you want a weapon that does MP damage, for instance, this script lets you make it. If you want a weapon that targets all enemies or a weapon with a different damage formula and different use message, then you can do that too.
Please note that if an actor is dual wielding, it will only run the damage formula for the item in the primary hand.
Features
- For each weapon, you can customize the formula used to calculate damage
- You can make some weapons that drain HP or MP or any other damage option available for skills
- If you wish, you can change the message that plays based on the weapon used
- For each weapon, you can customize any other option available for skills
Instructions
Paste the script into its own slot in the Script Editor, above Main but below Materials.
For details on configuration, see the header of the script itself.
Script
#==============================================================================
# Weapon Damage Formulas
# Version: 1.0.0
# Author: modern algebra (rmrk.net)
# Date: 22 September 2012
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
#
# By default, every weapon invokes Skill 1 when it is used, which means that
# every weapon has the same damage formula. This script makes it so that you
# can customize what skill is invoked when a weapon is used, thus allowing
# you to control any aspect of that attack just as you could any skill. If
# you want a weapon that does MP damage, for instance, this script lets you
# make it. If you want a weapon with a different damage formula and different
# use message, then you can do that too.
#
# Please note that if an actor is dual wielding, it will only run the damage
# formula for the item in the primary hand. If you want to fix that, I
# suggest you retrieve my "Individual Strikes when Dual Wielding" script,
# available at: http://rmrk.net/index.php/topic,46811.0.html
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# Paste this script into its own slot in the Script Editor, above Main but
# below Materials.
#
# To use this script, simply set up a skill in the database which is the
# skill you want to run when the weapon is used. Then, you can assign that
# skill to the weapon by placing the following code in the weapon's note
# field:
#
# \asid[x]
#
# where x is the ID of the skill you set up.
#
# EXAMPLES:
#
# \asid[3] # This weapon calls skill 3 when it is used.
# \asID[ 46 ] # This weapon calls skill 46 when it is used.
# \ASID[127] # This weapon calls skill 127 when it is used.
#==============================================================================
$imported ||= {}
$imported[:MA_WeaponDamageFormulas] = true
#==============================================================================
# ** RPG::Weapon
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - mawdf_attack_skill_id
#==============================================================================
class RPG::Weapon
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Attack Skill ID
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_writer :mawdf_attack_skill_id
def mawdf_attack_skill_id
unless @mawdf_attack_skill_id
@mawdf_attack_skill_id = note[/\\ASID?\[\s*(\d+)\s*\]/i] ? $1.to_i : -1
end
@mawdf_attack_skill_id
end
end
#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# redefined method - attack_skill_id
#==============================================================================
class Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Attack Skill ID
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
unless instance_methods(false).include?(:attack_skill_id)
# Define the method in the Game_Actor class if undefined. This will ensure
# that any changes to this method in Game_BattlerBase are retained, even if
# the script that does so is below this one.
def attack_skill_id(*args, &block); super; end
end
alias mawdf_atkskillid_4fa6 attack_skill_id
def attack_skill_id(*args, &block)
if !weapons.empty? && weapons[0].mawdf_attack_skill_id > 0
weapons[0].mawdf_attack_skill_id
else
mawdf_atkskillid_4fa6(*args, &block) # Call Original Method
end
end
end
Credit
Support
Please post in this topic at RMRK.net if you have any questions, suggestions, or error reports concerning this script.
Known Compatibility Issues
I am not currently aware of any compatibility issues.
Author's Notes
The reason that this script does not work perfectly with dual wielding is because, by default, dual wielding operates as a single attack, and the only benefit of holding a second weapon is that it increases the atk stat and so increases the damage. In order for me to make it so that dual wielding would integrate more smoothly with this script, I would essentially need to change the way dual wielding works altogether to create two separate attacks, and while that is not particularly difficult, it seemed outside the scope of this otherwise simple script.
For that reason, it is its own script, and if you want actors to be able to dual wield weapons with different damage formulas, then I suggest you retrieve my
Individual Strikes when Dual Wielding script.
Terms of Use
I adopt RMRK's default
Terms of Use.