Jump to content
fladdles

Damage Formulas RPGVXA

Recommended Posts

Posted (edited)

Hey, everyone! I am working on  skills that utilize as many of the actor attributes as possible and am working on a skill that uses the AGI stat in its damage calc.

Basically I wrote in this:

( a.agi *3 ) / 2 + a.atk * 2 - b.def * 2

and I'm mainly worried about syntax. As far as order of operations: I'm trying to get the a.agi tripled and then halved, add it to the doubled a.atk value, and then subtract the doubled b.def value.

And while I'm at it, couple more questions I haven't been able to find answers for:

1. Are there ways to incorporate variables into calculations?

2. Using just simple math functions ( +, -, *, /) and the standard attributes of mhp,mmp,atk,def,mat,mdf,agi,luk ... what really is the limit of complexity that I could probably get to without using scripts specifically for this? I plan to utilize LUK and AGI a lot in damage calculations, as well as variables that dynamically change as the game progresses.

3. What is the " Success % " used for? I would love a skill that has a low chance of failure, such as a skill like a Quick Attack that always attacks first but can sometimes fail. Would setting this box to something like 80-90% basically do that?

EDIT:        4. Just thought of a shorthand by just using decimal multiplication and division. Could I use a formula such as    a.atk * 1.5   as apposed to    ( a.atk * 3 ) / 2   ?

 

My game is already script heavy - I have 20 scripts running on it and its somehow stable. Years of modding Skyrim has taught me well, but yeah because of that I want to stay away from scripts if possible. Thanks in advance for the help if anyone reads this lol

Edited by fladdles

Share this post


Link to post
Share on other sites

Yes, variables can be used in damage formulas.
You really should instead of tripling then halving a stat, just do this: (stat * 1.5)
It literally does the same but with more stable results. I know; I've had the experience of having the damage formula return some really weird, unfavorable results in the past.

( a.agi *3 ) / 2 + a.atk * 2 - b.def * 2

Revision:
(a.agi*1.5+(a.atk*2))-b.def*2
Yeah; one can omit spaces but one must always utilize both sides of a decimal point (0.5 is the rule but .5 will have Ruby throw a fit).

Success % is used for skills that have a chance of executing, not in success in the executed task/s (unless the skill is set to 'always hit' rather than 'physical/magical').

Little tip:

Use this in a damage formula:
eval($data_X[id].note)
Where X is any database with an editable notebox like states, skills, items, weapons, armors, actors, classes, etcetera, and ID is the corresponding ID, for a nigh unlimited amount of space for your damage formula. That said, the notebox must contain absolutely nothing else in it. It cannot be used for anything else. I actually picked this up from digging through the non-archived files of one of my favorite RM games.

Share this post


Link to post
Share on other sites

If you worry about order of operations, remember to Please Excuse My Dear Aunt Sally!

But yeah ( a.agi *3 ) / 2 + a.atk * 2 - b.def * 2 should work, along with a.agi * 1.5 + a.atk * 2 - b.def * 2 if you want top go with that.

Also:

1. Use v[n] where n is the variable number for that.

2. As complex as you want. Technically formulas are scripting. :P As long as it's valid ruby code, it will work. This is why you can sometimes see random scripting stuff shoved into the formula box.

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted