RMMV Damage Formula - ideas and help

● ARCHIVED · READ-ONLY
Started by Shaz 1539 posts Page 22 of 77 View original ↗
  1. 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).
  2. xXIzzyXx said:
    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.

    Rukomura said:
    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
  3. Riff said:
    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!
  4. 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
  5. emelian65 said:
    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
  6. Riff said:
    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
  7. emelian65 said:
    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 :)
  8. 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;
  9. Korokage said:
    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.
  10. @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~
  11. 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?
  12. rpglover88 said:
    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
  13. 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. :(
  14. rpglover88 said:
    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%?
  15. Yes. The enemys max hp is 6000 and when i used the skill the enemy had 20 hp left.
  16. rpglover88 said:
    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
  17. It still doesnt work... T.T
  18. rpglover88 said:
    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 :)
  19. 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. :(
  20. rpglover88 said:
    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.