How to make the most of custom formulae. Part #1

Have you disabled variance? Also, please show a screenshot of your skill, the actor and the enemy. There have been cases where the calculations were off because the actor contained a feature ATK*10% for example, because the user didn't check the math (he believed the feature would have been ATK+10%, but such a feature is impossible in Ace
Variance is at 20, but when I disabled variance I still got no damage for both player and enemy turns.

Spoiler
Skill_zpsxvzxn8zj.png
Enemy_zpsx0glhpf1.png
Class_zpsg8v36hkj.png
Actor_zpsjxhrx0aa.png
Because you have not named that skill #127 we cannot be sure that your actor has actually learned it, as every skill line in the Class is blank.

How are you allocating a level to the enemy so that it can be included as a valid component of your formula?
If you have not defined enemy levels, b.level is going to garbage the formula when you attack, and it will always return 0 for damage. Same thing with a.level when the enemy attacks you.

I learned this the hard way when I accidentally typed a.agl for a.agi. The system still computed it, but since a.agl didn't exist, it just made the entire formula return 0 so as to avoid a crash.
That did it, could've sworn I read somewhere that if you used level in a damage formula that it would use 0 for enemies in that value only.  Thanks everyone for helping.
I've been trying to use these formulas and they work in a calculator but not in the editor,

First, there's this one that just returns null damage when it should be returning about 23-27:

((a.atk *2.00) + (a.agi + a.tp) / 20.00) - (((b.def * 2.00) + b.agi/5.00) * 0.45)

I figure i got something wrong with the syntax but I can't figure out what??

And then there's this second one:

((a.atk * 2.00) + ((a.agi x ((a.eva x 0.45) + 4.50) x a.cri x 0.45)/450.00) - ((b.def * 2.50)*0.45)

Which crashes because ex/sp-params can't be referenced by name in formulas I guess, but is there a way to get

around that by referencing their IDs or something?

If anyone knows whats up/could help with any of these that would be really cool!
Believe it or not the problem with your first one is a simple space: in the first bit it needs to be a.atk * 2.00, not a.atk *2.00. That should fix it.

In the second one, you absolutely can reference ex and s-params by name in formulas, but you seem to have some "multiply by" calculations there where you have the letter x instead of a *, which might be what's breaking it. It's also missing a bracket at the end.

Edit: FYI, you don't need the extra 0 after the decimal point to make your values floats: 2.0 is the same as 2.00.
Whoops I didn't even notice those, thanks a bunch!
Any time! Glad I could help.
I can't believe I am having such trouble with a really simple formula... but I can't make this work:

if b.luk==66; a.mdf; else; b.hp +=a.mdf; end;
This is a HP Damage formula that's supposed to restore HP to the enemy except if their luck equals 66 (just an arbitrary label). Why is this not working? I must be missing something really stupid.
Why not just return -a.mdf?

Also, how did you determine that it's not working? Because it doesn't show a healing message? It really won't, if that's what you're hoping for.
I know it doesn't work because it says the same thing when I try it on either kind of enemy... 

With -a.mdf, it seems to work even less... that returns a "X took no damage" sort of message. 
Ah yes, might be because it was set to HP damage so anything below zero is translated to zero...

Can you post a picture of the skill, the battle when you used the skill and the enemies?
So there's no way to make a formula that would show healing and damage at the same time? All right. I guess that answers my question!
Basically the default battle log will only show the "damage". You can make it show extra stuff though by telling it directly, I'm not sure if that will fit into the formula box though, in which case you'd want to put the formula into a custom script...

Something like

class Scene_Battle  attr_accessor :log_window  #Needed to access the battle log window outside of this classend module EXTRA  def self.formula_heal(a,    if b.luk == 66      return a.mdf    else      b.hp += a.mdf      Scene_Manager.scene.log_window.add_text(b.name + "was healed for " + a.mdf.to_s + " points!") return 0    end  endendthen on your damage formula just put

EXTRA.formula_heal(a,The battle log would still say about no damage though in case of the heal, you might want to get one of Yanfly's scripts which disables the no damage message in that case.
Hmmm,,, I tested what you gave me and it's still returning a "X took no damage" message on both. I've checked and rechecked that I was using the correct skill, that the enemy has luck=66, and so on. I've deleted the two other scripts I was using (this is a test copy, of course) and that didn't help either. I'm guessing I'm probably missing something really simple. Well, don't worry about it, it wasn't really a big thing anyway and I'm sure someone else will benefit from this code...
WOuld you guys be able to help me edit my damage formula?

I am creating a skill called "Feral Strike" and what I want this skill to do is that whenever an enemy's HP is below 15-25% (I haven't decided yet) the attack is an instant kill, otherwise it doesn't do anything. Does anybody have any ideas on what I can do?

if b.hp <= 20% b.mhp; a.atk == 9999; else a.atk == 0; end
Believe you have some syntax errors in your formula: What you basically have is if target's hp's is less than 20% then you are using a compare operator with your damage values meaning your not setting them so it will always do 0/null damage (== is for comparing) the last part you just need a 0 (or just the a.atk if you want to deal some damage) since you want it to return that.

So I think it should look more like this:

if b.hp <= b.mhp * 0.2; a.atk + 9999; else 0; endEdit: using will work too. (mind is little bit muddled cause of a headache :/)

if b.hp <= 0.2 * b.mhp; a.atk + 9999; else a.atk; endEdit2 also you could use

if b.hp < 0.2 * b.mhp; b.add_state(1); else a.atk; end(this puts the death state vs dealing damage at 20% or fewer hps)

Edit again....: The mod sign % won't work cause in this case as it divides then returns the remainder example: 20 % 100 returns 20

100 % 20 returns 0.
Also, note that you cannot actually set the .atk or ither params to another value by calling that method directly because .atk is actually a wrapper method for the param method which returns a calculated value not a saved one... 🙂
Thanks! As you can tell I am an amateur in coding still. If statements and switches were my strongest points, but I am out of practice. Lol

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-the-most-of-custom-formulae-part-1.1143/