RMMV Damage Formula - ideas and help

Rukomura

Lurker
Member
Joined
Dec 16, 2014
Messages
26
Reaction score
7
First Language
Italian
Primarily Uses
I'm having problems with a certain skill.


What I want to do is:


- Revive a fallen party member


- Add to the member's current HP the result of the skill user's current HP divided by 2;


- Substract to the user the result above.


I tried with


b.removeState(1); a.gainHP(- a.hp / 2); b.gainHP(a.hp / 2)


it does work for removing the state, but not for the recover/substract hp. What did I do wrong? (I also remember in VX Ace you could do something like a.mp -= formula but it doesn't work as well, I tried).
 

Riff

Eorzean
Veteran
Joined
Oct 25, 2015
Messages
266
Reaction score
84
First Language
English
Primarily Uses
RMMV
The stages are correct. I had 3 layers (11,12,13) and He had 2 layers (17,18) but it didn't calculate his 2 layers. So he did the damage as if he hasn't buffed himself even though he did buff himself 


Sorry, I still fail to see where the error is. The formula looks fine to me. I'm not sure if this will make a difference, but perhaps you should try this:


var rate = 1;
for (var i = 0; i < b.states().length; ++i) {
var state = b.states();
if (!state) continue;
if ([11, 12, 13].contains(state.id)) rate *= 0.50;
}
for (var i = 0; i < a.states().length; ++i) {
var state = a.states();
if (!state) continue;
if ([14, 15, 16].contains(state.id)) rate *= 0.50;
}
for (var i = 0; i < a.states().length; ++i) {
var state = a.states();
if (!state) continue;
if ([17, 18, 19, 20, 21, 22, 23, 24].contains(state.id)) rate *= 1.30;
}
value = 99999 * rate;


I hope it works though. I'm no expert in Javascript. I take existing examples and try my best to understand the codes and modify to my needs.

I'm having problems with a certain skill.


What I want to do is:


- Revive a fallen party member


- Add to the member's current HP the result of the skill user's current HP divided by 2;


- Substract to the user the result above.


I tried with



b.removeState(1); a.gainHP(- a.hp / 2); b.gainHP(a.hp / 2)


it does work for removing the state, but not for the recover/substract hp. What did I do wrong? (I also remember in VX Ace you could do something like a.mp -= formula but it doesn't work as well, I tried).


You had a minor error in the function (if that's what they're called), they are case sensitive. Also, make sure you store the value first before moving the hp from the user. Otherwise, the target will only receive half of the user's halved hp (or quarter). Give this a try:


b.removeState(1); var d = a.hp/2; a.gainHp(-d); d;




Make sure your target scope is 1 Ally (Dead).


Hope that helps!


- Riff
 

Rukomura

Lurker
Member
Joined
Dec 16, 2014
Messages
26
Reaction score
7
First Language
Italian
Primarily Uses
You had a minor error in the function (if that's what they're called), they are case sensitive. Also, make sure you store the value first before moving the hp from the user. Otherwise, the target will only receive half of the user's halved hp (or quarter). Give this a try:



b.removeState(1); var d = a.hp/2; a.gainHp(-d); d;




Make sure your target scope is 1 Ally (Dead).


Hope that helps!


- Riff


Works as intended! Thank you very much!
 

emelian65

Veteran
Veteran
Joined
Sep 13, 2015
Messages
190
Reaction score
50
First Language
Spanish
Primarily Uses
Hello again everyone!!!!


I have a question, is it possible to make a skill that hits more times depending on a stat?


What I want to make is a skill like Multi-Hit and Multi-Strike from Devil Survivor 2,


Both skills hit 2 times when the character has low Agility, the more Agility the user has the more hits the user deals, up to 7 hits.


Is possible to make it with the formula box only? if not, is it possible to use Yanfly Action Sequence pack to make it?


Thank you all for your help
 

Riff

Eorzean
Veteran
Joined
Oct 25, 2015
Messages
266
Reaction score
84
First Language
English
Primarily Uses
RMMV
Hello again everyone!!!!


I have a question, is it possible to make a skill that hits more times depending on a stat?


What I want to make is a skill like Multi-Hit and Multi-Strike from Devil Survivor 2,


Both skills hit 2 times when the character has low Agility, the more Agility the user has the more hits the user deals, up to 7 hits.


Is possible to make it with the formula box only? if not, is it possible to use Yanfly Action Sequence pack to make it?


Thank you all for your help


Hello!


With the damage formula, you can scale damage with user stats (agi in your case), but if you want more hits, you'd have to use yanfly's action sequence pack.


- Riff
 
Last edited by a moderator:

emelian65

Veteran
Veteran
Joined
Sep 13, 2015
Messages
190
Reaction score
50
First Language
Spanish
Primarily Uses
Hello!


With the damage formula, you can scale damage with user stats (agi in your case), but if you want more hits, you'd have to use yanfly's action sequence pack.


- Riff


i suspected as much, do any of you have an idea of how to do the lunatic code for it? I'm not that good with Java
 

TheRiotInside

Extra Ordinaire
Veteran
Joined
Sep 3, 2012
Messages
270
Reaction score
123
First Language
English
Primarily Uses
i suspected as much, do any of you have an idea of how to do the lunatic code for it? I'm not that good with Java


This might not get you all the way there, but a lot of the syntax should carry over to what you're looking for. Just saw this a few days ago; hope it helps :)
 

Korokage

Veteran
Veteran
Joined
Mar 1, 2015
Messages
56
Reaction score
9
First Language
English
Primarily Uses
So, I decided to see if I could use a for loop in a damage formula and came up with a formula that SHOULD cycle through all the states on a target, identify only certain states (like poison, blind, etc. as opposed to beneficial states), and deal an extra 100 damage for each state that matches the ids it should be looking for.


And then it does 0 damage during testing. I'm not good enough with Javascript to identify where I went wrong, so here I am. I used Yanfly's Damage Core plugin to use the notebox of the skill as a formula box, just in case it was too big. If it looks familiar... I sort of used a chunk of code that @Riff posted up.

Code:
var rate = 1;
for (var i = 0; i < b.states().length; ++i) {
var state = b.states()[i];
if (!state) continue;
if ([4, 5, 6, 7, 8, 9, 10].contains(state.id)) rate *= 100;
}
a.atk * 4 + rate;
 

Riff

Eorzean
Veteran
Joined
Oct 25, 2015
Messages
266
Reaction score
84
First Language
English
Primarily Uses
RMMV
So, I decided to see if I could use a for loop in a damage formula and came up with a formula that SHOULD cycle through all the states on a target, identify only certain states (like poison, blind, etc. as opposed to beneficial states), and deal an extra 100 damage for each state that matches the ids it should be looking for.


And then it does 0 damage during testing. I'm not good enough with Javascript to identify where I went wrong, so here I am. I used Yanfly's Damage Core plugin to use the notebox of the skill as a formula box, just in case it was too big. If it looks familiar... I sort of used a chunk of code that @Riff posted up.



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 *= 100;
}
a.atk * 4 + rate;






Try this for the last line:


value = a.atk * 4 + rate;


Also, I would suggest you to use


var rate = 0;


for the first line, and


rate += 100;


for the 3rd line from bottom. So each state will increase the bonus damage by 100, instead of multiplying.
 

Korokage

Veteran
Veteran
Joined
Mar 1, 2015
Messages
56
Reaction score
9
First Language
English
Primarily Uses
@Riff


Ah, yes... it would make more sense to ADD 100 to the rate instead of multiplying each time.


Other than that, it worked perfectly! Well, the base damage when the target had no states was 104 for some reason, but still. Thank you for your help~


Edit: derp, realized a minute ago that the base damage (that is, with no states on the target) was higher than expected because of how I had Yanfly's Armor Scaling setup. Derp. But yeah, thanks Riff~
 
Last edited by a moderator:

rpglover88

Rpg & Anime Maniac
Veteran
Joined
May 12, 2013
Messages
169
Reaction score
24
First Language
French
Primarily Uses
Im trying to make a skill that will finish off an enemy that has the immortal stat but the skill must only work when that enemy has 10% HP or less remaining. Is there a way to do this with a formula?
 

Riff

Eorzean
Veteran
Joined
Oct 25, 2015
Messages
266
Reaction score
84
First Language
English
Primarily Uses
RMMV
Im trying to make a skill that will finish off an enemy that has the immortal stat but the skill must only work when that enemy has 10% HP or less remaining. Is there a way to do this with a formula?


Maybe try:


(b.hpRate <= 0.1) ? b.removeState(x); b.mhp * 0.1 : 0


Change x to the id of your immortal state.


Hope that helps!


- Riff
 

rpglover88

Rpg & Anime Maniac
Veteran
Joined
May 12, 2013
Messages
169
Reaction score
24
First Language
French
Primarily Uses
Thanks for the quick reply Riff!


I tryed your formula but unless im the one doing something wrong, it doesnt work. :(


Heres what i did:


Untitled.png


The id of the immortal state in my game is 3 btw, so that shouldnt be the problem.


The attack always does 0 damage. It doesnt remove the immortal state and it doesnt kill the enemy either. :(
 

Riff

Eorzean
Veteran
Joined
Oct 25, 2015
Messages
266
Reaction score
84
First Language
English
Primarily Uses
RMMV
Thanks for the quick reply Riff!


I tryed your formula but unless im the one doing something wrong, it doesnt work. :(


Heres what i did:


View attachment 32126


The id of the immortal state in my game is 3 btw, so that shouldnt be the problem.


The attack always does 0 damage. It doesnt remove the immortal state and it doesnt kill the enemy either. :(


Was your target hp less than 10%?
 

rpglover88

Rpg & Anime Maniac
Veteran
Joined
May 12, 2013
Messages
169
Reaction score
24
First Language
French
Primarily Uses
Yes. The enemys max hp is 6000 and when i used the skill the enemy had 20 hp left.
 

Riff

Eorzean
Veteran
Joined
Oct 25, 2015
Messages
266
Reaction score
84
First Language
English
Primarily Uses
RMMV
Yes. The enemys max hp is 6000 and when i used the skill the enemy had 20 hp left.


Maybe try:


(b.hp/b.mhp <= 0.1) ? b.removeState(3); b.mhp * 0.1 : 0
 

rpglover88

Rpg & Anime Maniac
Veteran
Joined
May 12, 2013
Messages
169
Reaction score
24
First Language
French
Primarily Uses
It still doesnt work... T.T
 

Suushii

Veteran
Veteran
Joined
Jun 21, 2012
Messages
31
Reaction score
5
First Language
English
Primarily Uses
RMMV
It still doesnt work... T.T
Ooh, I think I got it.


if (b.hp <= b.mhp * 0.1) {b.removeState(3); value = b.mhp * 0.1;}


It worked for me on a clean project, so try it out and let us know if it works :)
 
Last edited by a moderator:

rpglover88

Rpg & Anime Maniac
Veteran
Joined
May 12, 2013
Messages
169
Reaction score
24
First Language
French
Primarily Uses
It doesnt work for me. I used the skill when the enemy had 69hp left. Result: 0 damage. I attacked the enemy again and her HP went down to 0, which means the immortal state wasnt removed. I used the skill again and still 0 damage. :(
 

Suushii

Veteran
Veteran
Joined
Jun 21, 2012
Messages
31
Reaction score
5
First Language
English
Primarily Uses
RMMV
It doesnt work for me. I used the skill when the enemy had 69hp left. Result: 0 damage. I attacked the enemy again and her HP went down to 0, which means the immortal state wasnt removed. I used the skill again and still 0 damage. :(
Whaaaat, it can't- oh wait...


if (b.hp <= b.mhp * 0.1) {b.removeState(3); value = b.mhp * 0.1;}


I'm an idiot and forgot the other semicolon at the end somehow, LOL.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,018
Messages
1,018,358
Members
137,803
Latest member
andrewcole
Top