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

Try:



Code:
if rand(100)<85;b.add_debuff(0, 5);end;10+4*a.atk-2*b.def
The 0 is for the stat

0 - Max HP

1- Max MP

2 - ATK

and so on

The 5 is for number of turns.
Yay! Works like a charm. Now is there a way to make it do 2 different debuffs or would this be limited to just doing one?
Hmm:



Code:
if rand(100)<85;b.add_debuff(0, 5);b.add_debuff(1, 5);end;10+4*a.atk-2*b.def
Might run out of room.

I'll try and finish my tutorial on bypassing the length and using more scripting features soon.
Didn't run out of room! Thanks a bunch, I totally appreciate it. :lol:
Try:



Code:
if rand(100)<85;b.add_debuff(0, 5);end;10+4*a.atk-2*b.def
The 0 is for the stat

0 - Max HP

1- Max MP

2 - ATK

and so on

The 5 is for number of turns.
*Bow* *Scrape* *Repeat*

I, too, make a note of this for later reference. Every little bit of code I can analyze helps. 😀
Oh, I stand corrected. I'm used to using states as my debuffs instead of the actual Ace debuff options that's why I thought you could set percents. That is an option though, use states for your debuffs.
I'm thinking of using a script that allows formulas for each individual weapon. If I wanted a weapon to do damage in a range of say 8-16 how would I do that?
I'm thinking of using a script that allows formulas for each individual weapon. If I wanted a weapon to do damage in a range of say 8-16 how would I do that?
Set variance to 0. And then it would be: min + rand(range)

So in the 8-16 example:

8+rand(9)
Thanks Foam I appreciate that!
Really looking forward to the tutorial about bypassing the formula textbox length, that is starting to give me some problems.
Really looking forward to the tutorial about bypassing the formula textbox length, that is starting to give me some problems.
I believe you can already do this simply by calling a function instead of typing it all out in the damage window.
I had created a separate script to handle several different attack formulas I was using, but all of them were never run completely as they errored out for some reason.

Thankfully Fomar added a tutorial for what I asked on his website, and it solved my problem. Never realized I needed class Game_Battler < Game_BattlerBase.
How would you get the formula to add a status ailment only if the spell crits?
Sorry critical hits are determined after the custom formula is ran.
Darn, well I got another silly question. ><

I am trying to make my healing spell do x 2 healing when the caster has a heal boosting buff... otherwise the spell works like normal. I can't get it to work.

> In formula box in Database:



Code:
a.heal_spell_formula
Script Editor:



Code:
class Game_Battler < Game_BattlerBase 

  def heal_spell_formula
    if a.state?(44); ( a.mat * 1 ) ; else; ( a.mat * 2 ) ; end
  end

end
Sorry for so many questions. ><
Few things I noticed, Guy. Once you are working with a function in a class, 'a' and 'b' no longer apply. So it would simply be



Code:
if state?(44); ( mat * 1 ) ; else; ( mat * 2 ) ; end
but I think you have it backwards to what you intended. Right now it will use double the magic stat when the state is not inflicted.

and nitpicky things that don't matter per se

Spoiler
-mat * 1 is more than is needed. You can just use mat.-You can shorten the code to



Code:
state?(44) ? mat*2 : mat
Thank you!

😍:

I was so busy trying to make it just like you would right it out in the script box in the database. :wacko:
How would you get the formula to add a status ailment only if the spell crits?
The only way I can think of is the one Fomar himself pointed out a few posts above:
Try:



Code:
if a.mp>=100;@result.critical=true;(a.atk*4-b.def*2)*3;else;(a.atk*4-b.def*2);end;
Make sure the skill has no crit chance and turn the formula into this:



Code:
if rand<=cri;@result.critical=true;FORMULA*3;b.add_state(STATEID);else;FORMULA;end;
Where FORMULA is your base damaging formula, STATEID is the id of the state you want to inflict and I am assuming crit is still triple damage, otherwise you'd need to change that as well.
c=formula; if b.result.critical;b.add_state(state_id);end;c

e.g

c=a.mat*4-b.mdf*2; if b.result.critical;b.add_state(8);end;c
Spiffy.

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