I'm currently trying to make an accessory that increases the attack power of the base attack button and not the other skills but I can't seem to find a way to implement that
Is there a way to increase the attack power of a specific skill only and not effect the other skills?
RPG Maker MV SupportYou would need to write the check into the damage formula, so you might do something like this:
Damage formula:
a.atkBoost() * 4 * a.atk - 2 * b.def
and save the above as a .js file, install as a plugin and try it out. I'll test this code real quick
EDIT: Fixed a syntax error and I can confirm this works!
Damage formula:
a.atkBoost() * 4 * a.atk - 2 * b.def
Code:
Game_BattlerBase.prototype.atkBoost = function() {
return this.hasAtkBoost() ? x : y; //replace x with the multiplier with the accessory, y with the multiplier without
};
Game_Actor.prototype.hasAtkBoost = function() {
return this.hasArmor($dataArmors[n]); //replace n with the armor Id of the accessory
};
Game_Enemy.prototype.hasAtkBoost = function() {
return false;
};
and save the above as a .js file, install as a plugin and try it out. I'll test this code real quick
EDIT: Fixed a syntax error and I can confirm this works!
would it be possible to make this a state ? as I'm trying to make it a temporary thing
just gotta replace the check in the middle from being the accessory to being the state in that case. the other 2 functions should remain untouched
Code:
Game_Actor.prototype.hasAtkBoost = function() {
return this.isStateAffected(x); //replace x with the Id of the state
question but i need more info on what the y and the x do in the first line of the code
its as gensun said. x is the multiplier the skill should have with the accessory (or state if you made the edit) on and y is the one without. so if you wanted the skill to do 50% more damage, your x should be 1.5 and your y would be 1
works like a charm
thanks y'all
thanks y'all
Just to put it out there, it's not terribly lengthy to just put it directly into the damage formula without including a plugin that has three layers of function calls.
Condensing Gensun's code:
As above, replace n with the ID of the armor (no leading zeros) and x with how much it multiplies the damage.
For a state, it's even shorter:
You might also find this thread useful:
forums.rpgmakerweb.com
Condensing Gensun's code:
Code:
let mult = (a.isActor() && a.hasArmor($dataArmors[n])) ? x : 1; mult * 4 * a.atk - 2 * b.def
As above, replace n with the ID of the armor (no leading zeros) and x with how much it multiplies the damage.
For a state, it's even shorter:
Code:
(a.isStateAffected(n) ? x : 1) * 4 * a.atk - 2 * b.def
You might also find this thread useful:
Damage Formulas 101
Please note: A discussion has already been started about different things you can do with these formulas so please direct those comments and question to the appropriate thread. https://forums.rpgmakerweb.com/index.php?threads/rmmv-damage-formula-ideas-and-help.47099/ A link to the list of...
forums.rpgmakerweb.com
Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-increase-the-attack-power-of-a-specific-skill-only-and-not-effect-the-other-skills.164129/