fladdles 0 Posted October 3, 2021 (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 October 3, 2021 by fladdles Share this post Link to post Share on other sites
PhoenixSoul 1,417 Posted October 3, 2021 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
Kayzee 4,063 Posted October 4, 2021 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. 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. 1 Share this post Link to post Share on other sites