Damage Subformulas

This script allows you to specify custom damage formulas depending on who the attacker and target are. The default formula allows you to specify A and B, but it doesn’t take into consideration whether they are actors or enemies.

This script provides 4 sub-formulas that will be used depending on who is A and B.
There are four cases to consider

  • A is actor, B is enemy
  • A is actor, B is actor
  • A is enemy, B is actor
  • A is enemy, B is enemy


Script: download here


Place this script below Materials and above Main


The general format of the note-tag to use is

<damage formula: TYPE>
</damage formula>

Where TYPE is one of

AA – actor to actor
AE – actor to enemy
EA – enemy to actor
EA – enemy to enemy

And the FORMULA is your usual damage formula.

If a sub-formula is not specified, then it is assumed to be the main formula
that is defined in the damage box built into the database editor.

You may also like...

23 Responses

  1. PainfullTears says:

    Hi there.

    My weapons formula is:


    but i get the error:
    Script ‘Damage Subformulas’ line 156: ArgumentError occured.
    comparison of Fixnum with nil failed.





    but still giving me that error.

  2. Black Dragon says:

    Sorry to bother you Tsuki,i cannot use this damage formula:
    <damage formula: AE>
    </damage formula>
    In normal circumstances it works without your script (using the default skill formulas box)
    Your script gave me an error in the line 311:
    Comparision of fixnum with nil failed.

    • Hime says:

      Your formula must return a number, even if it does zero damage. It works by default because the default scripts hide errors from you.

      • Black Dragon says:

        Good afternoon Tsuki! 🙂
        That is strange… I can see 363 lines in the maker editor (including instructions)
        Anyway here is the line:
        [Kernel.eval(self.subformula(a, b)), 0].max * sign

        • Hime says:

          Your formula does not return a number. If you don't want it to do any damage you still need to say

          YOUR_FORMULA ; 0
          • Black Dragon says:

            Arigato gosaimasta princess Hime! That worked like a charm,i did a spell that adds petrify state to actors and death state to enemies (FF4 has that feature) Excuse me for being so dumb at scripting and greetings from Argentina.

  3. Crazy Rob says:

    Getting this error:

    Script 'Damage Formulas' line 189: Argument Error Occurred

    wrong number of arguments (1 for 0)

    Did I done goofed?

  4. rubydragon44 says:

    Now when I use something that doesn't have a damage formula notetag, it gives me a 0 for 1 arguement error on line 126,

    def ae_subformula
    return @ae_subformula unless @ae_subformula.nil?
    return @ae_subformula

    • Hime says:

      It's strange that it never happened before. Seems like something extra got added somehow. Should be addressed now.

  5. rubydragon44 says:

    I did whatever wrong, but it works now. Perhaps I wanted one skill that works the same way regardless who's using it, but I still wanted the ability to bypass the 100 character limit with that move.
    I wasn't sure how to edit the script on my own to do so (although I'm sure it's way easy lol I need to learn code)
    like I was going to have a formula called NA or whatever where it's just anything goes, so that if a skill doesn't have different effects depending on the target and user, I wouldn't have to copy and edit the formula 4 times for one skill.

  6. rubydragon44 says:

    May I have an example of the correct way to use this?

    On a fresh project I tried
    (bracket)damage formula: AE(bracket)
    (bracket)/damage formula(bracket)


    (bracket)damage formula: AE(without the bracket here)
    FORMULA + 40
    (bracket)/damage formula(bracket)


    (bracket)damage formula: AE(without the bracket here)
    (bracket)/damage formula(bracket)

    and whatnot but the damage was never 40 nor did include 40. It was the just 27 like I specified in the skill's damage box.
    I was trying to see if I could get this script for use as a way to bypass the 100 character limit, and also for the use it has.

    • Hime says:

      You can type <notes> properly in comments now.

      If you write

      &lt;damage formula: AE&gt;
      &lt;/damage formula&gt;

      You should get 40 damage when an actor attacks the enemy.

      FORMULA doesn't mean anything.

Leave a Reply

Your email address will not be published. Required fields are marked *