设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
返回列表
+ 发新帖
查看: 247|回复: 0

[交流讨论] A Guide to Damage Formulas

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-9-28 23:21
  • 签到天数: 212 天

    连续签到: 1 天

    [LV.7]常住居民III

    9089

    主题

    871

    回帖

    7万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    64572
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    74562

    灌水之王

    发表于 2026-7-12 17:34:58 | 显示全部楼层 |阅读模式
    Additional tutorial credits: @TheoAllen, for converting MV/Z formulas to Ace. The parallels are now included in the intro post.

    If you're uncomfortable going much further than a.atk * 4 - b.def * 2 for your damage formulas, this is the guide for you. Damage formulas are extremely powerful tools that can let you create complex abilities. They are fairly similar to actual scripts in syntax (which is why they can be intimidating).

    I placed this tutorial in Non-Maker Specific because it has worked with MV and VX Ace.

    Basic Setup
    [MV]



    [VX Ace]




    • Type. There are six different damage types: HP damage, MP damage, HP recover, MP recover, HP drain, and MP drain. They each should be fairly self-explanatory. Drain restores health to the user equal to damage dealt (not half as in some games).
    • Element. Element allows you to select the damage element. Normal Attack is best for most physical moves (e.g., a skill like Wild Blow). Elements are important to set for most games because they can let you add in elemental weakness and effectiveness.
    • Variance. Variance is a percentage that lets you set how much the damage will vary from what the formula says. If the formula computes to 50, and if variance is 20%, it can do 80-120% of 50 damage, so 40-60 damage. I recommend setting it to 10%.
    • Critical. Critical allows you to select if the attack can have a critical. Most spells do not have this enabled, in most games. But do what you like!
    Basic Formulas and Parameters​

    Onto the meat of the tutorial!

    Before we begin, note the importance of capitalization. Everything must be capitalized as directed in this thread. Do not randomly capitalize or un-capitalize as you desire. If you do, the formulas will not work.

    Let's break down the standard attack formula:
                    Code:        

    • "a" symbolizes the user, and "b" symbolizes the targets.
    • Think of the period as an apostrophe + s: 's.
    • In other words, "The damage dealt is a's attack multiplied by 4, minus b's defense multiplied by 2." Pretty simple.

      • Say the user's attack is 20, and the enemy's defense is 15. In that case the damage dealt is 20*4-15*2=80-30=50. With a variance of 20, the actual damage will be between 40-60 damage.

    It would now be instructive to look at a standard spell: perhaps Water.
                    Code:        

    • is "magic attack", andis "magic defense".
    • We can interpret the formula this way, "The damage dealt is 300 plus the user's magic attack multiplied by 2, minus the target's magic defense multiplied by 2."

      • Say the user's MAT is 20, and the enemy's MDF is 15. In that case the damage dealt is 300+(20*2-15*2)=300+(40-30)=300+10=310. With a variance of 20, the actual damage will be between 248-372 damage.

    Aura Blade is up next. This skill is slightly more complex:
                    Code:        

    • The skill description tells us, "Damage is based off user's ATK and MAT."
    • Translating into English, "The damage dealt equals the user's physical attack multiplied by 4 plus the user's magic attack multiplied by 3, minus the target's physical defense and magic defense."

      • Say the user's ATK is 25, MAT is 20, and the enemy's DEF is 30, MDF is 15. In that case the damage dealt is (25*4)+(20*3)-(30)-(15)=100+60-30-15=115. With a variance of 20, the actual damage will be between 92-138 damage. That's not very much - this skill is not necessarily good on all enemies.

    "Okay, but what are all the parameters for a and b, besides atk, def, mat, and mdf?" Turns out that there are quite a lot of them. You will see that some have an ID number listed. This is important for using buffs in a formula, which I will get to towards the end.



    • - current level, for actor only
    • - current HP, NOT max HP
    • - current MP, NOT max MP
    • - current TP



    All of the following are decimal numbers. 1.0 converts to 100%. 0.5 converts to 50%. Etc. These values are generally not useful in damage formulas, but are certainly available if you want to get more creative.

    Exercises​

    Of course, you don't "have" to do these exercises. However, I find that a good way to learn things like this is to actually try and make your own. If you're up to it, why not try creating...

    • ...a defense-ignoring attack?​

    • ...a healing spell dependent on the user's magic attack?​

    • ...a resurrection spell that restores half the target's health? How about 5% of it? Or exactly 1 point?​

    • ...a sword attack that drains life based on the user's attack and magic attack?​

    • ...a simple damage dealing spell (e.g., Fireball)?​

    • ...an attack based on the user's attack and defense? How about attack and agility?​

    Spoiler: Solutions


    • OROR, etc.
    • Under Effects, a separate section from the formula, have the effect Remove State [Death] 100%. As for the formula: HP recover, withfor 50%,for 5%, and justfor 1 health point.

      • See the end of the States section below for a different solution that utilizes only formulas and no effects.

    • Set damage type to HP drain. Formula might look like
    • Something like
    • and
    None of those exercises included any of the decimal parameters. You generally will not need them.

    Everything included in the default VX Ace skill list has been covered by everything before this point, and more besides. So at this point we are finished with the basics and can proceed to the more complex formula functions!


    Frog Drop: Using Level, Variables, and "If-Else"​

    In Final Fantasy 9, a minigame exists whereby the player catches frogs. A character has a skill, called "Frog Drop", that increases in power directly dependent on the number of frogs caught and the level of the character, as follows:
                    Code:        
    (It is supposed to drop all frogs ever caught onto the target.) This is quite easy to replicate in RM and is instructive for the tutorial, as it will let us examine variables and "if-else". We already learned how to get the character's level:
                    Code:        
    In RM, the best way to replicate the frogs caught is via a variable. Variables can actually be used in damage formulas, to great effect! Say Variable 1 is "Frogs caught". Then the damage formula would be:
                    Code:        
    Quite simple, really. Now, in FF9, if no frogs are caught, the skill deals 1 damage. But as our formula stands, it would deal 0 damage (if v[1] is 0, then we multiply by 0 and get 0). How can we correct this? With an "if-else" statement, we can check to see if frogs have been caught. If not, 1 damage is dealt. Behold the following:
                    Code:        
    What does that mean? The syntax is as follows:
                    Code:        
    Formula1 is used if statement is true. Formula2 is used otherwise. So what we are doing is saying, "Is Variable 1 greater than (>) 0? If so, then we're using the ordinary frog drop formula. Otherwise, Variable 1 must be 0. If it's 0, we'll just do 1 damage."

    States and Multiple Lines​

    By far one of the most powerful and cool things you can do with damage formulas is state checks. Say you have a state, Poison. Maybe an attack deals extra damage if the target is poisoned. In Pokemon, the skill Venoshock does exactly this:
    The user drenches the target in a special poisonous liquid. Its power is doubled if the target is poisoned.
    Click to expand...

    We can replicate this in RPG Maker through an if-else statement, using the ternary operator, ?.
    MV/Z:
                    Code:        
    VX Ace:
                    Code:        


    • This formula assumes that Poison is state 2. Change 2 accordingly if necessary.
    • First, we just check to see if the target is poisoned (

      • If the target is poisoned, it deals the normal damage formula, but doubled ().
      • Otherwise, it just does the normal formula ().

    Here are the rest of the state formulas. Make sure to place either a. or b. before each one.

    • MV/Z: - is the target dead? Returns a boolean (true or false)​


    • MV/Z: - refreshes how long a state will last for the battler. Does not return a value​


      • If trying to replicate Venoshock, you could add this line so that the target not only takes extra damage, the poison is also renewed on them.​

      • VX Ace: ​


    • MV/Z: - shortens all states on battler by 1 turn. Does not return a value​


    • MV/Z: - adds state. Does not return a value​


    • MV/Z: - can state be added? Returns a boolean​


    • MV/Z: - remove state. Does not return a value​


    • - checks how many states are on the battler. Returns an integer.​


      • would deal 500 damage for each state on the target.​


    Semicolons are used to separate multiple lines of formula code. Let's revisit our Resurrection spell.
                    Code:        
    We can change this as follows:
    MV/Z:
                    Code:        
    VX Ace:
                    Code:        
    Voila! The target's death state is removed and they are healed to 50% HP. Here, we can remove the death heal effect from the Effects section. This will let us combine everything in the damage formula, which I would argue is better.


    Two Important Notes on Extra Lines​

    If you have multiple lines of formula, only the last line will actually do damage! So if you have the following:
                    Code:        
    Only thewill be computed as damage. So make sure that any prior lines you have are not damage dealing (in the example with the death state removal, that's fine, since no damage is dealt or healed).


    In addition, if you want to write something that does not deal damage in a formula, you must also write another line with a 0 in it. What I mean is, you cannot simply write something likeand be done. You must also include a 0, like so:.

    Other Things​


    • HP and MP can be directly controlled with the following formulas, replacing x with the appropriate number or formula:

    • To obtain a random number, you can use three different functions:​


      • MV/Z: - returns a random number between 0 and 1​


      • MV/Z: - returns a random number between min and max​

      • MV/Z: - returns a random number between min and max​


    • There may come a time when you want a skill to have different effects depending on whether the user/target is an actor or an enemy. In these cases you can useand(with an a. or b. before each). They return booleans (true-false) and can be used in if-else statements.

    • Buffs and debuffs can be controlled via formulas. Each stat has a specific parameter ID. I listed those earlier in this guide. Be sure to include a damage line at the end if you use these, even if it is just a 0!

    • You can also use the functionto make a skill force the target to use an item. A skill might force the target to consume a potion, for example. Be sure to include a damage line.

    Conclusion​

    That's all the basics you need to know. For help with specific skills, feel free to ask in this thread. I'll respond when I have time, and other helpful community members probably can too
    . Also, if you see any errors in the the post, please call me out on them so I can correct them.



    本贴来自国际rpgmaker官方论坛作者:lakeisgay处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/a-guide-to-damage-formulas.145148/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-10-6 17:52 , Processed in 0.147055 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表