Trying to help a buddy with his project, is there a way to get a skill to check if the target has a particular item? Looking to emulate a passive skill effect that alters how much damage the character takes.
RMMV Damage Formula - ideas and help
● ARCHIVED · READ-ONLY
-
-
Yes, but...do you mean the enemy is attacking, and you want to see if the target actor has equipped a certain weapon or armor? Or that the party possesses an item? (these are different terms in the database, and referenced differently in the code).Trying to help a buddy with his project, is there a way to get a skill to check if the target has a particular item? Looking to emulate a passive skill effect that alters how much damage the character takes.
Also, there are free plugins to give passive states, why choose a workaround that emulates it instead of just actually having a passive skill? -
I don't think my buddy wants to add any more plugins to the project. In any case, it seems that I've misunderstood the problem he was having. I think I need to research a bit more so I can properly help him.Yes, but...do you mean the enemy is attacking, and you want to see if the target actor has equipped a certain weapon or armor? Or that the party possesses an item? (these are different terms in the database, and referenced differently in the code).
Also, there are free plugins to give passive states, why choose a workaround that emulates it instead of just actually having a passive skill? -
I have an ability that self inflicts damage to himself to inflict massage damage to an enemy:
a.gainHp(Math.round(-a.mhp*.2)); a.atk *24 - b.def
I was trying to do a similar ability except instead of a single target, allow it to attack all enemies. However, I only want to inflict damage to himself ONCE. With that formula as it currently stands, it inflicts damage to the user for EACH enemy. How can I make it so it only inflicts damage to the user once? -
Instead of putting theI have an ability that self inflicts damage to himself to inflict massage damage to an enemy:
a.gainHp(Math.round(-a.mhp*.2)); a.atk *24 - b.def
I was trying to do a similar ability except instead of a single target, allow it to attack all enemies. However, I only want to inflict damage to himself ONCE. With that formula as it currently stands, it inflicts damage to the user for EACH enemy. How can I make it so it only inflicts damage to the user once?a.gainHp(Math.round(-a.mhp*.2));portion in the formula box, use a notetag like <Custom Execution> or <Pre-Damage Eval> and put it in there. -
Thanks, I'll try that :)
-
Probably a pretty simple issue I'm having, but could someone help me figure out what I have wrong with this damage formula? The skill is supposed to do an extra 10% damage x the value of a few variables added together.
Just to rule it out, the skill does do damage if it's just ((a.mat * (6 + a.luk)) / b.mdf). As it is now however, it deals 0 damage.
Code:((a.mat * (6 + a.luk)) / b.mdf) * (1 + (0.1 * (v[289] + v[290] + v[291] + v[292] + v[293] + v[294] + v[295] + v[296] + v[298]))) -
Holy parentheses, Batman.could someone help me figure out what I have wrong with this damage formula?
Well, I don't see a mathematical error by looking at it. I suggest you double-check the values of all of those variables. If any of them have not been set during your current game, they'll beundefined, and any use of that in an equation will blank it out to NaN (which the damage function might error-check for and turn to 0).
This also means, as far as I know, that this will not work in a battle test since you won't have anything assigning values to the variables. You'll have to run an actual play test.
And then, of course, if any of them are sufficiently negative, it could make that entire side of the equation negative which would 0 out the damage.
So, yeah, troubleshoot the variables. -
Haha, yeah, I probably don't need quite that many, just making sure everything is calculated in the order that I'd like it to.Holy parentheses, Batman.
And yep, the variables were the culprit. Not all of the ones I was checking had a value set to them, and I assumed it would just count it as 0, instead of erroring out the entire formula. Setting them all to 0 at the start of the game fixes that. Thank you! :) -
Hey there! Happy holidays everyone! I wish everyone the best of times and lots of success!!! <3
Anyways, hope Ive got the right thread for this, it seems like my problem could be solved using damage formulas exclusively, so I figured Id start here first. The project Im working on is gonna be having MP also be a Morale system on top of Mana, and I wanna make sure Crits are impactful and demoralize the enemy. So I was hoping to grab a formula to make sure a skill deals MP damage when you land a Critical and ONLY when you land a Critical, on top of just dealing the regular HP damage the attack should logically do with whatever formula I plug in for that. I'm not the best with more complex, conditional coding when it comes to these formulas so I definitely could use some help with this.
I think the current formula I was using in testing was b.gainMp(-X); (a.atk * 4 - b.def * 2) and it was definitely dealing the MP damage on top of HP, but obviously there's more I need add to make the b.gainMp(-X) part only happen conditionally on a Critical Hit. Can that can be done just adding if/and statements into the MP Damage part of the formula?? If so what would that take?? Or am I just way off the mark for making this actually work and rigging something up with the functionality from plugins like Yanfly's Auto Passive States and/or Buff & States Core to add a global passive state with a custom establish effect would be closer to the solution???
Any help in the right direction would go a long way, thanks all :) -
Try:I was hoping to grab a formula to make sure a skill deals MP damage when you land a Critical and ONLY when you land a Critical
if (b.result().critical) b.gainMp(-X); a.atk * 4 - b.def * 2 -
Yeah that worked wonders, thank you so so much and Merry Christmas :)Try:
if (b.result().critical) b.gainMp(-X); a.atk * 4 - b.def * 2 -
Late Merry Christmas and soon Happy New Year!
So a few days ago I resumed work on my game. I wanted to create a skill that deals some damage and inflicts stun state. But if the target is already affected by stun, it's affected by stagger instead. I'm not that good when it comes to more complex damage formulas and I came up with that:
if (b.isStateAffected(12)) {b.remove_state(12); b.add_state(11); a.atk} else {b.add_state(12); a.atk}
As for this moment, it deals no damage and no state is applied whatsoever. Any help or directing me towards the right path will be extremely appreciated. -
add_stateandremove_statesyntax is for RGSS. For MV onward, it isaddStateandremoveState
So the correct one would be
JavaScript:if (b.isStateAffected(12)) {b.removeState(12); b.addState(11)} else {b.addState(12)}; a.atk -
OMG! Thank you so much! It works perfectly!
add_stateandremove_statesyntax is for RGSS. For MV onward, it isaddStateandremoveState
So the correct one would be
JavaScript:if (b.isStateAffected(12)) {b.removeState(12); b.addState(11)} else {b.addState(12)}; a.atk -
I'm trying to do something similar to this using a number of "Math.randomInt(6)+a.level" a multiple number of times equal to the level of the caster, however all I could think of was adding "a.level*" to before it, and sadly, that just multiplies the integer by the level.
Any suggestions? I tried "if" commands, but I don't think I don't understand it fully.
My planned ideas were
a.level*Math.randomInt(6)+a.level
and
Math.randomInt(6)+a.level if (a.level>1) {+Math.randomInt(6)}; if (a.level>2) {+Math.randomInt(6)}; etc -
So you want to reroll the "die" once for each level and use the combined total as the damage?I'm trying to do something similar to this using a number of "Math.randomInt(6)+a.level" a multiple number of times equal to the level of the caster, however all I could think of was adding "a.level*" to before it, and sadly, that just multiplies the integer by the level.
Any suggestions? I tried "if" commands, but I don't think I don't understand it fully. -
Yes. Exactly. Up to a certain level anyways.So you want to reroll the "die" once for each level and use the combined total as the damage?
-
var damage = 0; for (var i = 0; i < Math.min(a.level, maximum level for effect); i++) { damage += Math.randomInt(6) + a.level; }; damage;Yes. Exactly. Up to a certain level anyways.
-
Thank you. I am trying it out right now and so far it is working splendidly ^v^var damage = 0; for (var i = 0; i < Math.min(a.level, maximum level for effect); i++) { damage += Math.randomInt(6) + a.level; }; damage;