Help with a damage formula

I want to make a formula that uses the next things:
User attack and the defense parameter of the shield equiped.
The problem is how can I add that defense parameter to the formula, I think it's not a way to do that. Any suggesstions?
Not sure you can add the parameters of an item to a damage formula. There are a few ways you can accomplish this however.

1. You can make a skill that is learned when the shield is equipped, and add the shield's defense as a raw number in the damage formula. You can do this with each shield in your game. The only downside is if you have a ton of shield variations or are using a prefix/suffix generator that messes with stats.

2. You can attach a common event that checks which shield you have equipped and add a specific amount of damage to the skill through "Damage Enemy". It won't be part of the formula, and won't multiply on critical hits.

Either way will work, but like I stated it's tedious if you have many variations of shields.
the easiest way is to use this in your formula


Code:
$dataWeapons[a._equips[1]._itemId].params[3] //if sheild a weapon
$dataArmors[a._equips[1]._itemId].params[3]  //if sheild a Armour
the easiest way is to use this in your formula


Code:
$dataWeapons[a._equips[1]._itemId].params[3] //if sheild a weapon
$dataArmors[a._equips[1]._itemId].params[3]  //if sheild a Armour
It doesn't work for me.
it says that undefined is not a function.
This is my formula:
a.atk + $dataArmors[a._equips[1]._itemId].params[3] * 5
that formula works.... i do 76 damage with 16 strength 10 weapon attack and a sheild with 10 defense. remeber a.atk is the weapons attk power + user strength (10 + 16).

26 + (10 * 5) = 76.

with a sheild with 14 Defense i do 96 damage
26 + (14 * 5) = 96

However if the user has no sheild equiped the damage will always be zero

I dont get an error of any kind.

Original thread: https://forums.rpgmakerweb.com/threads/help-with-a-damage-formula.79827/