Custom Weapon Formulas

Oh god, yes.

Pain is good.

Somebody (Nessiah maybe) mentioned somewhere how they would have liked to enter their own formula for weapons, rather than relying on assigning different skills to the basic attack (workaround made possible by Yanfly). Anyways, this bit of information remained in my mind so I decided to do it. Any weapon with a custom formula will use it over the attack skill’s one.

Download!

Instructions
There are three different sort of tags you can use in the weapon’s notebox. First, you need to enter the formula itself. The syntax is absolutely identical to the skill’s formula field.
<formula>
Enter your formula here, which will be evaluated as is.
</formula>

By default, the variance is 20. If you don’t like it, then specify your own.
<formula_variance: x>
And lastly, you can make your weapon heal your target, like in the example above with this tag:
<formula_recovery>

That’s all.

Advertisements

About Kread-EX

I code. And try to make games.

Posted on 13/12/2011, in RGSS3, RPG Maker VX Ace and tagged , . Bookmark the permalink. 48 Comments.

  1. Loving that screenshot.

  2. Now this is something I can use for those magic users who can’t lift anything heavier than a book.

    • Why, if I may ask? 🙂 Just for my inspiration.

      • I believe Rukaroa means he wants to emulate the Atelier series system, where the alchemists and wizards’ weapons do magic damage, therefore are useful despite the low physical power of their owner.

      • Ah, I see. Hm. Sounds interesting. But why should those classes then have physical strength anyway? Maybe you should staffs and wands have deal magical damage only when the HP are full. Like when Link shoots beams out of his sword at full HP. 🙂

  3. infamous bon bon

    I was using someone else’s work around, but it was based on weapon type and used lots of skill slots. This does the same thing, but is way more weapon specific and easier in my opinion. This is my drawn out way of saying this is cool.

  4. Hnnghh Kread thank you for this ❤

  5. Bit late, but if you replace [1] at line 156 with [user.attack_skill_id], this script becomes compatible with Yanfly’s and you can really get some control over your weapon mechanics. Per skill with custom damage formulas? Yes please.

  6. Is it possible to use variables for the weapons attack?

  7. Okay, this is not so handy:
    I entered a custom formula for spears, based on the FFXII one like this:

    (a.atk * 5 – b.def * 3.5)*(a.atk * a.lvl * a.atk / 256)

    I used the little fix hyomoto posted to make it compatible with Yanfly’s battle system. Then, when I enter battle and attack some slimes, I get either NULL or MISS. Is there anything wrong, like using brackets?

  8. PainfullTears

    Hi. Got a problem with this custom formula:

    c=1+rand(20);d=1+rand(8);e=1+rand(8);f=1+rand(8);g=1+rand(8);if c==20;b.hp – (e+f+g);elsif c<=19;b.hp – d;elsif c<=2;a.hp – d;end;

    what it should do in order is:

    1. Random 1 to 20 for calculating the hit chance as in D&D rules.
    2. Calculate d,e,f and g to be random 1 to 8.
    3. When hit chance is 20 enemy should get combined value of e,f and g as damage.
    4. When hit chance is not 20, but 19 or lower enemy should get value of d as damage.
    5. When hit chance is 2 or lower user is hurt by value of d.

    Those are the Notes on a Dagger.

    Problem:

    It seems as if 2 and lower are “diced” nearly all the time. The first two to three hits might be done as it should, but then nearly all attacks go missing or dealing no damage.

    Enemy Stats are:

    6 HP, 2 Atk, 2 Def, 1 Mat, 1 Mdf, 2 Agi, 2 Luk. But those shouldn’t interfere, or am i wrong on that?

    Greetings PainfullTears.

    • The script didn’t support multiple lines. It does now. Also there’s a problem with your formula, for some reason, you’re using the ‘–’ symbol instead of ‘-‘ (minus). So it can’t work.

      They look the same in WordPress but they aren’t.

      • PainfullTears

        First of all: Thanks for your reply.

        Well i switched them with minus,..but to no avail. Before someone asks i got the new version of 1.01 of the script.

        Maybe it can be realized through common event, but is it possible to let the weapon call a common event through its formula?

        If that is possible, i quite can’t figure out how to call a common event….

        Greetings PainfullTears.

        • It works when I test 😮
          What is the problem, exactly?

        • PainfullTears

          Forgot to add that

          c<=2;a.hp – d

          does nothing … even a.hp – rand(8)+1 does nothing,…or better said…gets ignored.

          • What you’ve just written here doesn’t contain a minus sign… again. It seems every problem you have is related to subtraction. For some reason your minus signs are getting transformed into something else.

            Dunno if that’s your keyboard or your system settings but the problem is on your end.

          • PainfullTears

            Hm… between the actual, but rare hits are many “xy got no damage” or misses,…

            My guess is, that the standard game /battle mechanics are in place at the same time,…but shouldn’t a lvl 99 char with 400 Agi hit nearly all the time against said monster with 2 Agi?

            I wanted to try to merge both mechanics. D&D rules and vx ace standard battle…

            Maybe i am unable to accept the rather high miss or no damage ratio considering i thought i would dictate it with the formula.

            • but shouldn’t a lvl 99 char with 400 Agi hit nearly all the time against said monster with 2 Agi?

              Not necessarily. Your hit rate and the enemy evasion rate are more important and unrelated to agi.

            • PainfullTears

              Hm.. seems to get converted as soon as i post the comment…

            • PainfullTears

              Ok that seems to be the case,…hm.. well then i’ll just ignore the issue with the hit rate.

              Thank you for your help.

              About the formula. i copied yours, and you said it works so i believe that, and use it as it is.

            • Mine? I didn’t provide any formula, I just copied yours and fixed the minus signs.

            • PainfullTears

              Thats enough for me to be grateful 🙂

  9. PainfullTears

    Maybe i’m still doing something wrong, but shouldn’t

    a.hp – rand(8)+1

    damage the user? The formula is entered in notepad and copied,..hopefully system or whatever doesn’t chage the minus – to – …..

    • PainfullTears

      get’s changed no idea why

    • Nope. This will damage the target, for an amount equal to the user’s hp minus a random number between 1 and 8. If you want to damage the user, you need to use a.hp -= 1 + rand(8) instead.

  10. 8-bit Adventures

    I just stumbled across this script, and wanted to say thanks! I have a question though – is it possible to reference the custom damage formula in a weapon’s note for a skill’s damage formula? I’m trying to make weapon skills that deal damage based on the weapon’s damage. Thanks again for writing this script!

  11. Same as 8-bit adventures im having a problem as well, I love your script, but I have run into some major problems. I want to make it so my weapon damage/armors etc are based off the actors base stats (actually i use a stat distribution system, my actors start out with 1 of everything and don’t gain any extra stats on leveling up except what you a distribute to them). How I would like it to work is the damage and total armor rating is a % out of 99 (or anything I want to change it to, but for my games sake its 1-99 anything above would be bonus %) , + a base value. So for example if i had a weapon with 100 atk and the actor had 50 atk the weapon bonus would be
    ~50, then it would be added to the original atk then the base would be added so it would be ~100 atk + the base damage of the current weapon, so the same weapon equipped with an actor with 99 atk would be 199 total (100 from weapon + 99) then the base. This allows my stats to have much greater impact and allow for added damage when leveled up in a ratio compared to the weapons atk. Same goes for armors etc. Using your custom formula for the weapons works for regular attacks, however it does not work with any of the skills, so in order to use the skills I have to manually code in all skills and weapons into a script which makes it very tedious and time consuming, and then i have to make all separate skills for actors and monsters because monsters don’t use the same mechanics. I was wondering if you could make some kind of extension or a whole new script or point me in the direction of one since i haven’t found one yet, basically what I would like is: a custom formula script that is coded in the script and setup by the user because nothing really changes from weapon to weapon accept for the base damage and then the normal stat bonus, that can take the actors base stats into account like I stated before (but for any stat I want, because I do def/mag, etc all the same way) and have that damage with the critical option like in your current script, but then somehow passed to the skills as the actor atk or something like that, so say i have a skill that hits x2 damage, it would take the original damage from the formula in some variable to be worked with, so maybe I could type in a.atk x 2 in the skill box but it would take the damage and put in a.atk from when the actor attacks. I would love to learn/code this myself but im not any good, I was just wondering if it was possible if it could be done by somebody. Thanks for reading I know its complicated and a lot. If you want me to elaborate further I can.

  12. I want to make it so my weapon damage/armors etc are based off the actors base stats. How I would like it to work is the damage and total armor rating is a % out of 99 (or anything I want to change it to, but for my games sake its 1-99 anything above would be bonus %) , + a base damage value from the weapon itself. So for example if i had a weapon with 100 atk and the actor had 50 atk the total bonus would be:

    ~100 atk + the base damage of the current weapon, so the same weapon equipped with an
    actor with 99 atk would be 199 total (100 from weapon + 99) then the base. The base damage can be note tagged in.

    The same goes for armors etc.

    Using your custom formula for the weapons works for regular attacks, however it does not work with any of the skills, so in order to use the skills I have to manually code in all skills and weapons into a script which makes it very tedious and time consuming, and then i have to make all separate skills for actors and monsters because monsters don’t use the same mechanics. I was wondering if you could make some kind of extension or a whole new script or point me in the direction of one since i haven’t found one yet, basically what I would like is:

    A custom formula script that is coded in the scrip and setup by the user because nothing really changes from weapon to weapon accept for the base damage and then the normal stat bonus, that can take the actors base stats into account like I stated before, but for any stat I want, because I do def/mag, etc all the same way, and have that damage with the critical option like in your current script, but then somehow passed to the skills as the actor atk or something like that. So say I have a skill that hits x2 damage, it would take the original damage from the formula in some variable to be worked with, so maybe I could type in a.atk x 2 in the skill box but it would take the damage and put in a.atk from when the actor attacks. I was just wondering if it was possible if it could be done by somebody. Thanks for reading I know its complicated and a lot. If you want me to elaborate further I can. Oh and also this would need to include magic damage formulas as well and i suppose custom damage formulas for monsters because they can’t use the actor ones.

  13. Don’t worry about it thanks for no help.

    • AnoobISAfaggot

      @Anoob your a fucking faggot, shut the fuck up becasue no one has to help you. You are obviously too young/ stupid to be even making a game with a premade engine, get back to your socials homework bro

  14. @anoob(dbag) lol you are a d bag…. and should go back to school to learn some proper grammer cuz you talk like a retard.

  15. Is there a way to make the weapon’s damage usable in skills rather than have them be based on the character’s attack. I am not planning on having weapons increase Strength which is why I ask.

  16. Drackonarius

    Hello, I hope you can help me with my problem. I’m using this script along with the Materia System from Victor and when I try to attack with a weapon that uses a custom damage formula I get an error coming from the materia system, is it because both scripts use notes in the weapons? The formula I’m using is just a.atk. This is because I want to make a weapon that pierces defense. I tried to delete the materia slots for that weapon but I still get an error code from line 1023, it says “NoMethodError ocurred. Undefined method ‘actor?’ for nil:NilClass.
    What should I do to make both scripts work with no problem? Thanks and hope someone can help me.

  17. Excuse me, I know this is really old, hopefully you still at least get messages.

    Is there a way to add MP cost to this script? I have weapons that require energy use and if I’m using the formula for damage instead of a skill window for the weapons normal attack, I must find a way to make the attack use up some mp.

  18. I’m working with this script, and coming across a small problem – my heal spells now don’t work. Is there a work-around so that a skill can be flagged to not use the weapon attack formula and just the formula on the skill itself?

  19. Rose of Winter

    Heya, I know this thread has been quiet for a year and a half (roughly), but I recently stumbled across it and am having issues. I’m trying to make a game that uses D&D style combat in terms of the numbers (so I can avoid dealing with thousands of health), but I’m dealing about 4 times the damage I should. Currently, in order to keep it exactly like D&D, my notes section looks like this:

    if a.atk % 2 == 0; rand(8) + ((a.atk-10)/2); else; rand(8) + ((a.atk-11)/2); end;

    I’m not even sure if the modular command works in RGSS, but the formula is to deal 1d8 + Strength modifier exactly as 3.5 D&D or Pathfinder.
    Am I doing something wrong with this, is there something I should fix? Any help would be amazing~!

  20. jamie ellis

    I am wondering if i need another script to get this to work? i am using it but it is not working. nothing happens. it keeps using the default attack. this is how i have the weapon notetag:
    20 + a.atk * 1.6 – b.def * 0.8

    Thank you for your time.

    • jamie ellis

      sorry this is my weapon notetag
      formula>20 + a.atk * 1.6 – b.def * 0.8</formula
      formula_variance: 50
      formula_recovery

  1. Pingback: Taking a break « Yami World

  2. Pingback: YEA – Enemy HP Bars « Yanfly Channel

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: