In RPG Maker, weapons can be equipped to actors.
You can also equip them to enemies if you use plugins like Enemy Equips.
Weapons can provide parameter bonuses like extra atk and agi, but you can’t specify a damage value for the weapons themselves.
For example, if you wanted to have the normal attack skill’s damage value to be equal to the amount of damage dealt by the weapon, you would be unable to say this directly.
You could say that the “atk” bonus from the weapon represents how much damage the weapon can do, but if you were to reference the actor’s atk, you would be including any additional atk bonuses that aren’t part of the weapon.
This plugin allows you to define weapon damage formulas, which can be used in your skill formulas if necessary.
By separating the weapon damage from your atk, you have more control over how your want your skills to be set up!
Plugin: download here (right-click, save-as)
Download the plugin and place it in the “plugins” folder in your project’s “js” folder. Then open your Plugin Manager (F10), double-click an empty row, and select the HIME_WeaponDamage plugin.
Once it is in your list of plugins, turn the plugin on.
To define a damage formula for you weapons, note-tag them with
<weapon damage> FORMULA </weapon damage>
For example, let’s say you wanted your weapon’s damage to be between 2 and 16.You could write
2 * (Math.randomInt(8) + 1)
Note that we add 1 because randomInt picks a number between 0 and the value you provided.
For those that are familiar, this is equivalent to 2d8.
So if you wanted to write something like 1d6 + 4, you would write
(1 * (Math.randomInt(6) + 1)) + 4
For now, weapon damages are assumed to be simple.
Using Weapon Damage
Weapon damage formulas are not automatically included in your skill damage calculations, because you may not want to consider the weapon.
For example, if you’re casting a spell and you’re holding a sword, would you include the sword damage in the spell damage? Maybe, maybe not.
To use the weapon damage formula, in your skill formula, you can write
Which will return how much damage the attacker’s weapons dealt, based on the formula that you defined earlier. This value includes all weapons, so if the attacker is holding two weapons or three weapons or more, they will all be included in this total, which you can then use as part of the skill.
So let’s say your normal attack was equal to your weapon’s damage.
You would write
But let’s say you wanted to add a bonus for having extra “atk” power, which could represent your physical strength. You might say
a.weaponDamage(b) + a.atk / 10
Which adds 1 point of damage per 10 points in atk.
The weapon itself may provide atk bonus as well, but it is not necessary.
Now, what happens when you don’t have a weapon? If no weapon is held, weapon damage is assumed to be “bare-hands” damage. Enemies by default are assumed to be bare-handed.
Bare-hands is set up as a weapon in your database. You don’t need to actually hold this in order to use the damage formula, but you could if you wanted to.
In the plugin manager, choose the ID of the weapon that will represent bare-hands, and then set up the weapon damage formulas usual.
This damage formula will be used as the weapon damage.