Jump to content
Titanhex

Skill Ideas you can do with Custom Formula

Recommended Posts

First I suggest you check out Fomar's tutorial on getting the most out of Custom Formula. This will help you understand how these work and modify them.

http://www.rpgmakerv...ormulae-part-1/

For many of the novice and intermediate game developers here, they may not know where to find the script snippets we can call to use in Custom Formula. (They're in Game_BattlerBase)
Even if they did know, some would not know how to interpret them and use them to their full extent.
Some may also not realize the use or see some uses for these snippets.

I want to remedy that and provide a list, with the help of any contributors, of skill ideas we can do with the custom formula.

Please contribute freely! ;)

First, I'd like to drop off this list. This list is all the .stat values we can use in custom formula. While the tooltip shows atk and def, it does not show pharmacology and evasion. This shows you them:

 

def mhp;  param(0);   end			   # MHP  Maximum Hit Points
  def mmp;  param(1);   end			   # MMP  Maximum Magic Points
  def atk;  param(2);   end			   # ATK  ATtacK power
  def def;  param(3);   end			   # DEF  DEFense power
  def mat;  param(4);   end			   # MAT  Magic ATtack power
  def mdf;  param(5);   end			   # MDF  Magic DeFense power
  def agi;  param(6);   end			   # AGI  AGIlity
  def luk;  param(7);   end			   # LUK  LUcK
  def hit;  xparam(0);  end			   # HIT  HIT rate
  def eva;  xparam(1);  end			   # EVA  EVAsion rate
  def cri;  xparam(2);  end			   # CRI  CRItical rate
  def cev;  xparam(3);  end			   # CEV  Critical EVasion rate
  def mev;  xparam(4);  end			   # MEV  Magic EVasion rate
  def mrf;  xparam(5);  end			   # MRF  Magic ReFlection rate
  def cnt;  xparam(6);  end			   # CNT  CouNTer attack rate
  def hrg;  xparam(7);  end			   # HRG  Hp ReGeneration rate
  def mrg;  xparam(8);  end			   # MRG  Mp ReGeneration rate
  def trg;  xparam(9);  end			   # TRG  Tp ReGeneration rate
  def tgr;  sparam(0);  end			   # TGR  TarGet Rate
  def grd;  sparam(1);  end			   # GRD  GuaRD effect rate
  def rec;  sparam(2);  end			   # REC  RECovery effect rate
  def pha;  sparam(3);  end			   # PHA  PHArmacology
  def mcr;  sparam(4);  end			   # MCR  Mp Cost Rate
  def tcr;  sparam(5);  end			   # TCR  Tp Charge Rate
  def pdr;  sparam(6);  end			   # PDR  Physical Damage Rate
  def mdr;  sparam(7);  end			   # MDR  Magical Damage Rate
  def fdr;  sparam(8);  end			   # FDR  Floor Damage Rate
  def exr;  sparam(9);  end			   # EXR  EXperience Rate


Now we can use a ton of stats for our formulas!

1. How do we change the users stats when we're targeting someone else?

a.stat -= \ += \ %= \ *= \ /= n

Any time we put a = after a math symbol, we're telling the game to set that number to the value we get after doing that math.

What can we do with this?

So many things. You can cause backlash or reward for using skills.

Specifically I created a skill that deals damage back to the user based on HP.

r = a.hp*0.3;a.hp -= (a.hp*0.1).round;r - b.def/2


2. How do we check for a state on a target?

.state?(n)

Where n is the number of the state we're checking for.

What can we do with this?

We can do a lot. Boost damage if a state is applied, do increased healing if a state is applied, the list goes on and can be coupled with anything in the list of things we can do.

Specifically I created a backstab that deals extra damage if the enemy is Surprised.
b.state?(50) ? r = a.atk * 12 : r = a.atk * 4 ; r - b.def * 2


3. How do we check if we're removing a state on a target?

.erase_state(n)

This saves us a little work. Basically, it both removes the state and checks if there was a state to remove.

What can we do with this?

We can do anything extra if the state is successfully removed. For example we can do extra healing if we remove poison, or deal extra damage if the target is stunned but remove stun.

Specifically I made a skill that heals HP and cures poison, but takes 3 extra mana if it removes poison.
if b.erase_state(2) ; a.mp -= 3 ; end ; 50


4. How do we use elemental defense for calculations?

.element_rate(n)

This is returned as a decimal value. 1 = 100%, 3 = 300%, 0.5 = 50%.

What can we do with this?

Some really interesting and fun stuff. You can make it so you heal more if you're weaker to fire, or recover more HP if you're strong to ice. You can check if your resistance is below a certain amount and then do something.

Specifically I created a fire spell that deals more damage the weaker you are to fire.
(a.mat * 2 - b.mdf * 2)*a.element_rate(3)

4a. What about states?

.state_rate(n)

 

5. Can we apply debuffs and buffs?

 

.add_debuff(param, turn)

 

.add_buff(param, turn)

 

Turn is the turn number for the buff to last and param is the parameter number we're debuffing.

 

What can we do with this?

 

We can set a debuff to happen by a random chance when attacking, or buff the user.

 

Here I've put a 50% chance to buff your defense for 2 turns when you attack, and deal 150 damage.

 

rand(100) <= 50 ? a.add_buff(3, 2):0;150


6. Can we stop an enemy from acting without using a stun status?

 

.remove_current_action

 

This can allow you to make a disruption skill that will stop an enemy from taking an action, great for fast characters. You may want a random chance on this though.

What can we do with this?

 

I've made a simple one round "stun" with a 35% chance of happening and deals a flat 50 damage.

 

if rand(100) <= 35;b.remove_current_action;end;50

7. Can we hide an ally in battle or make an ally appear?

 

.hide

 

.appear

 

These two will make an enemy or ally hidden from battle or make them reappear. There are certainly some uses for skills like this or even just events in battle.  When an enemy is hidden, it doesn't give EXP. When a character is hidden, you do not receive a game over when the battle ends.

 

What can we do with this?

 

We can have summons that hide characters or enemies. We can even create individual escape mechanisms, like a % chance for just the user to escape by hiding them.  There's a lot of possibilities for this skill. I'll help you by going through some not-so-obvious set-ups.

 

Make all enemies on the battlefield appear:

$game_troop.members.each {|enemy| enemy.appear}

 

Make a specific enemy appear:

$game_troop.members[n].appear

 

Make a specific ally in your party appear (if hidden):

$game_party.members[n].appear

 

Make all allies in your party appear (if hidden):

$game_party.members.each {|ally| ally.appear}


8. Can we get the base value of a stat?

 

. param_base(param_id)

 

Unfortunately I can't tell you all the parameter IDs, but I'm sure once you figure them out this may be of use.

 

We can also check the added or debuffed amount from a parameter.

 

.param_plus(param_id)

 

.param_min(param_id)


9. Can we force an ally or enemy to use a skill (even if they haven't learned it)?

Yes!
.force_action(n, n)

The first n is the skill id. If you randomize or array it, you can probably do some interesting stuff. The second n is the target index, where -2 is the last target selected and -1 is a random target.

What can we do with this?
Fun stuff! Things like make them heal or use a specific attack.

Specifically I used mine to force an ally to use a random spell in the list on a random target.
b.force_action(3+rand(15), -1);0

This one unfortunately has some limitations, please keep these in mind when using Force Action.
Problems:
If used on the user, the user repeats the spell. You must make sure a.id != b.id.

If the enemy or actor has used their turn already, they will not act. You must make sure the skill with force action will always go first.
I'm not sure how the target indexing works, and cannot guide you to use it.

 

Appendix A: List of Conditions we can check:

 

  #--------------------------------------------------------------------------
  # * Determine if States Are Addable
  #--------------------------------------------------------------------------
  def state_addable?

  #--------------------------------------------------------------------------
  # * Determine Buff Status
  #--------------------------------------------------------------------------
  def buff?(param_id)

  #--------------------------------------------------------------------------
  # * Determine Debuff Status
  #--------------------------------------------------------------------------
  def debuff?(param_id)

  #--------------------------------------------------------------------------
  # * Determine if Buff Is at Maximum Level
  #--------------------------------------------------------------------------
  def buff_max?(param_id)

  #--------------------------------------------------------------------------
  # * Determine if Debuff Is at Maximum Level
  #--------------------------------------------------------------------------
  def debuff_max?(param_id)

  #--------------------------------------------------------------------------
  # * Determine if Skill/Item Has Any Valid Effects
  #--------------------------------------------------------------------------
  def item_has_any_valid_effects?(user, item)

  #--------------------------------------------------------------------------
  # * Determine Usability of Normal Attack
  #--------------------------------------------------------------------------
  def attack_usable?

  #--------------------------------------------------------------------------
  # * Determine Usability of Guard
  #--------------------------------------------------------------------------
  def guard_usable?

  #--------------------------------------------------------------------------
  # * Determine if Enemy
  #--------------------------------------------------------------------------
  def enemy?

  #--------------------------------------------------------------------------
  # * Determine if Actor or Not
  #--------------------------------------------------------------------------
  def actor?
    return false
  end

  #--------------------------------------------------------------------------
  # * Determine if Action is Possible
  #--------------------------------------------------------------------------
  def movable?
    exist? && restriction < 4
  end

  #--------------------------------------------------------------------------
  # * Determine if Character is Confused
  #--------------------------------------------------------------------------
  def confusion?
    exist? && restriction >= 1 && restriction <= 3
  end

  #--------------------------------------------------------------------------
  # * Determine if Guard
  #--------------------------------------------------------------------------
  def guard?
    special_flag(FLAG_ID_GUARD) && movable?
  end

  #--------------------------------------------------------------------------
  # * Determine if Substitute
  #--------------------------------------------------------------------------
  def substitute?
    special_flag(FLAG_ID_SUBSTITUTE) && movable?
  end

  #--------------------------------------------------------------------------
  # * Determine if Preserve TP
  #--------------------------------------------------------------------------
  def preserve_tp?

  #--------------------------------------------------------------------------
  # * Determine if State Is Resisted
  #--------------------------------------------------------------------------
  def state_resist?(state_id)

  #--------------------------------------------------------------------------
  # * Check K.O. State
  #--------------------------------------------------------------------------
  def death_state?

  #--------------------------------------------------------------------------
  # * Check State
  #--------------------------------------------------------------------------
  def state?(state_id)
    @states.include?(state_id)
  end
Edited by Titanhex

Share this post


Link to post
Share on other sites

Heres a couple of my custom skills--Notes in my game Magic is now fire power and Magic Def is now the Magic attack

 

Smile of darkness

Very powerful dark magic skill that hits all enemies

DMG based off Magic and Bad Karma-80 + a.mdf * 5 + $game_variables[6] * 4 - b.mdf * 1.6 (Variable 6 is bad karma)

 

Righteous fist

Blessed be the nations who will fight with all our

bravery,DMG based off Attack and Karma-1 + a.atk * 2 + $game_variables[5] * 30 * 8 - b.def * 5 (Variable 5 is my good karma)

 

Bag of mystery

The mysterious bag of more then 1000 wonders~

Very random DMG output-c=1+rand(6);d=1+rand(6);if c==1 and d==1;99999;elsif c==d;c*70;else;(c+d)*600;end;

Share this post


Link to post
Share on other sites

*drool*, this is an exceptionally AWESOME post, both of them! Thank you very very much! I admit, this is still all Greek to me (for now, until I make the minimal effort to try to understand it), but it did a very important thing. It inspired me and allowed me to realize what I could potentially, eventually, put into my games.

 

@Sgt Derpy Hooves,  Your concept of using karma in battle has given me tons of ideas. I have a knight class that might be able to perform better in combat the more honor he has earned, and abilities that are boosted with divine favor, or evil spells that get boosted from souls collected, (and hopefully, uses those souls like ammunition, so more souls are needed in order to continue to cast it.)

 

These aren't very complex ideas, but up until now, I didn't realize there were ways of incorporating them. Thank you to both of you.

 

 

3rd Edit: Question Answered.

Edited by noah4th

Share this post


Link to post
Share on other sites

Hey Titanhex, I have two quick questions on this.  My first question is is it possible to have the game send a notification when a %chance buffing skill actually buffs your stats?  What I mean is, when you have something like rand(100) <= 50 ? a.add_buff(3, 2):0;150, and the %chance goes off and you get the buff, the game doesn't let you know, it just kinda happens.  However, if you have rand(100) <= 50 ? b.add_debuff(3, 2):0;150, the game DOES let you know if you succeeded in debuffing the enemy.  Is there a way to get it to send a message when the self buff is successful on these kinds of attacks?

 

My second question is I'm not really understanding how to deal bonus damage if an enemy has a current state.  For example, I'm trying to deal double damage when an enemy is poisoned, but am unsure how to word it in the damage formula after I check for the state.  Thanks.

 

Other than that, this tutorial has already helped me make tons of skills I never thought I could make.

Share this post


Link to post
Share on other sites

Unfortunately I don't know how to access the log_window/window_battlelog from the custom formula otherwise I could recommend something.

You could try Yanfly's engine, which shows an indicator when a buff or debuff is applied.

 

As for your second question, I'll explain.

 

Everything before the ? is your condition. After the ? is what happens if that condition is true. After the : is if it's false.

 

Dog is Brown ? This Dog is Brown : This Dog is Not Brown

 

So:

 

b.state?(2) ? 300 : 150

 

A note that I should input into this tutorial is that you return a number or mathematical formula through custom formula. I'll just have to figure out a good way to explain this first, especially for non-coders. It could help to check out the link on the second line of my introduction.

Share this post


Link to post
Share on other sites

Is it possible to force a critical based on a condition?

 

I'm trying to use a custom formula script that increases critical hit based on the monster's remaining % hp. I know how to determine the percentage but I don't know what will force a crit. Tried a.cri=100, @critical=true, @result.critical = 0, @result.critical = true. Not sure what to use to ensure a critical.

Edited by zenithzephyr

Share this post


Link to post
Share on other sites

Do you know if it'd be possible using the custom formula's hide/appear to replace an actor with another? Like say a substitution or transformation?

 

I'm not too up on Custom formula but want to experiment.

Edited by FubarCharged

Share this post


Link to post
Share on other sites

@zenith

I tried doing a critical adjustment but couldn't do it. This may not be possible to do unfortunately. However criticals are usually 3 or 2x the normal damage, so just account for it in the formula. It just won't have the special effects like a normal critical.

 

@Fubar

Yes, this is possible:

; $game_party.remove_actor(1);$game_party.add_actor(3)

I added this after attack and it removed actor 1 from the party and added actor 3. My testing wasn't very deep though, so I'm not sure exactly what kind of results this had. I just know I had Terrence in the party and removed Eric. :)

Share this post


Link to post
Share on other sites

I've got a quick question. I found a really interesting idea for a damage formula, but part of the math involved requires the attack power of the equipped weapon. Not the character's attack power with the weapon equipped, but the power of the weapon itself. (It does some math where it uses a random number between -0.2 and 0.2 of the weapon's attack power in order to figure out the variations in end damage. For instance, an attack doing 40 damage one turn, 39 damage another turn, 42 the next, etc.)

 

Anyways, is there a way to use the weapon's innate attack power in a formula as a separate variable from the user's attack strength?

Share this post


Link to post
Share on other sites

How do you make an ability additionally apply a debuff if target has a status ailment? For instance, an ability called, "Cheapshot" that will damage target and additionally apply a DEF debuff if the target is inflicted with Blind. I've tried and my formula attempts either crash the game or do nothing.

Here's what I tried:

b.state?(3) ? b.add_debuff(3, 5) : 0; a.atk*4 - b.def *2

Share this post


Link to post
Share on other sites

@Harmill: Your formula has a space between b.def and *2. That space is causing an error. To fix it just remove the space.

 

@KHaren: That should be completely possible. Unfortunately I haven't looked through the actor equip scripts before, so I can't tell you the formula. I'm sure it's close to $game_party.member[2].weapon.atk or something. If you ask in Script Support in the "Topics that don't deserve their own threads" they can probably give it to you.

Share this post


Link to post
Share on other sites

Ahaha, wow, I can't believe it was a spacing problem! Thanks - I spent 20 minutes fiddling with the formula, trying different things with no luck. But now it works - thanks!

 

EDIT: OK, so I have another formula that I've been trying to make but I can't figure out why it's not working. I followed Fomar's tutorial on bypassing the formula default length but my function call doesn't seem to be working.

 

Here's my attempt at making an ability that does more damage depending how many debuffs the target has:

 

class Game_Battler < Game_BattlerBase
  # More damage depending on amount of debuffs on target.
  def cripple_attack(a,
    p 'I am in the cripple attack formula!'
    c = 0
    # If target has ATK debuff
    if b.debuff?(2)
      c += 1
    end
    # If target has DEF debuff
    if b.debuff?(3)
      c += 1
    end
    # If target has MAG debuff
    if b.debuff?(4)
      c += 1
    end
    # If target has RES debuff
    if b.debuff?(5)
      c += 1
    end
    # If target has AGL debuff
    if b.debuff?(6)
      c += 1
    end
    # If target has LUK debuff
    if b.debuff?(7)
      c += 1
    end
    case c
    when 0
      return (a.atk * 4) - (b.def * 2)
    # 10% more damage if target has 1 debuff
    when 1
      d = (a.atk * 4 - b.def * 2) * 1.1
    # 20% more damage if target has 2 debuffs
    when 2
      d = (a.atk * 4 - b.def * 2) * 1.2
    # 50% more damage if target has 3 debuffs
    when 3
      d = (a.atk * 4 - b.def * 2) * 1.5
    # 100% more damage if target has 4 debuffs
    when 4
      d = (a.atk * 4 - b.def * 2) * 2
    # 150% more damage if target has 5 debuffs
    when 5
      d = (a.atk * 4 - b.def * 2) * 2.5
    # 200% more damage if target has 6 debuffs
    when 6
      d = (a.atk * 4 - b.def * 2) * 3
    end
    return d
  end
end

And then I try to call it by typing:      a.cripple_attack(a,B)   in the Formula box for the skill.

I have that trace in the function but the trace doesn't even go off in the console. So I copy/pasted one of Fomar's examples and even his weren't working.

 

Edited by Harmill

Share this post


Link to post
Share on other sites

@Harmill

class Game_Battler < Game_BattlerBase
def cripple_attack(a,
    c = 0
    e = a.atk * 4 - b.def * 2
     for d in [2,3,4,5,6,7]
      if b.debuff?(d)
      c += 1
      end
      end
      return e if c==0
      return e * 1.1 if c==1
      return e * 1.2 if c==2
      return e * 1.5 if c==3
      return e * 2 if c==4
      return e * 2.5 if c==5
      e * 3
    end
    
end
edit: typed @Harmill twice

edit2: removed prints from code

Edited by Xypher

Share this post


Link to post
Share on other sites

Ooooh, thanks a lot! I realize my code was very messy and not concise, but could you tell me why my code wasn't returning anything? Or why my print trace didn't even go off? I would think the function wasn't even being entered if my trace wasn't showing up.

Share this post


Link to post
Share on other sites

Ok,I have a skill where a character orders one of the other party members to attack,I got that part down,but how do I keep the other party member from attacking? I tried using .remove_current_action but that crashed heres the code 

$game_switches[90] ? $game_actors[3].atk * 6.7 – b.def * 2 : 0 + .remove_current_action
also if possible,a better way to check if the actor is in party? I'm currently using troop events.

Share this post


Link to post
Share on other sites

is it possible to have attacks which heal the target when they are immune to the element..

let's say a monster attacked my player w/ a fire spell & my character is immune to it then my character would heal instead of taking damage..

 

i plan to use the elemental_rate feature for the element association and also is there a way to use the atk element feature on the formula?

 

thanks for any help..

Share this post


Link to post
Share on other sites

@Nihnoz: Yes. However you're going to have to get the element id of the weapon in the using actors hand. This may require some extra scripting knowledge that extends beyond the battlerbase class.

Just ask in the "Questions that dont deserve their own thread" how to do this.

 

@ringofsky: this is only possible with a script, and won't work in custom formula. It requires a system.

Share this post


Link to post
Share on other sites

oh thanks for answering my question.. but how about the second one,  the use of atk_element in the formula.

would that be possible or only w/ a script?

 

and how i can prevent damage from having decimals? i made a formula & after calculations the damage is like 4.30 or something like that & then the hp was also displayed like that.

 

i'm not familiar with what things can be used in the formula except w/ the ones you already mentioned..

 

thank you again.. :D

Share this post


Link to post
Share on other sites

Not sure. The attack element of your weapon or the skill? for the skill I'm not sure. For.the weapon its probably found in another script and might need to be asked in scripts.

 

To get an integer, put the formula in paranthesis and add .to_i after the paranthesis. No space.

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×