Hi, so I have two basic skills called "attack" and "sub attack", which are meant to bring damage based on what weapon you're using. So say a player has a sword weapon with 5 attack and a gun weapon with 3 attack, the sword will deal 5 and the gun will deal 3 damage respectively. This is the current formula for attack:
a.weapons[0].params[2] * (a.atk - (a.weapons[0].params[2] + a.armors[0].params[2]))
and this is the formula for sub attack:
a.armors[0].params[2] * (a.atk - (a.weapons[0].params[2] + a.armors[0].params[2]))
The weapons deal their base damage multiplied by the player's base attack stat, not including buffs from their weapons. If the attack stat is boosted to 2, the weapons will deal double damage (10 and 6 respectively). At some point I'm going to improve the formula so I can have attack boosted to 1.25x or 2.5x instead of single digit multipliers, but that'll come later.
Right now the formulas work as intended...but only when I have both weapons equipped. If a player is just wielding a sword without a gun, the sword will deal 0 damage. I had hoped if the gun wasn't equipped, the formula would be "5 * (6-(5-0))" with the armor parameter defaulting to 0 when nothing is equipped, but unfortunately this isn't the case. How could I fix the formula so the player could use one weapon on its own?
Need help with damage formula
● ARCHIVED · READ-ONLY
-
-
'Product Discussion and Support' is for issues with dlc, typically graphic and music Resource Packs.
[move]RPGMaker VX Ace[/move] -
That's because if you multiply an integer by 0, you'll always get 0. Perhaps try:
Code:[a.weapons[0].params[2], 1].max * (a.atk - (a.weapons[0].params[2] + a.armors[0].params[2]))
Using [a, b].max will give you the largest number out of a and b. This means that if you don't have a weapon equipped, you'll get 1 x a.atk.