Hmm, are you sure? I know for example you can add states with a formula like this:
a.addState(id); (a.atk * 1.3 - b.def)
This example would deal damage to the enemy and give state xy to the user. Taking this in mind i thought it must be possible to use something like a.ifstate(id); b.addstate(id)
RMMV Damage Formula - ideas and help
● ARCHIVED · READ-ONLY
-
-
You will have to use a FOR statement in your formule if you would want to copy every state the target has with one skill.
And you wanted to only copy beneficial states? If so it will get a little bigger. -
Hey there, could you explain me what exactly a FOR statement is?
-
Am at the dentist.
There you can find what you search for
https://www.w3schools.com/js/js_loop_for.asp
This is the correct link.
You may need to use plugins to make use of it in a damage formule.
When i have more time i could give you an proper example. -
I want to create a formula for a combined skill between actor 1 and actor 2 (either performed by actor 1 or actor 2) where the damage is the sum of actor 1 attack and actor 2 magic attack.
If I enter "$gameActors.actor(1).param[2] + $gameActors.actor(2).param[4]", it make 1 damage. Formula error ? Or correct formula but plugins incompatibility ? -
Somebody to help with my above problem ? It has been 3 days that I torture myself :frown:
-
Use param(1) instead of this param[1].Somebody to help with my above problem ? It has been 3 days that I torture myself :frown:
These [ ]are used for objects (and perhaps even more) and param is a function that you have to give an id to work with.
If you put your line in the debug console you can test it. -
Thanks jetboost !
-
Here is what you need:Hey there, could you explain me what exactly a FOR statement is?
Code:*You need Yanfly damage core plugin for this to work. Edit(control to core. the plugin gives more control it wasn't named as such sorry about that)if(target.states().length != 0){ for(i=0; i < target.states().length;i++) {user.addState(target.states()[i].id) }}
This will copy every state the target enemy has and gives them to you. -
So, I ran into an issue with Absorption Barrier. I tried to make an attack that would deal good damage against enemy barriers, but otherwise deal normal damage.
What I managed does deal good damage to barriers, however it also deals 0 hp damage every time I attack, and once the barrier is gone it only deals that 0 damage.
It's even on my actor with the highest attack, and the others do deal succesful hp damage to the enemy.
Help?
Edit: Nevermind I'm an idiot everything works now, I had removed the multiplier from the normal attack damage. -
Alright, if someone could help me out with a specific skill, I would really appreciate it.
The Skill's tooltip is "Deals 50% more damage for each negative parameter status change the enemy has". This can scale up to 250% for all 5 states (Attack, Defense, Magic Attack, Magic Defense, and Agility). If the enemy doesn't have any debuffs on them, it's a regular "a.mat * 2 - b.mdf".
I'm also using Yanfly's Damage Core to write this code. I've tried it myself but the damage doesn't work. Not even a 0 damage popup, it simply does nothing.
Formula Code<damage formula>
value = a.mat * 2 - b.mdf;
if (b.isStateAffected(27)) && if (b.isStateAffected(57)) && if (b.isStateAffected(30)) && if (b.isStateAffected(40)) && if (b.isStateAffected(53)) {
value *= 3.5;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(57)) && if (b.isStateAffected(30)) && if (b.isStateAffected(40)) {
#No Agility Debuff/Everything Else
value *= 3.0;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(57)) && if (b.isStateAffected(30)) && if (b.isStateAffected(53)) {
#No Magic Defense Debuff/Everything Else
value *= 3.0;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(57)) && if (b.isStateAffected(40)) && if (b.isStateAffected(53)) {
#No Magic Attack Debuff/Everything Else
value *= 3.0;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(40)) && if (b.isStateAffected(30)) && if (b.isStateAffected(53)) {
#No Defense Debuff/Everything Else
value *= 3.0;
} elseif (b.isStateAffected(57)) && if (b.isStateAffected(40)) && if (b.isStateAffected(30)) && if (b.isStateAffected(53)) {
#No Attack Debuff/Everything Else
value *= 3.0;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(57)) && if (b.isStateAffected(30)) {
#No Magic Defense/Agility Debuff
value *= 2.5;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(57)) && if (b.isStateAffected(40)) {
#No Magic Attack/Agility Debuff
value *= 2.5;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(30)) && if (b.isStateAffected(40)) {
#No Defense/Agility Debuff
value *= 2.5;
} elseif (b.isStateAffected(57)) && if (b.isStateAffected(30)) && if (b.isStateAffected(40)) {
#No Attack/Agility Debuff
value *= 2.5;
} elseif (b.isStateAffected(30)) && if (b.isStateAffected(40)) && if (b.isStateAffected(53)) {
#No Attack/Defense Debuff
value *= 2.5;
} elseif (b.isStateAffected(57)) && if (b.isStateAffected(40)) && if (b.isStateAffected(53)) {
#No Attack/Magic Attack Debuff
value *= 2.5;
} elseif (b.isStateAffected(57)) && if (b.isStateAffected(30)) && if (b.isStateAffected(53)) {
#No Attack/Magic Defense Debuff
value *= 2.5;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(40)) && if (b.isStateAffected(53)) {
#No Defense/Magic Attack Debuff
value *= 2.5;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(30)) && if (b.isStateAffected(53)) {
#No Defense/Magic Defense Debuff
value *= 2.5;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(57)) && if (b.isStateAffected(53)) {
#No Magic Attack/Magic Defense Debuff
value *= 2.5;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(57)) {
#No Magic Attack/Magic Defense/Agility Debuff
value *= 2.0;
} elseif (b.isStateAffected(53)) && if (b.isStateAffected(57)) {
#No Magic Attack/Magic Defense/Attack Debuff
value *= 2.0;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(53)) {
#No Magic Attack/Magic Defense/Defense Debuff
value *= 2.0;
} elseif (b.isStateAffected(57)) && if (b.isStateAffected(40)) {
#No Attack/Magic Attack/Agility Debuff
value *= 2.0;
} elseif (b.isStateAffected(30)) && if (b.isStateAffected(40)) {
#No Attack/Defense/Agility Debuff
value *= 2.0;
} elseif (b.isStateAffected(30)) && if (b.isStateAffected(53)) {
#No Attack/Defense/Magic Defense Debuff
value *= 2.0;
} elseif (b.isStateAffected(57)) && if (b.isStateAffected(30)) {
#No Attack/Magic Defense/Agility Debuff
value *= 2.0;
} elseif (b.isStateAffected(27)) || if (b.isStateAffected(57)) || if (b.isStateAffected(30)) || if (b.isStateAffected(40)) || if (b.isStateAffected(53)) {
#Only One Debuff
value *= 1.5;
}
</damage formula>
Any help would be appreciated. Thanks. -
2 things firstAlright, if someone could help me out with a specific skill, I would really appreciate it.
The Skill's tooltip is "Deals 50% more damage for each negative parameter status change the enemy has". This can scale up to 250% for all 5 states (Attack, Defense, Magic Attack, Magic Defense, and Agility). If the enemy doesn't have any debuffs on them, it's a regular "a.mat * 2 - b.mdf".
I'm also using Yanfly's Damage Core to write this code. I've tried it myself but the damage doesn't work. Not even a 0 damage popup, it simply does nothing.
Formula Code<damage formula>
value = a.mat * 2 - b.mdf;
if (b.isStateAffected(27)) && if (b.isStateAffected(57)) && if (b.isStateAffected(30)) && if (b.isStateAffected(40)) && if (b.isStateAffected(53)) {
value *= 3.5;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(57)) && if (b.isStateAffected(30)) && if (b.isStateAffected(40)) {
#No Agility Debuff/Everything Else
value *= 3.0;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(57)) && if (b.isStateAffected(30)) && if (b.isStateAffected(53)) {
#No Magic Defense Debuff/Everything Else
value *= 3.0;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(57)) && if (b.isStateAffected(40)) && if (b.isStateAffected(53)) {
#No Magic Attack Debuff/Everything Else
value *= 3.0;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(40)) && if (b.isStateAffected(30)) && if (b.isStateAffected(53)) {
#No Defense Debuff/Everything Else
value *= 3.0;
} elseif (b.isStateAffected(57)) && if (b.isStateAffected(40)) && if (b.isStateAffected(30)) && if (b.isStateAffected(53)) {
#No Attack Debuff/Everything Else
value *= 3.0;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(57)) && if (b.isStateAffected(30)) {
#No Magic Defense/Agility Debuff
value *= 2.5;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(57)) && if (b.isStateAffected(40)) {
#No Magic Attack/Agility Debuff
value *= 2.5;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(30)) && if (b.isStateAffected(40)) {
#No Defense/Agility Debuff
value *= 2.5;
} elseif (b.isStateAffected(57)) && if (b.isStateAffected(30)) && if (b.isStateAffected(40)) {
#No Attack/Agility Debuff
value *= 2.5;
} elseif (b.isStateAffected(30)) && if (b.isStateAffected(40)) && if (b.isStateAffected(53)) {
#No Attack/Defense Debuff
value *= 2.5;
} elseif (b.isStateAffected(57)) && if (b.isStateAffected(40)) && if (b.isStateAffected(53)) {
#No Attack/Magic Attack Debuff
value *= 2.5;
} elseif (b.isStateAffected(57)) && if (b.isStateAffected(30)) && if (b.isStateAffected(53)) {
#No Attack/Magic Defense Debuff
value *= 2.5;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(40)) && if (b.isStateAffected(53)) {
#No Defense/Magic Attack Debuff
value *= 2.5;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(30)) && if (b.isStateAffected(53)) {
#No Defense/Magic Defense Debuff
value *= 2.5;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(57)) && if (b.isStateAffected(53)) {
#No Magic Attack/Magic Defense Debuff
value *= 2.5;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(57)) {
#No Magic Attack/Magic Defense/Agility Debuff
value *= 2.0;
} elseif (b.isStateAffected(53)) && if (b.isStateAffected(57)) {
#No Magic Attack/Magic Defense/Attack Debuff
value *= 2.0;
} elseif (b.isStateAffected(27)) && if (b.isStateAffected(53)) {
#No Magic Attack/Magic Defense/Defense Debuff
value *= 2.0;
} elseif (b.isStateAffected(57)) && if (b.isStateAffected(40)) {
#No Attack/Magic Attack/Agility Debuff
value *= 2.0;
} elseif (b.isStateAffected(30)) && if (b.isStateAffected(40)) {
#No Attack/Defense/Agility Debuff
value *= 2.0;
} elseif (b.isStateAffected(30)) && if (b.isStateAffected(53)) {
#No Attack/Defense/Magic Defense Debuff
value *= 2.0;
} elseif (b.isStateAffected(57)) && if (b.isStateAffected(30)) {
#No Attack/Magic Defense/Agility Debuff
value *= 2.0;
} elseif (b.isStateAffected(27)) || if (b.isStateAffected(57)) || if (b.isStateAffected(30)) || if (b.isStateAffected(40)) || if (b.isStateAffected(53)) {
#Only One Debuff
value *= 1.5;
}
</damage formula>
Any help would be appreciated. Thanks.
1: does "value *= 3.5" work i remember getting some invalid left side errors or something when i used it at other places in the engine i can be wrong though.
2. The way you have set up the formula is needlessly large and a pain to make some changes to i will put something down for you that's a bit more compact i may even solve your issue. Will edit this post when i finish it.
Edit: And i believe you are using && if the wrong way.
Edit 2 the formula. I haven't tested it yet though.
Code:<damage formula> debufstates=[27,30,40,50,53]; multi = 1; if(target.states().length != 0) { for(i=0; i < target.states().length;i++) {for (o=0;o < debufstates.length; o++) {if(target.states()[i].id==debufstates[o] ) {multi + .5;} } } } value = (a.mat * 2 - b.mdf)* multi; </damage formula> -
@jetboost Thank you so much for the code! I was able to get it working!
-
Good to hear!:thumbsup-left:@jetboost Thank you so much for the code! I was able to get it working!
-
Hi I don't know if this is possible. But can anyone help me with a formula where lets say actor one has an atk of 12 he will do anywhere from 1 to 12 points of damage and then do the same with the opponts def and have the atk amount subtract from the def amount
-
That's possible. But I don't know what the engine would do with negative values to be honest.Hi I don't know if this is possible. But can anyone help me with a formula where lets say actor one has an atk of 12 he will do anywhere from 1 to 12 points of damage and then do the same with the opponts def and have the atk amount subtract from the def amount
Code:So you could add this to the formule<damage formula> value = Math.randomInt(a.atk)+1 - Math.randomInt(b.def)+1; </damage formula>
Code:Yanfly damage core plugin required*if(value < 0){value=0;} \\Or value = 1 depending on your preference. Oh wait nevermind this negative values will become 0 i believe so this isn't needed
It ought to work. -
I have a D&D type of formula that i want to use in a game I'm making and it's very close to what i need. However there's one part I'm having trounble with. if (b.def <= (Math.randomInt(20) + 1 + a.atk)) Math.randomInt(4) + 1 + a.atk; else 0 is the formula.
if (b.def <= (Math.randomInt(20) + 1 + a.atk)) is what determines if you hit or miss.
Math.randomInt(4) + 1 + a.atk is what determines the damage.
My question is for the damage part instead of using the players over all atk. Is it possible to only use the weapons atk stat -
Ok, that is possibleI have a D&D type of formula that i want to use in a game I'm making and it's very close to what i need. However there's one part I'm having trounble with. if (b.def <= (Math.randomInt(20) + 1 + a.atk)) Math.randomInt(4) + 1 + a.atk; else 0 is the formula.
if (b.def <= (Math.randomInt(20) + 1 + a.atk)) is what determines if you hit or miss.
Math.randomInt(4) + 1 + a.atk is what determines the damage.
My question is for the damage part instead of using the players over all atk. Is it possible to only use the weapons atk stat
If you would like to write your code in the way i did, there is an insert button next to the floppy disk symbol with which you can choose to do so.
Code:This should do it.<damage formula> \\Because we wish to select data from an actor that isn't accesable like a.atk for as far as i know, we will \\have to select our correct actor like this and as enemies don't have equips. if( a.isActor() ){ x = a.actorId() ; if (b.def <= (Math.randomInt(20) + 1 + a.atk)) { value= Math.randomInt(4) + 1 +$gameActors.actor(x).equips()[0].params[2]; }else{ value = 0;} } -
Hi wanted to thank everyone for their help with my D&D style Damage Formula and decided to upload it here.
if (b.def <= (Math.randomInt(20) + 1 + a.atk + Math.floor(v[1]-10)/2)) Math.randomInt(4) + 1 + Math.floor(v[1]-10)/2; else 0
if (b.def <= (Math.randomInt(20)+ 1 + a.atk + Math.floor(v[1]-10)/2)) This is the attack roll that decides if you hit or miss
if (b.def <= (Math.randomInt(20) + 1 is the dice roll that results in a number from 1 to 20. Then you add your overall atk as the Proficiency bonus. Then Math.floor(v[1]-10)/2)) as the part that determines your ability score. With this part you will have to create a variable to act as the six basic skill.
I recommend using yanfly's actor variables just to keep track of them in game.
Math.randomInt(4) + 1 + Math.floor(v[1]-10)/2; else 0 is the damage roll
Math.randomInt(4) + 1 is the basic dice roll. Just repe lace the 4 with the type of dice roll you want. 4 for a d4 dice 6 for d6 etc.
Math.floor(v[1]-10)/2 this is you ability score again.
else 0 just reduces all damage to 0 if your attack roll doesn't beat out your opponents. As I couldn't figure out how to do a miss. -
You are welcome, solving puzzles is fun and i get to see a new perspective on skills.Hi wanted to thank everyone for their help with my D&D style Damage Formula and decided to upload it here.
if (b.def <= (Math.randomInt(20) + 1 + a.atk + Math.floor(v[1]-10)/2)) Math.randomInt(4) + 1 + Math.floor(v[1]-10)/2; else 0
if (b.def <= (Math.randomInt(20)+ 1 + a.atk + Math.floor(v[1]-10)/2)) This is the attack roll that decides if you hit or miss
if (b.def <= (Math.randomInt(20) + 1 is the dice roll that results in a number from 1 to 20. Then you add your overall atk as the Proficiency bonus. Then Math.floor(v[1]-10)/2)) as the part that determines your ability score. With this part you will have to create a variable to act as the six basic skill.
I recommend using yanfly's actor variables just to keep track of them in game.
Math.randomInt(4) + 1 + Math.floor(v[1]-10)/2; else 0 is the damage roll
Math.randomInt(4) + 1 is the basic dice roll. Just repe lace the 4 with the type of dice roll you want. 4 for a d4 dice 6 for d6 etc.
Math.floor(v[1]-10)/2 this is you ability score again.
else 0 just reduces all damage to 0 if your attack roll doesn't beat out your opponents. As I couldn't figure out how to do a miss.
Did you manage to get the skill working? The one with which you wanted to select the weapons attack?
Kinda just put it together and haven't tested it.