Couldn't seem to find anything on search, so...I assume you can use variables in the damage formula, right? I sort of have an idea how it might go, but I just need to make sure :/
The idea is to use the variable to increase the damage by a percentage. Any ideas how I can do that?
RMMV Damage Formula - ideas and help
● ARCHIVED · READ-ONLY
-
-
A percentage is X/Y where X is the value and Y is the max value
eg. 20% is 20/100 or 2/10
It all depends on what your to values will be, though Y will most likely be a fixed value
as for grabbing a variable, $gameVariables[X] should work, were X is the variables number in the list -
Just a quick question, I hope this hasn't already been asked, I'm wondering if it's possible to have a formula check for the better of two stats. For instance if I wanted an attack to use ATK or AGI depending on which is higher, but ignore the lesser stat.
-
another formula question lol
yall must be getting tired of me XD
but i have some skills in mind, that would do damage based on what states and/or buffs the target, or themselves, may have.
Like, say I have a skill, that does 10% more damage for each state the target has on them, how would I do that? and is there a way i can differentiate beneficial states from negative states? So it does 10% more damage for each benefiting state the target has? And if I can differentiate states, could I also make it so there is a skill that does much more damage if the target has a very specific state on them, for ex. the "Mark" state, like, the chars other move can leave a "Mark" on the foe for about 5 turns, then the execution skill does like, double damage, if the target has a "Mark" on them.
and of course, is it possible to make a skill that does more dmg for each state on the user? Like a skill that does more damage based on how many negative states they have on them, kind of like, a Dying Strike, so if they have Poison, it does more dmg, if they have poison and blind, it does even more damage, but ignores states on the user like regeneration or such.
I would like to know if it's posible to do this with the buff features of RMMV as well, but for right now id more like to know if i can put states into a damage formula for the above mentioned type of skills -
While you can check states, as far as I know it can only be done one state at a time and RMMV does know what a positive or negative state (some states call also be both)
As far as a "Mark" state, unless what it to only work for certain moves just change either the param for Def or Mdf, or you could try s.param PDR or MDR
for checking if you have a state: a.State(X), where X is the state number in the list
so: if(a.State(x)) {//damage for having state} else {//damage for not having state)
not 100% if that will work, so if not do this
var dmg = 0; if(a.State(x)) {dmg = //damage for having state} else {dmg = //damage for not having state); dmg
RMMV normally takes the last used number as damage, with ';' semicolons working as break points -
Just a quick question, I hope this hasn't already been asked, I'm wondering if it's possible to have a formula check for the better of two stats. For instance if I wanted an attack to use ATK or AGI depending on which is higher, but ignore the lesser stat.
Math.max(a.atk, a.agi)
This always returns the higher of the two, if you want to use the stat in multiple places
var pow = Math.max(a.atk, a.agi); pow+pow/b.def [note: just an example]
if you want to change what the opponent uses as well (atk vs def or mat vs mdf)
if(Math.max(a.atk, a.mat) == a.atk) {a.atk+a.atk/b.def} else {a.mat+a.mat/b.mdf} -
Math.max(a.atk, a.agi)
This always returns the higher of the two, if you want to use the stat in multiple places
var pow = Math.max(a.atk, a.agi); pow+pow/b.def [note: just an example]
if you want to change what the opponent uses as well (atk vs def or mat vs mdf)
if(Math.max(a.atk, a.mat) == a.atk) {a.atk+a.atk/b.def} else {a.mat+a.mat/b.mdf}
Ahh thank you sir, much appreciated! -
A percentage is X/Y where X is the value and Y is the max value
eg. 20% is 20/100 or 2/10
It all depends on what your to values will be, though Y will most likely be a fixed value
as for grabbing a variable, $gameVariables[X] should work, were X is the variables number in the list
Hm okay, I think I get it now.
another formula question lol
yall must be getting tired of me XD
but i have some skills in mind, that would do damage based on what states and/or buffs the target, or themselves, may have.
Like, say I have a skill, that does 10% more damage for each state the target has on them, how would I do that? and is there a way i can differentiate beneficial states from negative states? So it does 10% more damage for each benefiting state the target has? And if I can differentiate states, could I also make it so there is a skill that does much more damage if the target has a very specific state on them, for ex. the "Mark" state, like, the chars other move can leave a "Mark" on the foe for about 5 turns, then the execution skill does like, double damage, if the target has a "Mark" on them.
and of course, is it possible to make a skill that does more dmg for each state on the user? Like a skill that does more damage based on how many negative states they have on them, kind of like, a Dying Strike, so if they have Poison, it does more dmg, if they have poison and blind, it does even more damage, but ignores states on the user like regeneration or such.
I would like to know if it's posible to do this with the buff features of RMMV as well, but for right now id more like to know if i can put states into a damage formula for the above mentioned type of skills
I did manage to make a skill that deals more damage the more negative states the target has, but I had to use Yanfly's Damage Core Plugin because the formula became way too long to fit inside the box x_x;
But okay, here's the very short version you can fit into the box:
dmg = something; if (target.isStateAffected(x)) {dmg *= 1.1};
That should increase damage by 10% when the target is affected by state x. Obviously, you need to replace "something" with...well, something. Like a.atk * 4 - b.def * 2 or whatever. And the x after target.isStateAffected is the state's ID. If you want to check for more states, then you will need another if (target.isStateAffected(x)) {dmg *= 1.1}; so, I think you see the problem here when I say the formula can get very, very long. Especially if you have lots of negative states in your game.
For the skill that deals double damage with a "Mark" state on the target, you can use that same formula, but just change the 1.1 to 2.
If you want the version I'm using right now in my game with the Yanfly Plugin, just let me know :) -
While you can check states, as far as I know it can only be done one state at a time and RMMV does know what a positive or negative state (some states call also be both)
As far as a "Mark" state, unless what it to only work for certain moves just change either the param for Def or Mdf, or you could try s.param PDR or MDR
for checking if you have a state: a.State(X), where X is the state number in the list
so: if(a.State(x)) {//damage for having state} else {//damage for not having state)
not 100% if that will work, so if not do this
var dmg = 0; if(a.State(x)) {dmg = //damage for having state} else {dmg = //damage for not having state); dmg
RMMV normally takes the last used number as damage, with ';' semicolons working as break points
the "Mark" would do nothing on it's own, it's purely for specific skills to get a bonus if the foe has a mark
but, essentially, i cant have a skill that does more for each state a foe has?
I can only have a skill that does more damage if the target/user has that 1 specific state?
andin that formula dmg, my formula would basically need to be ...
var dmg = 0; if(b.State(63)) {dmg = // Math.min(a.atk*2, (a.atk*2)*(a.atk/(b.def*2))) } else {dmg = // Math.min(a.atk, a.atk*(a.atk/(b.def*2))) }; dmg
whats the var dmg = 0 part? the ; dmg at the end i could image is whatever the branch formula makes it out to be,right? -
the "Mark" would do nothing on it's own, it's purely for specific skills to get a bonus if the foe has a mark
but, essentially, i cant have a skill that does more for each state a foe has?
I can only have a skill that does more damage if the target/user has that 1 specific state?
andin that formula dmg, my formula would basically need to be ...
var dmg = 0; if(b.State(63)) {dmg = // Math.min(a.atk*2, (a.atk*2)*(a.atk/(b.def*2))) } else {dmg = // Math.min(a.atk, a.atk*(a.atk/(b.def*2))) }; dmg
whats the var dmg = 0 part? the ; dmg at the end i could image is whatever the branch formula makes it out to be,right?
Yes, you can. Here is an example by Yanfly.
Healing Purge - Heals target ally for a medium amount and removes all ailments. Heals +25% bonus for each ailment.
var rate = 1;
for (var i = 0; i < b.states().length; ++i) {
var state = b.states();
if (!state) continue;
if ([4, 5, 6, 7, 8, 9, 10].contains(state.id)) rate += 0.25;
}
value = a.mdf * 8 * rate;
Or the formula box version (one-line version):
var rate = 1; for (var i = 0; i < b.states().length; ++i) { var state = b.states(); if (!state) continue; if ([4, 5, 6, 7, 8, 9, 10].contains(state.id)) rate += 0.25; } value = a.mdf * 8 * rate;
All you need to do is
- change 4...10 to the id states to check for
- the rate increment for each state present on the target
- the damage formula
Hope that helps!
- Riff -
to answer why 'var dmg = 0' is at the start is to set dmg as an 'int' variable, if anything goes wrong the game won't crash and instead hit for zero dmg (just a habbit of mine from error testing code)
-
((((a.atk * 1.2) + ((a.agi - b.agi) *1.3)) * (1 + ( a.luck/100))) * (1 + (a.level/100)))
hmmmm going with this formula for damage.........for archer......character who only uses the regular attack for damage til chapter two.....this character has terrible attack, decent agility and god teir luck.........with a crit damage multiplier of 7.3 at her base.......is this formula well balanced with this crit multiplier or does it need more adjustment? -
The last formula someone helped me with works great, so thanks a lot! Here's another one that I've been trying to figure out to no avail: The skill I'm trying to make does no damage. Instead, if a.atk + 10 > b.def, it will check the target's State Rate for Knockout (State ID 1) from all sources (traits, states, etc. etc.), and try to apply the state according to that rate (so if the State Rate is 0, it will never work). However, if the target has one or more of two specific States (21 or 29), then b.def is doubled for calculation, but only once (having both states will have the same effect as only having one or the other).
-
ty gamma, and ty riff, though riff, let me see if i got this understood about right ...
var rate = 1; for (var i = 0; i < b.states().length; ++i) { var state = b.states(); if (!state) continue; if ([4, 5, 6, 7, 8, 9, 10].contains(state.id)) rate += 0.25; } value = a.mdf * 8 * rate;
var rate sets the base rate to 1, so if there is there is no ailments, it just heals the base amount, the "if state" makes it register if the target has a state and the continue makes it basically look for the following states, 4-10, and the rate += .25 means it adds .25 to the original 1 for each of those states it has, and the value part is basically the formula for the base amount right? though what is the * 8 * part? assuming thats yanflies formula for a "small" heal, is 8x the users mdf? lol
as for the "var i = 0; i < b.states().length; ++i" i dont quite know what that one is or does at all lol
at the same time, how would i convert that to an attack? would i just change the "value = a.mdf etc etc" to my formula with the added on "* rate"? so it should look like this ...
var rate = 1; for (var i = 0; i < b.states().length; ++i) { var state = b.states(); if (!state) continue; if ([4, 5, 6, 7, 8, 9, 10, 20, 35].contains(state.id)) rate += 0.10; } value = Math.min(a.atk, a.atk*(a.atk/(b.def*2))) * rate;
and just to be sure lol
this coding will work without that yanfly plugin right? lol -
ty gamma, and ty riff, though riff, let me see if i got this understood about right ...
var rate = 1; for (var i = 0; i < b.states().length; ++i) { var state = b.states(); if (!state) continue; if ([4, 5, 6, 7, 8, 9, 10].contains(state.id)) rate += 0.25; } value = a.mdf * 8 * rate;
var rate sets the base rate to 1, so if there is there is no ailments, it just heals the base amount, the "if state" makes it register if the target has a state and the continue makes it basically look for the following states, 4-10, and the rate += .25 means it adds .25 to the original 1 for each of those states it has, and the value part is basically the formula for the base amount right? though what is the * 8 * part? assuming thats yanflies formula for a "small" heal, is 8x the users mdf? lol
as for the "var i = 0; i < b.states().length; ++i" i dont quite know what that one is or does at all lol
at the same time, how would i convert that to an attack? would i just change the "value = a.mdf etc etc" to my formula with the added on "* rate"? so it should look like this ...
var rate = 1; for (var i = 0; i < b.states().length; ++i) { var state = b.states(); if (!state) continue; if ([4, 5, 6, 7, 8, 9, 10, 20, 35].contains(state.id)) rate += 0.10; } value = Math.min(a.atk, a.atk*(a.atk/(b.def*2))) * rate;
and just to be sure lol
this coding will work without that yanfly plugin right? lol
The var i = 0 whole part just checks through all states the target has, and check it against your listed states.
Looks about right. And i dont think you need yanfly plugin for this to work. Give it a try. :) -
sweet, tyvm for this, ill put this, and gammas version to test as soon as i can, doing all this stuff for a Warlord class that basically does more dmg the more crap you or your foe has going on, like Kingslayer for foes with a lot of buffs, Advantage Taker for foes with a lot of nerfs, etc etc lol
also, i was looking at a formula you guys helped another with earlier in the thread here, about doing more damage based on percentage of missing health. I wanted to do a move that does similar, it basically increases the damage of the attack by the percent of missing health your target has, and i came up with this...
Math.min(a.atk, a.atk*(a.atk/(b.def*2)))*(1+((b.maxHp - b.hp)/b.maxHp))
but it doesnt seem to work, the enemy took 0 dmg and actually ended up constantly having 0 pop up long after the atk ended, even though the atk doesnt apply any states or buffs or anything, just a basic attack, with that above formula x.x
I tested out the more dmg per state thing, and it works, pretty good too, but i found something else out, I got yanflies ATB plug in and yanflies TickBasedRegen plugin too which is suppose to make turn based states tick more reliably instead of all rapid like. Well in the test i applied buffs that normally my actors would get, to the enemies, but the enemies burned through like, 5 turns worth of buff in just 1 turn, any idea why that happened?
i think i need help on my load order on this one, probably, cause it use to work, but i cant figure out how the load order should work with their plugins, they just keep saying "install under this exact same plugin" every time instead of giving a detailed load order for when you have have several of their plugins x.x -
((((a.atk * .75) + ((a.agi - b.agi) * .9)) * (1 + ( (a.luck*1.5)/100))) * (1 + (a.level/100)))
ok updated formula cuase her damage multiplier from crits is massive and the has very high crit rate..........still thinking it needs some adjustment -
Hello again, I know this is technically a healing formula and not a damage one, but they use the same code so whatever. I'm trying to implement a favorite food system where certain foods heal certain actors more than others. So for instance if I wanted actor A to get healed 40 HP when eating the item and everyone else to get healed 10 if they eat it, how would that formula look?
-
If it is an Item it actually would work very differently since items don't use the skill damage formula, they use set amounts or percentages
If you want to do this I suggest a plugin where you can do custom effects and just use something like this
if(user === $gameActor[x]) {
user.hp += 40;
} else {
user.hp += 10;
} -
ive got another move idea, but, im not entirely sure how to do it, i thought of using a variable and then just making a parralel common event to constantly reset the variable, however idk if that works only outside of battle or if it would be resetting the variable while inside the battle, but i still cant help but wonder if there was a better way
what i want, this move, starts out weak, does lil dmg, but the more you use it on the enemy, the stronger it gets, and each time you use it, it does more and more dmg, until the enemy dies, or the battle is over, then it would reset.
Ideally, id like the move to do more and more dmg to a single enemy, but the variable idea would make the move do more dmg to every enemy the more you use instead of just the one. Is there anyway i can do this?