Hopefully, this isn't too much trouble.
I'm new to creating skills in RPG Maker MV, and I think if I had an explanation of how to set up the formulas and effects to make the following skills work, it'd help me understand how to do most of the skills for my game. So, if anyone can tell me what formulas and effects I'd need to input for the following skills, I'd greatly appreciate it! I've figured out a few of my skills, thus far, but others I'm struggling with.
(I've read the Damage Formulae 101 guide, but I'm still strugglin'.)
1) Undying Will: Attack debuff on an enemy, 5 turns; restores 10% HP; boosts player defense.
In the effects section, I have "Add Debuff Attack 5 turns."
But, what formula do I need for the 10% life restoration and boosting player defense?
Right now I have the Damage Type as HP Damage with Element "None" and this formula:
a.add_buff(2); a.gainHp(0.10)
(I don't know if this is right?)
2) Fury: User attack damage increases in % by missing HP %.
The formula I have is: (4*a.def- 2*b.def).
I'm using no effects. Will this accomplish what I need?
3) Hostility: User damage (increasingly) scales from the user's defense stat.
(I have Yanfly's buff states core, but I'm not certain how to do this!)
4) Final Stand: Party damage increases in % by user's % missing HP.
I've put this in the formulas box: v[x] =(1+ (mhp-hp)/mhp).
Then, before every skill that deals damage, I've put v[x]* - Will this work?
5) Bloodlust: Increases user attack 5 turns and adds 5% lifesteal.
I have "Add Buff Attack 5 turns" in effects, with the "Scope" set to "The User."
How do I accomplish the lifesteal?
I found a formula that says:
c = a.atk * 4 - b.def * 2; a.gainHp(Math.round(c * 0.5))
But, I don't know if this is right? (I don't fully understand what the parts of formulae mean, yet.)
Anyway, thank you all for any help!
Hopefully, I'm posting this in the right place.
Need help with setting up skills (formulae/effects)!
● ARCHIVED · READ-ONLY
-
-
This kind of thread exists already: https://forums.rpgmakerweb.com/index.php?threads/rmmv-damage-formula-ideas-and-help.47099/
Of course, I'm no moderator. I'm not going to tell you to go post there so I'll answer anyway
1) Undying Will: Attack debuff on an enemy, 5 turns; restores 10% HP; boosts player defense.
In the effects section, I have "Add Debuff Attack 5 turns."
But, what formula do I need for the 10% life restoration and boosting player defense?
Right now I have the Damage Type as HP Damage with Element "None" and this formula:
a.add_buff(2); a.gainHp(0.10)You didn't read it well enough.(I've read the Damage Formulae 101 guide, but I'm still strugglin'.)
First off, add_buff() isn't even a function in MV. It should be addBuff()
Second, you write "Add Debuff Attack" yet you buff it instead.
Third, you wanted to debuff the enemy yet you debuffed the caster, i.e your actor.
Becuse you're debuffing your target, the enemy, you use b.What do things like a and b mean?
a - attacker
b - defender
So if Actor Glasses were to cast Fire on a Slime. a would be Glasses and b would be Slime.
To debuff, use addDebuff(), like so -> b.addDebuff()What about buffs? Can we buff and debuff battlers?
Yes!
addBuff(paramId, turns) - adds a buff for a parameter
a.addBuff(0, 3); b.def*10
addDebuff(paramId, turns) - adds a debuff for a parameter
b.addDebuff(2, 10); 9999
What about paramId and turns? Simple. paramId is basically the parameter you're (de)buffing and turns is the number of turns the (de)buff will last. What's the Param ID?
It's given already, so the first part of your formula should be b.addDebuff(2,5)Parameter IDs
0 - Max HP
1 - Max MP
2 - Attack
3 - Defence
4 - Magic Attack
5 - Magic Defence
6 - Agility
7 - Luck
Meaning: Add Attack debuff to the target for 5 turns.
But all this is already achieved by your effects. Doing this is kind of redundant.
To restore HP:
You got the function right, but it asked for a value, not a percentage (not 0.1)How about changing HP/MP/TP?
gainHp(value) - restores HP by value
gainMp(value) - restores MP by value
gainTp(value) - restores TP by value
So, 10% of... what? Current HP? Maximum HP?
You need some basic math -> a.gainHp(a.hp * 0.1) for current HP, a.gainHp(a.mhp * 0.1) for maximum HP
No. I don't see any use of HP in that formula.2) Fury: User attack damage increases in % by missing HP %.
The formula I have is: (4*a.def- 2*b.def).
I'm using no effects. Will this accomplish what I need?
This looks correct. Remember that the part that will deal damage is the last number.5) Bloodlust: Increases user attack 5 turns and adds 5% lifesteal.
I have "Add Buff Attack 5 turns" in effects, with the "Scope" set to "The User."
How do I accomplish the lifesteal?
I found a formula that says:
c = a.atk * 4 - b.def * 2; a.gainHp(Math.round(c * 0.5))
But, I don't know if this is right? (I don't fully understand what the parts of formulae mean, yet.)
And... what is your lifesteal percentage? is it 5% (0.05) or 50% (0.5)?But only last number in the formula deals damage. If you had 2 lines of formula. (semicolon ; tells where line ends for the program)
E.g. a.atk; a.atk*2
Only a.atk*2 would be calculated for damage.
For the others... I suggest you clarify what you meant.
Fury: Is this a state that gives more ATK proportional to missing HP, or the damage basically scales based on HP?
Hostility: Is this even a buff, or just that the damage is based on DEF?
Final Stand: Which one is the 'user'? Is everyone the 'user', or a single actor giving bonus damage to everyone the less his HP is?
So, you should read the Damage Formula 101 again, and read it more carefully. If you have questions, though, feel free to ask. Just make sure that you searched for it first before asking.
I'm sorry if I sound offensive. No offense intended. -
Second, you write "Add Debuff Attack" yet you buff it instead.
Third, you wanted to debuff the enemy yet you debuffed the caster, i.e your actor.
Becuse you're debuffing your target, the enemy, you use b.
To debuff, use addDebuff(), like so -> b.addDebuff()
What about paramId and turns? Simple. paramId is basically the parameter you're (de)buffing and turns is the number of turns the (de)buff will last. What's the Param ID?
It's given already, so the first part of your formula should be b.addDebuff(2,5)
Meaning: Add Attack debuff to the target for 5 turns.
But all this is already achieved by your effects. Doing this is kind of redundant.
Sorry, perhaps I should've been clearer on this part:
The skill is meant to have 3 results.
1) Debuff enemy attack (achieved by effect).
2) Restore 10% of total HP.
3) Buff player defense.
So, I needed to debuff the enemy but also buff the player's defense with one skill, and restore 10% of the player's total HP.
No. I don't see any use of HP in that formula.
Can you tell me how to fix this?
And... what is your lifesteal percentage? is it 5% (0.05) or 50% (0.5)?
5% is the lifesteal I want.
Fury: Is this a state that gives more ATK proportional to missing HP, or the damage basically scales based on HP?
The latter. I want the damage the player does to scale with % of HP missing by some %.
Hostility: Is this even a buff, or just that the damage is based on DEF?
It's meant to increase the player's damage by some % based on their defense.
I don't know if that qualifies it as a buff, another user just told me I'd need Yanfly's Buff States Core to achieve it.
Final Stand: Which one is the 'user'? Is everyone the 'user', or a single actor giving bonus damage to everyone the less his HP is?
I wanted the whole party to gain a bonus damage by missing % of the main player's HP.
I'm sorry if I sound offensive. No offense intended.
No offense taken, at all! You've already been quite helpful.
I've read the guide a bit, but I'm new to coding and all that, so I'm still figuring out what means what and how things react to all of it in the actual game. I'm more experienced with graphic design, so my game's looking pretty good so far, I'm just having trouble with figuring out how to make skills (most of my skills for this class are done, but the more complex skills have proved trickier!).
I've searched the forum and other sites for days before finally deciding to post here. I figured out how to do my other 10 skills for this class from doing that, but these are a little tougher.
I greatly appreciate your help! Thank you. -
You dont need overcomplicated formulas for some of these effects, just using the defaults on the "skill effects" box is enough, also you need to plan better the HOW part of most of your ideas, as some are really vague in what you want exactly.
1) Do you want the restoration and defense to be per turn?
create 2 states the enemy debuff and the player debuff, set the skill to target 1 enemy and in the skill effects box set "add state Debuff" 100%
the formula one put a.addState(#) , thats it
2)that formula is a basic linear one, hp doesnt even factor on it, you want exact % of hp missing? or can you work in thesholds? 75%, 50%, 25%?
in the threshold case
if (a.hpRate() <== 0.25){ put 25% hp damage formula} else if (a.hpRate() <== 0.50) {50% hp formula} else... (you get the idea)
and so on.
3)if you want damage to scale from users def then put a.def in the damage formula, simple as that the complicated part is HOW do you want the damage to scale from defense? as a bonus? a multiplier? damage is calculated from defense only? btw Hostility is a misleading name for a defense based skill, just imo.
bonus defense damage (a.atk+a.def) - b.def
bonus defense % as damage ((a.atk + (a.def*0.X)) -b.def where X is the % bonus added
or just a simple a.def - b.def
sorry but i dont know how to implement #4 besides making an overcomplicated state that scales from missing hp on target, and i dont even know if its doable with the current plugins available, you cannot apply it directly to normal attack formula, since it would make that skill a passive for every battle, IF you want this for a specific boss fight or something you could make this specific skill a second normal attack formula and replace the standard attack just for that fight, too much hassle but there's that.
4) The normal un pluginned attack type box has HP Drain as damage type, you simply heal the damage done, now it you only want a % of the damage done as healing then you over complicate stuff again.
Yanfly action sequence can make a skill LIKE this the easiest way: Make a state that buffs your attack and gives a set % hp regen per turn, set it to 1 turn, then you can make an action sequence that triggers the state which will buff you, do the damag, then at the end of the turn you get the % regen. it wont give you the 5 turns lifesteal you want, but a single hit drain skill, havent seen formulas that calculate over resulting damage, just on resulting stats, if someone has one please share :3 -
1) Do you want the restoration and defense to be per turn?
create 2 states the enemy debuff and the player debuff, set the skill to target 1 enemy and in the skill effects box set "add state Debuff" 100%
the formula one put a.addState(#) , thats it
Makes sense.
For 1):
In the formulas (under Type: HP Damage, with an Element of None), as you suggested, I put a.addState(17,18).
(The states are numbers 17 and 18.)
Scope: 1 Enemy
Effects: Add Debuff - Attack 5 turns (to debuff enemy attack for 5 turns)
Then, I created two states, one to add 10% HP, and one to add 10% to player defense for 5 turns.
2)that formula is a basic linear one, hp doesnt even factor on it, you want exact % of hp missing? or can you work in thesholds? 75%, 50%, 25%?
in the threshold case
if (a.hpRate() <== 0.25){ put 25% hp damage formula} else if (a.hpRate() <== 0.50) {50% hp formula} else... (you get the idea)
and so on.
I'd like exact % of HP missing, ideally.
Do I use HP Damage Type and Element None for 2)?
"3)if you want damage to scale from users def then put a.def in the damage formula, simple as that the complicated part is HOW do you want the damage to scale from defense? as a bonus? a multiplier? damage is calculated from defense only? btw Hostility is a misleading name for a defense based skill, just imo.
bonus defense damage (a.atk+a.def) - b.def
bonus defense % as damage ((a.atk + (a.def*0.X)) -b.def where X is the % bonus added
or just a simple a.def - b.def"
So, if I put ((a.atk + (a.def*0.05)) -b.def in the formula for this skill under type HP Damage, Element None, using the skill will cause the player's damage to increase as a bonus based on the player's defense stat?
And, thank you very much! -
on 1) You can merge the hp and def bonus on a single state, simplifies things, unless you will manage buff states separately on other skills you will develop later and prefer to have separate buff states you can mix and match, in that case its ok to keep them on 2 individual states.
on 2) Yes the "element type" definition is for elemental attacks types that you define in your game, think pokemon elements, fire/water etc, so the damage of that element calculates against elemental resists/weak bonuses, IF you use those, you can declare a "physical" damage type in case you want to create that resistance, else set it to none, it will do normal damage even with no element.
and yes using ((a.atk + (a.def*0.05)) -b.def will add 5% of the attackers def as extra attack, which its a bit low and unnoticeable, try at least 20% (0.20) to make it stand out. -
You can merge the hp and def bonus on a single state, simplifies things, unless you will manage buff states separately on other skills you will develop later and prefer to have separate buff states you can mix and match, in that case its ok to keep them on 2 individual states.
I actually thought I might do them separately so I could use them later.
and yes using ((a.atk + (a.def*0.05)) -b.def will add 5% of the attackers def as extra attack, which its a bit low and unnoticeable, try at least 20% (0.20) to make it stand out.
Awesome, thank you! And, I'll kick it up a bit.
Regarding 2), what is the formula for exact % of health, rather than thresholds? -
Regarding 2), what is the formula for exact % of health, rather than thresholds?
The formula to get the exact % of health of the attacker is "a.hpRate()", which BK-tdm gave you above.
The rest is a math question, and also a question of what you want to implement in your game. Furthermore, you will only know if the formula is right by thoroughly testing it on your monsters (against their HP, against their DEF, etc.), which we can't help with.
- Do you want to increase the damage linearly, quadratically, logarithmically, or otherwise?
- Does the first 25% of lost HP increase the damage just as much as the last 25%? Or does the first 25% of lost HP increase the damage more/less than the last 25%?
- Is there a cap on the bonus damage that one could achieve?
Code:Where y is the damage output, x is the hpRate of the attacker, and a & b & c are constants that modulate the intensity of the damage modification.y = a(b - x) + c // linear y = a(b - x^2) + c // quadratic y = a(b - log(x)) + c // logarithmic -
The formula to get the exact % of health of the attacker is "a.hpRate()", which BK-tdm gave you above.
Oh, I get it, now!
Do you want to increase the damage linearly, quadratically, logarithmically, or otherwise?
I'm not certain what the difference would be in-game, honestly, so I don't have a preference.
Does the first 25% of lost HP increase the damage just as much as the last 25%? Or does the first 25% of lost HP increase the damage more/less than the last 25%?
All the same, preferably.
Is there a cap on the bonus damage that one could achieve?
500, I think.
So, would I just put (a.atk * 4 - b.def * 2)a.hpRate() in the formula box to scale damage by exact HP?
How do I set how much it scales and cap max damage?
Thank you! -
So, would I just put (a.atk * 4 - b.def * 2)a.hpRate() in the formula box to scale damage by exact HP?
How do I set how much it scales and cap max damage?
Math.min( ( (a.atk * 4 - b.def * 2) * a.hpRate() ) , 500) SHOULD return 500 as the minimum between the 2 values if the formula goes above 500, the test phase is up to you, also you missed the * for the hp rate multiplier setting.
The net a.hpRate() will give you the exact % of missing hp up to 100%, or well 99% since a dead actor cant attack anyways. -
Keep in mind that this would actually decrease the damage output at lower health ( x * 0.2 is less than x * 0.5 )Math.min( ( (a.atk * 4 - b.def * 2) * a.hpRate() ) , 500)
@JRand I think you still need to be more specific on what you actually want. Remember that in order to put something into a formula, it has to be a precise quantity, rather than a vague idea.
^^ This means that you want a linear relationship between the health missing and the damage boost.All the same, preferably.
Do you want the damage to increase by a flat amount per % health missing?
Or, should the damage increase by a % per % health missing?
Here's an example from League of Legends:
Passive: Tryndamere thirsts for blood, gaining 5/10/15/20/25 Attack Damage plus 0.15/0.2/0.25/0.3/0.35 per 1% Health missing.
This is an example of a flat amount increase per % health missing.
It's actually even more complicated than yours because in League of Legends you can increase the rank of your skill (0.15/0.2/0.25 means the skill gets stronger as the rank is increased). Unless you're doing that, yours would just be "+X per 1% Health missing" or "+X% per 1% Health missing", depending on the answer to my questions above. -
Keep in mind that this would actually decrease the damage output at lower health ( x * 0.2 is less than x * 0.5 )
So, what do I need to do to Math.min( ( (a.atk * 4 - b.def * 2) * a.hpRate() ) , 500) to get it to increase the damage?
Do you want the damage to increase by a flat amount per % health missing?
Flat amount per % health missing.
So, something like 0.15% per 1% health missing (unless that may seem too low?).
Thank you! I think this is the only skill I still need assistance with. -
Flat amount per % health missing.
So, something like 0.15% per 1% health missing (unless that may seem too low?).
You're saying two different things here B)
You said flat amount per % health missing and then you said 0.15% per 1% health missing. -
You're saying two different things here B)
You said flat amount per % health missing and then you said 0.15% per 1% health missing.
What do I change the formula to to increase damage as health gets lower by a flat rate? -
Ok, so you want a flat amount of "+0.15 damage per 1% health missing" rather than a percent rate of "+0.15% damage per 1% health missing."
Here is building the formula in steps:
- a.hpRate() gives us a number between 0 (dead) and 1 (full health) --> a.hpRate()
- To find the health missing, we take (1 - hpRate) --> (1 - a.hpRate())
- To convert that into %, we multiply by 100. --> 100 * (1 - a.hpRate())
- To increase the damage by a flat factor, multiply by that flat factor --> 0.15 * 100 * (1 - a.hpRate())
- To cap the increase at 500 (which couldn't happen under these conditions, but anyway) --> Math.min( 0.15 * 100 * (1 - a.hpRate()), 500)
- To complete the formula --> "Your normal attack formula" + Math.min( 0.15 * 100 * (1 - a.hpRate()), 500)
Code:"Your normal attack formula" + Math.min( 0.15 * 100 * (1 - a.hpRate()), 500) -
Ok, so you want a flat amount of "+0.15 damage per 1% health missing" rather than a percent rate of "+0.15% damage per 1% health missing."
Here is building the formula in steps:
- a.hpRate() gives us a number between 0 (dead) and 1 (full health) --> a.hpRate()
- To find the health missing, we take (1 - hpRate) --> (1 - a.hpRate())
- To convert that into %, we multiply by 100. --> 100 * (1 - a.hpRate())
- To increase the damage by a flat factor, multiply by that flat factor --> 0.15 * 100 * (1 - a.hpRate())
- To cap the increase at 500 (which couldn't happen under these conditions, but anyway) --> Math.min( 0.15 * 100 * (1 - a.hpRate()), 500)
- To complete the formula --> "Your normal attack formula" + Math.min( 0.15 * 100 * (1 - a.hpRate()), 500)
Code:"Your normal attack formula" + Math.min( 0.15 * 100 * (1 - a.hpRate()), 500)
Awesome! Very informative. Thank you so much.
It produced:
(a.atk * 4 - b.def * 2) + Math.min( 0.15 * 100 * (1 - a.hpRate()), 500) -
Perfect!
Remember that any formula is only as good as the testing and balancing for it, and thinking through all the possibilities.
For example:
+0.15 damage per 1% HP missing
If the actor is nearly dead, let's say they have 99% HP missing.
Bonus damage = 0.15 * 99 = +14 damage
If you have a game with small HP amounts, that might be a significant bonus. If you have a game with large HP amounts, it might not be a very good bonus. It all depends on your project, and how you balance the enemies. -
Guess so. Well, that's what this forum is for. Ask away.I've read the guide a bit, but I'm new to coding and all that, so I'm still figuring out what means what and how things react to all of it in the actual game.
Now, Aloe Guvner and BK-tdm has already answered some of your questions, and I will try to answer the rest.
For 1), I have given the HP restoration part (a.gainHp(a.mhp * 0.1)), so the buff part is simply a.addBuff(3, 5), where the 3 is the Defense stat, and the 5 is the number of turns. Remember that the last number in your formula is your skill's damage, so you'll have to probably rearrange the numbers if the skill deals 0 damage.
2 and 3 are already answered but I would like to add one thing:
Basic math said that you could simplify this to 15, so the formula on the right side of the plus becomes Math.min(15 * (1 - a.hpRate()), 500)(a.atk * 4 - b.def * 2) + Math.min( 0.15 * 100 * (1 - a.hpRate()), 500)
If this is your formula, then why bother with Math.min?
Aloe Guvner give you an option. Doesn't mean that you should use it. The bonus damage would NEVER exceed 500 anyway. 15 multiplied by any number less than 1 would never even exceed 15, let alone 500!To cap the increase at 500 (which couldn't happen under these conditions, but anyway)
Anyway, which is correct for 2:
1. Flat amount per % health missing; or
2. 0.15% per 1% health missing?
These two mean different things.
4 is very tedious to do natively, but it's possible, yes. To do this a bit more quickly, use a common event:
This basically assigns the value of (Max HP - Current HP) / Max HP to a variable with ID of 4.
On every skill that have a damage boost, include v[4],where 4 is your variable ID that you assign. In the picture it's 4, so I put 4 in there.
Also on every skill, call this common event (Double-click the Effect list > Other > Common Event, then choose this common event)
Doing this with 100+ skills? Well, good luck. That's the only way I could think of natively.
5 requires a plugin in the lifesteal department, because this is a buff. I use Yanfly's Life Steal.
Answer this: what, exactly, is this skill doing? Is it just applying a state that increases any skill's damage, or is this an attack skill (where you target an enemy) that deals damage, the amount of which is increased by some % based on their defense? If it's the former it's a buff.It's meant to increase the player's damage by some % based on their defense.
I don't know if that qualifies it as a buff -
@mmgfrcs
I used your advice on #1.
Regarding 2, the formula I am using is:
(a.atk * 4 - b.def * 2) + Math.min( 0.15 * 100 * (1 - a.hpRate()), 500)
I intended for the player's attack to increase by a set amount by %. I don't know if that answers your question.
4 is very tedious to do natively, but it's possible, yes. To do this a bit more quickly, use a common event:
This basically assigns the value of (Max HP - Current HP) / Max HP to a variable with ID of 4.
What do I set in the contents of this variable?
(Also, I only have 15 skills per class for 4 classes, and only 1 class has that ability!)
Answer this: what, exactly, is this skill doing? Is it just applying a state that increases any skill's damage, or is this an attack skill (where you target an enemy) that deals damage, the amount of which is increased by some % based on their defense? If it's the former it's a buff.
It is meant to apply a state that increases any skill's damage.
On 5, I have it set to Scope: The User.
Formula (HP Damage / Element: None):
c = a.atk * 4 - b.def * 2; a.gainHp(Math.round(c * 0.05))
Effects: Add Buff, Attack 5 turns -
So, my understanding is that the player's ATK increases by 0.15% for every 1% of target's health missing. Is this correct? (Basically, the 2nd thing that Alex Guvnor said)
So if 20% of health is missing, ATK increases by 3%?
If your ATK is 100, that's 3 bonus ATK
I'm not going to touch skill 2 yet. You said 'attack damage', then say 'attack':
Fury: User attack damage increases in % by missing HP %.'Attack' is a parameter (buff and debuff usually goes to Attack rather than damage). 'Attack damage' (or simply 'damage') is the final number you'll deal to the enemy. Which one is it?I intended for the player's attack to increase by a set amount by %
Uh... that image explains it already. You first set it with the actor's Max HP, then subtract it with his HP (getting his missing health), then divide it with his Max HP (getting the rate of missing HP)What do I set in the contents of this variable?
To do that:
Go to your Database > Common Event
On an empty Common Event, double-click on the first line > Control Variables
On the dialog that opens, set the Variable group to SIngle, then click the box with the triple dots (...) and choose any variable you want.
On the Operations group, choose Set
On the Operand group, choose Game Data, then click the box with the triple dots, then choose Actor. On the middle box, choose the one to check for health (the main character), then on the right box choose Max HP
Click OK, then click it again until you go back to the Common Event screen.
Repeat for the other 2 entries, double-clicking the next line > Control Variables, etc. with the same variable but different Operation and Operands
Ok so for number 5 you'll need a plugin. You can't do the lifesteal with the damage formula, and you don't need any damage formula anyway.It is meant to apply a state that increases any skill's damage.
To do so, add a state to your database called 'Lifesteal' (any name will do)
I use Yanfly's Life Steal, so if you use it too, put either of these notetags on the Notes section of your 'Lifesteal' state:
<HP Life Steal Physical: +50>
<HP Life Steal Magical: +50>
<HP Life Steal Certain: +50>
Depending on what type of skill would lifesteal: Physical, Magical, Certain or any combination of the three.
On skill 5, add another effect: Add State > your 'Lifesteal' state > 100%
If you use other lifesteal plugins, the instructions differ.