RMMV Damage Formula - ideas and help

● ARCHIVED · READ-ONLY
Started by Shaz 1539 posts Page 70 of 77 View original ↗
  1. tsurugikage said:
    Thank you. I am trying it out right now and so far it is working splendidly ^v^
    Do note that 0 is one of the possible values of randomInt and the number you use for the argument isn't included, so if you wanted this to be 1-6 rather than 0-5 you'll have to add 1 to it.
  2. How do I make an attack that consumes all TP the character currently has, then deals more damage based on how much TP was consumed? Specifically, without using Common Events or Yanfly plugins.
  3. FirestormNeos said:
    How do I make an attack that consumes all TP the character currently has, then deals more damage based on how much TP was consumed? Specifically, without using Common Events or Yanfly plugins.
    There's no need for plugins here, but you may find this thread more useful:
    Damage Formulas 101
    You'd do:
    Code:
    var tpDam=a.tp; a.setTp(0); damage formula that incorporates the variable tpDam

    The only part of this that could be improved by use of a plugin is the fact that when selecting the skill, it will only show it costing the amount of TP that you define in the database (you should at minimum make that 1).

    Using Yanfly's Skill Core, you'd be able to make that display dynamically, so the player will see that the cost of the skill is equal to however much TP that actor currently has.
  4. ATT_Turan said:
    There's no need for plugins here, but you may find this thread more useful:
    Damage Formulas 101
    You'd do:
    Code:
    var tpDam=a.tp; a.setTp(0); damage formula that incorporates the variable tpDam

    The only part of this that could be improved by use of a plugin is the fact that when selecting the skill, it will only show it costing the amount of TP that you define in the database (you should at minimum make that 1).
    tysfm! works perfectly!
  5. Hey guys I'm new to this whole RPG Maker scene. I've spent a good chunk of time on it this week but, it really is a lot to learn. Can someone help me create a damage formula that will do around 13-14k damage at level 99? Just basic attacks. From there I can edit how I want my skills and spells. I do have Yanfly's plugin to change around the parameters. I'm just not the greatest with formulas in general. Any help is appreciated. Cheers!
  6. HM_Misfit said:
    Can someone help me create a damage formula that will do around 13-14k damage at level 99?
    The answer to that question is no :stickytongue:

    Based on your post, we have no idea what the rest of your game is like. Level doesn't have anything to do with it, unless you make it.

    If you just want to do 14k damage at level 99 you divide 14,000 / 99 and make your damage formula a.level*141 :smile:

    But are you actually using the other parameters? How high do they go? Do you want defense to decrease the damage dealt? How high does that go? No one can tell you all of this for your game.

    To just approach this, you're talking super basic math.

    If you have 100 ATK at level 99, and you want to do 14k damage, then divide 14,000 / 100 and your damage formula is a.atk*140 right?

    If you have 9,999 ATK and you want to do 14k damage, then divide 14,000 / 9,999 and your damage formula is a.atk*1.4

    If you read other posts in this thread, the things that can make damage formulae complex are things like what's the least damage you should do, and how does it scale against different values of defense and across your levels and stuff like that. Just saying "I want to do this much damage at this point" is very simple math.

    You should take some of the other formulae posted here (or even better, in here) and see how much damage they do in your game with your numbers. If you want it to do more, modify the formula with higher values.
  7. ATT_Turan said:
    To just approach this, you're talking super basic math.

    If you have 100 ATK at level 99, and you want to do 14k damage, then divide 14,000 / 100 and your damage formula is a.atk*140 right?

    If you have 9,999 ATK and you want to do 14k damage, then divide 14,000 / 9,999 and your damage formula is a.atk*1.4
    Hey this helped a ton. I didn't know it was so simple. I must have just been over thinking things when trying to create a formula.
  8. So I want to make a skill that if the enemies level is < the caster's level, it instantly KO's them. What would be the best way to do that in the damage formula box?
  9. @bgillisp
    I assume you are using a "enemy levels" plugin?
    Asking because enemies don't have a level parameter by default.

    Depending on how the plugin works, it would most likely be something like

    b.level < a.level ? b.mhp : 0

    Then again, if the plugin does not add the level parameter, you have to replace b.level with whatever is determining how high the enemies' level is, which could be a variable if you are going for no plugins.
  10. In MZ level is part of the default engine parameters and works there, so I assume its in just fine. Though I guess I did just post in MV derp. Still the idea there is what I needed, thanks.
  11. @bgillisp
    Fair enough, I just assumed this was for MV since this thread was originally aimed at MV, hence the name. Though I guess it mostly works for MZ just fine aswell.

    Except on this specific occasion, where there is a difference in how enemy levels are handled.
  12. Its ok. I was stuck on the or snytax and evaluation which seems to be the same in MZ as MV.
  13. Im trying to add the equipped weapon ATK parameter to my damage formula but I'm having trouble setting up the call. Something to this effect:

    $game.Actors.actor.equips()[0]params[2] + (1.75*a.atk)-def

    This doesn't seem to be working though. Any help would be much appreciated.
    Im using MZ
  14. Oggy said:
    $game.Actors.actor.equips()[0]params[2] + (1.75*a.atk)-def
    You're missing a "." in there. It should be $game.Actors.actor.equips()[0].params[2]
  15. Frostorm said:
    You're missing a "." in there. It should be $game.Actors.actor.equips()[0].params[2]
    ah. Thanks!
  16. What a perfect thread, I was about to make a new thread just for this question heh.
    In my game I'm implemented a very basic wounds system and need Bandages to stop Bleeding and a Stint to mend Broken Bones. Only issue is I can apply both items whenever I want - I need them to only be able to apply if certain a state is active on an actor. And I can't figure it out, but I've seen it done before with If/Else statements in an item's formula box regarding Vampire Potions and a If/Else that checks if a Vampire state is applied to the actor so I imagine this is exactly the same.

    For bandages, I need the item to check if the Bleeding state is applied and then remove it. If Bleeding is not applied, cancel the item (bandage) usage somehow (Either by consuming the item and giving it back or otherwise).

    Splints are a bit more complex. I need a Splint to check if Broken Bones is applied and remove the Broken Bones state but THEN add a new state called Splinted. Likewise, if Broken Bones is not applied, do nothing and keep the Splint (whether thats by a consume/replace or not).

    If anyone could figure this out with the fancy programming language of the formula box I'd be overjoyed
  17. fladdles said:
    Only issue is I can apply both items whenever I want - I need them to only be able to apply if certain a state is active on an actor.
    You can't do that within the Damage Formula. The Formula takes place after the item/skill has started to perform its action, which is way after the target selection.

    The other thing for you to keep in mind (perhaps you don't understand in the first place) is that the damage formula is always used when you're damaging/healing the target in some way; it requires that a number get produced, and it will show that number. So even if it's 0, doing things like this is going to end up with the player using your item in the game and that 0 damage or healing popup displaying on the screen, which I would consider aesthetically undesirable.

    For Bandages, what you describe should actually be the default way the engine works - if you have an item and the only thing on it is a Trait that removes your Bleeding state (no unnecessary Damage Formula at all), the game should not allow you to expend that item on a target who doesn't have the state to be removed.

    If you have both that Trait and one that restores HP, then you'll be allowed to use the item if either trait would result in a change to the target actor. So the easiest way to implement what you want is to make a simple item, one trait to remove the state, and that's already how the engine works.
    fladdles said:
    Splints are a bit more complex. I need a Splint to check if Broken Bones is applied and remove the Broken Bones state but THEN add a new state called Splinted. Likewise, if Broken Bones is not applied, do nothing and keep the Splint (whether thats by a consume/replace or not).
    This could be done in the damage formula - the trick is, it'll "break" your item. That is, as I described above, you can't stop the player from using the item on an actor who doesn't have Broken Bones. You can use code to restore the item after, so it nets out, but it will behave differently from all of the rest of your items that sit there and give an error sound on an invalid target.

    If you don't care about any of that, then you can do:
    Code:
    if (b.isStateAffected(brokenBones)) {b.removeState(brokenBones); b.addState(splinted)} else $gameParty.gainItem(itemId, 1); 0
    where brokenBones, splinted, and itemId are replaced by the appropriate database IDs (no leading 0s).

    You may find this a more useful thread that has instructions on how to do exotic things in your damage formulae:
    Damage Formulas 101
  18. The whole point of the Stint was to remove Broken Bones but then apply a 'Limping'-like state for 100 steps as the mended bones healed on their own while splinted. This was to avoid an 'instant' heal of broken bones, but it looks like I could just default back to that lol

    Thanks man, you explained it super well! Now, got me thinking: is there a way to store which actor an item was used on in a variable? I could use common events to apply states to actors that were 'Stinted'.
  19. fladdles said:
    Now, got me thinking: is there a way to store which actor an item was used on in a variable? I could use common events to apply states to actors that were 'Stinted'.
    Actually, there's a thing you could try which didn't occur to me in my original post. It might not work, but it's free to try.

    Grab Yanfly's Skill Core plugin and put in the notes of your Splint:
    Code:
    <After Eval>
    target.addState(splinted);
    </After Eval>

    I haven't tested whether those notetags work when you're using the item from the menu.
  20. Sorry if this has been covered somewhere before in this thread (I did a search for "rounding" and couldn't find anything relevant) - I'm trying to make a game that generally deals with quite low damage numbers, where the player's health remains at 100 throughout and the defence gained with equipment is crucial to surviving against tougher foes.

    For this I've used the following for basic attacks to keep it as simple as possible: "a.atk * 1 - b.def * 1"

    The problem I've run into is I wanted to have an attack deal 1.5x the enemies attack stat, so I assumed: "a.atk * 1.5 - def * 1" would work for this, but it just seems to round-up to 2 so the enemy deals double-damage.

    I could work around this by just using smaller attack stats and multiplying them by larger numbers, but I'm wondering (as I have very little knowledge of formulas) if there's a different way to write this, to make the game round to 1 decimal place instead of an integer?