RMMV Damage Formula - ideas and help

PlatypusOfDoom

Villager
Member
Joined
Aug 24, 2012
Messages
24
Reaction score
5
How would one go around to setting up a basic attack, that does more damage based on how much HP the user has lost? 
You could add in something like atk * (1 - (a.hp/a.mhp)) to get that effect. It deals damage based on a percentage of their current health over their max health. Alternatively, if you wanted to do something like deal 2 damage per each HP lost, you would do 2 * (a.mhp - a.hp). 

VHStapes, on 01 Nov 2015 - 2:17 PM, said:

EDIT: New question!

How can I target a different character in the party, besides a or b, without it being actor specific? Let's say I want a skill that deals damage and heals every party member except the caster for an amount equal to the damage dealt? So...

x = (a.tk - b.def); ALL_OTHER_PARTY_MEMBERS.gainHp(x); x

What should ALL_OTHER_PARTY_MEMBERS be replaced with?
I'm trying to do some skill that is quite the same of your, did you figured out how to heal/buff all party members? I didn't find a reply in here about this, or maybe i'm blind lol.

I'm looking to do 2 "limit" skills that deals aoe damage to enemy, one as bonus heal the party and remove debuffs, and the other give bonus damage of 1 element....

Someone know how to apply heal/buff to entire party? I just need an example so i can figure out other kind of similar "limit" skill
I've been trying to figure out the command for doing this, as well. My only difference is that I would want it to heal the entire party instead of every OTHER member, but I figure the way to do it would be similar. Any ideas?
 

dayhjawk

Veteran
Veteran
Joined
Jul 5, 2015
Messages
107
Reaction score
12
First Language
English
Primarily Uses
You could add in something like atk * (1 - (a.hp/a.mhp)) to get that effect. It deals damage based on a percentage of their current health over their max health. Alternatively, if you wanted to do something like deal 2 damage per each HP lost, you would do 2 * (a.mhp - a.hp). 
So I would do something like this for the formula?

a.atk * (1 - (a.hp/a.mhp)) - b.def * 2
 

VHStapes

Game Designer
Veteran
Joined
May 25, 2014
Messages
57
Reaction score
7
First Language
English
If I'm right, I think it would need a for loop to target all the actors. I just don't know what the code would be exactly.

Something like

for(var i = 0; i < $gameParty.members.length(); i++) { $gameParty.members(i).hp + x; $gameParty.members(i).removeBuff };You might want to replace:

$gameParty.member(i)withBattleManager.actor(i)Of course you'd need some code in there for the actual damage and healing calculations.

Also, I wouldn't expect to plug this in and have it work as I am a Javascript n00b, but I'm sure someone can clean it up from here.

(So many edits, I shall not double post!)
 
Last edited by a moderator:

Heathurr

Veteran
Veteran
Joined
Aug 10, 2015
Messages
38
Reaction score
2
First Language
English
I might have missed it, but is there a way to make sure attacks do at least 1 point of damage? Having NULL pop up when the party outlevels enemies is kinda sloppy looking. :c

edit: Nevermind! I got it!
 
Last edited by a moderator:

VHStapes

Game Designer
Veteran
Joined
May 25, 2014
Messages
57
Reaction score
7
First Language
English
I'm trying to make a skill that adds to the actor's atk value based on your party's gold, then removes gold equal to the amount it added. So far I've got it adding damage correctly, but it doesn't remove the gold. In fact, when I include any attempt at removing gold, it deals exactly 0 damage every time. Any ideas?

Code:
x = a.atk + ($gameParty.gold() / 100); x - b.def; x; $gameParty.gainGold(-x)
 
Last edited by a moderator:

Musashi

Veteran
Veteran
Joined
Oct 30, 2012
Messages
155
Reaction score
261
First Language
Portuguese
@VHStapes, damage must be the last thing in the formula
 

Silenity

Veteran
Veteran
Joined
Dec 17, 2013
Messages
689
Reaction score
282
First Language
English
Primarily Uses
RMMZ
How do I make a damage formula that scales off of the enemies missing health?

I'm trying to copy Riven's Wind Slash skill from League of Legends.

XX26Xe0.png
 

RogdagoR

Veteran
Veteran
Joined
Oct 1, 2015
Messages
134
Reaction score
32
First Language
Italian
I've been trying to figure out the command for doing this, as well. My only difference is that I would want it to heal the entire party instead of every OTHER member, but I figure the way to do it would be similar. Any ideas?
VHStapes said:
If I'm right, I think it would need a for loop to target all the actors. I just don't know what the code would be exactly.


Something like


for(var i = 0; i < $gameParty.members.length(); i++) { $gameParty.members(i).hp + x; $gameParty.members(i).removeBuff };


You might want to replace:


$gameParty.member(i)


with


BattleManager.actor(i)


Of course you'd need some code in there for the actual damage and healing calculations.


Also, I wouldn't expect to plug this in and have it work as I am a Javascript n00b, but I'm sure someone can clean it up from here.
 
I was wondering if there is a command for "call" one other skill, i mean i cast my aoe, it resolve the damage and then call the aoe heal spell, is it doable?
 
Last edited by a moderator:

Nuhada

Villager
Member
Joined
Oct 26, 2015
Messages
27
Reaction score
14
First Language
French
How do I make a damage formula that scales off of the enemies missing health?

I'm trying to copy Riven's Wind Slash skill from League of Legends.

XX26Xe0.png
If you want to make exactly this skill (exept for the level of the skill), it should look at something like this:

y=(1-Math.max((b.hp/b.mhp),0.25));r=120+(a.atk*0.6);r=Math.round(r*(2.67*y+1));rWith the y as the % of target's missing health with a cap for the 75%, first part r as the minimum physical damages increased by the atk of the user (or the AD in lol), and second part r as the multiplication of the target's missing health percentage.
 

Silenity

Veteran
Veteran
Joined
Dec 17, 2013
Messages
689
Reaction score
282
First Language
English
Primarily Uses
RMMZ
If you want to make exactly this skill (exept for the level of the skill), it should look at something like this:

y=(1-Math.max((b.hp/b.mhp),0.25));r=120+(a.atk*0.6);r=Math.round(r*(2.67*y+1));rWith the y as the % of target's missing health with a cap for the 75%, first part r as the minimum physical damages increased by the atk of the user (or the AD in lol), and second part r as the multiplication of the target's missing health percentage.
Thanks! Do you think you could help me with another one?

I'm trying to recreate Garen's Decisive Strike from League of Legends. I find that LoL has a lot of interesting skills that I can pull ideas from. >_<

I'm trying to have the skill remove negative states from Garen while also adding a speed buff to him. On top of that I'm trying to make the skill add a silence state to the enemy.

a.add_state(13); 30 + a.atk + (a.atk * .4)
This is what I currently have but it seems to do no damage. I can inflict the silence fine but need help with removing negative states as well as adding the speed state.

e6rckwS.png
 

lexisgemini

Villager
Member
Joined
Nov 7, 2015
Messages
5
Reaction score
1
a = the user of the skill

b = the target of the skill (enemy - bear in mind that this is from the point of view of the user.  So an 'enemy' of the Demon Lord is your hero.)

* = multiplication sign.  

the main stats use the normal abbreviation.  So

a.atk * 4 - b.def * 2

means that you have the attack value of the user multiplied by 4, from which you deduct (the minus sign) the defence of the target, times 2.  The resulting number is how much damage is inflicted.

There are other things, but if you are a complete newbie, I think those are the main things to remember.  Once you've worked that out, it is simpler to follow what is going on.
If i was to use this formula when creating skills the higher lvled the skill is the higher i would make the atk number say from a.atk * 4 - b.def * 2 to something like a.atk * 6 - b.def * 3 to make that a stronger atk?
 

Nuhada

Villager
Member
Joined
Oct 26, 2015
Messages
27
Reaction score
14
First Language
French
Thanks! Do you think you could help me with another one?

I'm trying to recreate Garen's Decisive Strike from League of Legends. I find that LoL has a lot of interesting skills that I can pull ideas from. >_<

I'm trying to have the skill remove negative states from Garen while also adding a speed buff to him. On top of that I'm trying to make the skill add a silence state to the enemy.

a.add_state(13); 30 + a.atk + (a.atk * .4)This is what I currently have but it seems to do no damage. I can inflict the silence fine but need help with removing negative states as well as adding the speed state.

e6rckwS.png
For adding the state, do as he said:

Use a.addState
To remove hexes, just put "a.removeState(x)" or all the states you want to remove, and for the buff, put "a.addBuff(6,y)" with y as the number of turns the buff stay. (6 is for the agi buff).
 

jgleazy

Villager
Member
Joined
May 14, 2015
Messages
7
Reaction score
0
First Language
english
Hey guys,

I'm trying to create a skill which will inflict state X at a 50% chance rate, ONLY when the enemy's darkness element rate is X.  Any help?
 
Last edited by a moderator:

Nuhada

Villager
Member
Joined
Oct 26, 2015
Messages
27
Reaction score
14
First Language
French
Hey guys,

I'm trying to create a skill which will inflict state X at a 50% chance rate, ONLY when the enemy's darkness element rate is X.  Any help?
b.elementRate(Y)>X?Math.random()>0.5?a.addState(Z):0:0;with

Y: ID of darkness element

X: Darkness element rate (with 1=100%, 2=200%, 0.5=50%, etc...)

Z: Id of state you want to add

:)
 

PlatypusOfDoom

Villager
Member
Joined
Aug 24, 2012
Messages
24
Reaction score
5
I'm trying to have a skill with a guaranteed critical. In VX ACE you could use: b.result.critical = true

This doesn't work in MV and I can't work out why.
I finally figured this one out. :D For those of you wondering how to do this, try:

b.result().critical = true 

Also is it possible to have a crit apply a an affect to the enemy or myself
With that in mind, you could do something like: 

if (b.result().critical) {a.addState(x); y} else {y}Here you would replace x with your state ID and y with your base damage formula. Also, a.addState(x) would add a state to the user, whereas you could do b.addState(x) to add a state to the victim in the case of a crit.

Note that I just tested this with Yanfly's new Damage Core plugin and that plugin seems to prevent this from working, probably because it changes the order that damage is calculated.
 

SgtBusCake

Villager
Member
Joined
Oct 27, 2015
Messages
15
Reaction score
10
First Language
English
Primarily Uses
Other
I finally figured this one out. :D For those of you wondering how to do this, try:

b.result().critical = true 



With that in mind, you could do something like: 

if (b.result().critical) {a.addState(x); y} else {y}Here you would replace x with your state ID and y with your base damage formula. Also, a.addState(x) would add a state to the user, whereas you could do b.addState(x) to add a state to the victim in the case of a crit.

Note that I just tested this with Yanfly's new Damage Core plugin and that plugin seems to prevent this from working, probably because it changes the order that damage is calculated.
The below has been working for me splendidly for testing purposes (or something close):

if (b.result().critical) {a.addState(x); y} else {y}I think for the other b.result().critical = true, the game will display the graphical effects of a critical hit, but does not seem force critical damage. I don't have any plugins enabled at the moment.
 

jgleazy

Villager
Member
Joined
May 14, 2015
Messages
7
Reaction score
0
First Language
english
b.elementRate(Y)>X?Math.random()>0.5?a.addState(Z):0:0;with

Y: ID of darkness element

X: Darkness element rate (with 1=100%, 2=200%, 0.5=50%, etc...)

Z: Id of state you want to add

:)
You are the bomb thank you! :)  
 

saikais

Warper
Member
Joined
Aug 9, 2013
Messages
1
Reaction score
1
First Language
English
Primarily Uses
Hey I dont know if it the right place to ask this, sorry in advance if it's not.

So I'm using small number in my game, ex: starting stat are around 30hp, 10 atk,10 def and so on.

But the default formula (a.atk*4 - b.def*2) make battle mostly once side for the fastest side.

So I tried takimg out the multiplier but the defence become way to strong for most battle.

So you guys/girls have any suggestion of what I could use ?

Thanks in advances.
 

Latest Threads

Latest Posts

Latest Profile Posts

Interesting week. Lots of stress and anxiety especially on Tuesday but still got thru it. How is everyone doing?
I was pleased with how the little ... whatever those square bits like upside-down turrets on the skirt are? I like how they turned out. Here's a little ranger/bandit/archery enthusiast to model it:

TestChara-08.gif


I'm calling her Robin because obviously.
Just downloaded the demo and boy howdy are my arms tired (???) :kaohi:
I just watched a trailer for the upcoming 2021 JRPG Fantasian. They demonstrated an interesting mechanic where random encounters can be sent to a stockpile instead of fighting them right away, which can be emptied in a single battle string at the player's choice of timing.
"The pleasure from the senses seems like nectar at first, but it is sour as the toxin in the end." -Kirshna

Forum statistics

Threads
109,156
Messages
1,042,598
Members
141,656
Latest member
drackdragon113
Top