Actor Specific Extra Parameters that include Variables

Does anybody know if there is a way to have variables affect extra parameters, and have different actors use different formulas for their individual parameters. With Yanfly's Extra Parameter formulas I can change the extra and special parameters, but I'm unable to use variables in the formulas, or customize them for individual actors.

Does anybody know how to do this?
Bump.
Here is a little trick you can use. Add this new script
For example
Code:
class Game_Battler
  def custom_evasion(base, n)
    if actor?
      case @actor_id
      when 1; return $game_variables[1]
      when 2; return $game_variables[2]
      when 3; return $game_variables[3]
      when 4; return $game_variables[4]
      else
        return base
      end
    else
      return base
    end
  end
end
in Yanfly's config, you can just write
Code:
:eva_formula => "custom_evasion(base_eva, n)",
Thanks for the help, but I'm terrible at scripting, and not sure what that means.

Extra Parameter Script 1.png


Is this where I would add to the script.
Just remove Base and add something like that, but once for every parameter I wanted to change this way.

Extra Parameter Script 3.png


I found this about custom damage formula, and would adding something like that work.

But what exactly would I change b.id to?
Alright, let's get started with this.
You only mention that each character has a different formula and want to use game variables. But you never mention how is your formula exactly. So, how you want your formula to be?
Write down your formula in the reply.
Okay, I'll leave another link to Yanfly's Extra Parameter formulas here, for convenience.

Also a bit of context might be helpful, so the playable characters consist of four kids who have never been in a fight before in their lives, a teenage girl, a teenage boy who has a dangerous illness and a trained adult martial artist.

Spoiler: Extra Parameters
For the HIT formula, the standard n value is "(atk + agi) / 2"
That should be fine for the teenage girl, but each of the kids has there own combat inexperience variable, which would be added to 2, changing the kids HIT n value to "(atk + agi) / (2 + that kids combat inexperience variable)", while the teenage boy's HIT n value would be "(atk + agi) / (2 + illness variable)" The martial artist would be a lot stronger, so his HIT n value would be "(atk + agi) * (2 + martial arts skill variable)"

For the EVA formula, that could be a similar change to the HIT formula, since it just replaces the attack with luck, except for the teenage girl, who's EVA n value would be "(agi + luk + fleeing value) / 2".

For the CRI formula, the standard n value is simply luck.
That would do for the teenage girl, but each of the kids could have their own combat inexperience value taken away from their luck, the teenage boy would have his illness variable taken away from half his luck, while the martial artist could have his martial arts skill variable added to his luck.

For the CEV formula, the standard n value is "agi * 0.75 + luk * 0.25".
The CEV n value for the kids would be "agi * 0.75 + luk * 0.25 - that kids combat inexperience value", the teenage boy's CEV n value would be "agi * 0.75 - illness variable", the teenage girl's CEV n value would be "agi * 0.75 + luk * 0.25 + fleeing variable", and the martial artist's CEV n value would be "agi + luk + martial arts skill variable".

For the MEV formula, that would be pretty much the same as the EVA formula, just using magic defense instead of agility, and adjustments for the different n value formula.

For the MRF formula, the kids could each have their own magical reflection skill variable for their own MRF n value (and the whole formula would just be the n value), while the others simply have to get hurt.

For the CNT formula, the martial artist could have his counter attack skill variable as his n value (and the whole formula would just be the n value), while the others wouldn't be able to counter attack.

I have no plans to give any of the characters a natural HP, MP or TP regeneration, so the HRG, MRG and TRG formulas can be left alone.

Spoiler: Special Parameters
For the TGR formula, each of the kids would have their own usefulness variable as their TGR n value, which would be added onto the base_tgr, while the martial artist would have a hindrance variable as his TGR n value, which would be taken away from the base_tgr. The teenagers don't get special treatment, so they use the base_tgr.

For the GRD formula, each of the kids would have their own guard inexperience variable as their GRD n value that would be taken away from the base_grd, the teenage boy would have his illness variable as his GRD n value that would be taken away from the base_grd, while the martial artist would have a guard experience variable as his n value, which would be added onto the base_grd. The teenage girl doesn't get any change to her grd formula.

For the REC formula, the kids would each have their own magical affinity variable as their REC n value, which would be added onto their base_rec formula. The others would use just the base_rec.

For the PHA formula, the martial artist would have an efficiency variable as his PHA n value, which would be added to his base_pha formula, while the teenage boy would have an inefficiency variable as his PHA n value, which would be taken away from his base_pha formula. The others would use just the base_pha.

For the MCR formula, each of the kids would have their own magical skill variable as a MCR n value, which would be taken from their base_mcr. The others would just use the base_mcr variable.

For the TCR formula, the martial artist would have an efficiency variable as his TCR n value, which would be added to his base_tcr formula, while the teenage boy would have an inefficiency variable as his TCR n value, which would be taken away from his base_tcr formula. The others would use just the base_tcr.

For the PDR formula, the martial artist would have a toughness variable, which would be taken away from his pdr formula, while the kids would have a weakness variable, which would be added to their pdr formula and the teenage boy would have a illness variable, which would be added to his pdr formula.

For the MDR formula, the kids would have a magical toughness variable that would be taken away from their mdr formula, while the teenage boy would have a illness variable, which would be added to his mdr formula.

For the FDR formula, the martial artist would have a toughness variable, which would be taken away from his fdr formula, and the teenage boy would have a illness variable, which would be added to his fdr formula.

For the EXR formula, the martial artist would have a genius variable, which would be added to his exr formula, and the teenage boy would have a trouble focusing variable, which would be added to his exr formula.

Okay the formulas are here. In some cases just the n value was changed, or just the formula was changed, so in those cases I put just the relevant information.

Spoiler: Extra Formulas
HIT Formula

Normal hit n value = "(atk + agi) / 2"
Martial artist hit n value = "(atk + agi) * (2 + martial arts skill variable)"
Kid 1 hit n value = "(atk + agi) / (2 + kid 1 combat inexperience variable)"
Kid 2 hit n value = "(atk + agi) / (2 + kid 2 combat inexperience variable)"
Kid 3 hit n value = "(atk + agi) / (2 + kid 3 combat inexperience variable)"
Kid 4 hit n value = "(atk + agi) / (2 + kid 4 combat inexperience variable)"
Teenage girl hit n value = no change
Teenage boy hit n value = "(atk + agi) / (2 + illness variable)"

EVA Formula

Normal eva n value = "(agi + luk) / 2"
Martial artist eva n value = "(agi + luk) * (2 + martial arts skill variable)"
Kid 1 eva n value = "(agi + luk) / (2 + kid 1 combat inexperience variable)"
Kid 2 eva n value = "(agi + luk) / (2 + kid 2 combat inexperience variable)"
Kid 3 eva n value = "(agi + luk) / (2 + kid 3 combat inexperience variable)"
Kid 4 eva n value = "(agi + luk) / (2 + kid 4 combat inexperience variable)"
Teenage girl eva n value = "(agi + luk + fleeing value) / 2"
Teenage boy eva n value = "agi / (2 + illness variable)"

CRI Formula

Normal cri n value = "luk"
Martial artist cri n value = "(luk + martial arts skill variable)
Kid 1 cri n value = "(luk - kid 1 combat inexperience variable)"
Kid 2 cri n value = "(luk - kid 2 combat inexperience variable)"
Kid 3 cri n value = "(luk - kid 3 combat inexperience variable)"
Kid 4 cri n value = "(luk - kid 4 combat inexperience variable)"
Teenage girl cri n value = no change
Teenage boy ci n value = "((luk / 2) - illness variable)"

CEV Formula

Normal cev n value = "agi * 0.75 + luk * 0.25"
Martial artist cev n value = "agi + luk + martial arts skill variable"
Kid 1 cev n value = "agi * 0.75 + luk * 0.25 - kid 1 combat inexperience variable"
Kid 2 cev n value = "agi * 0.75 + luk * 0.25 - kid 2 combat inexperience variable
Kid 3 cev n value = "agi * 0.75 + luk * 0.25 - kid 3 combat inexperience variable"
Kid 4 cev n value = "agi * 0.75 + luk * 0.25 - kid 4 combat inexperience variable"
Teenage girl cev n value = "agi * 0.75 + luk * 0.25 + fleeing variable"
Teenage boy cev n value = "agi * 0.75 - illness variable"

MEV Formula

Normal mev n value = "(mdf + luk) / 2 "
Martial artist mev n value = "(mdf + luk) * (2 + martial arts skill variable) "
Kid 1 mev n value = "(mdf + luk) / (2 + kid 1 combat inexperience variable)"
Kid 2 mev n value = "(mdf + luk) / (2 + kid 2 combat inexperience variable)"
Kid 3 mev n value = "(mdf + luk) / (2 + kid 3 combat inexperience variable)"
Kid 4 mev n value = "(mdf + luk) / (2 + kid 1 combat inexperience variable)"
Teenage girl mev n value = "(mdf + luk + fleeing value) / 2"
Teenage boy mev n value = "mdf / (2 + illness variable)"

MRF Formula

Normal mrf n value = "0"
Normal mrf formula = "base_mrf"
Martial artist = no change
Kid 1 mrf n value = "kid 1 magical reflection skill variable"
Kid 1 mrf formula = "base_mrf + n"
Kid 2 mrf n value = "kid 2 magical reflection skill variable"
Kid 2 mrf formula = "base_mrf + n"
Kid 3 mrf n value = "kid 3 magical reflection skill variable"
Kid 3 mrf formula = "base_mrf + n"
Kid 4 mrf n value = "kid 4 magical reflection skill variable"
Kid 4 mrf formula = "base_mrf + n"
Teenage girl = no change
Teenage boy = no change

CNT Formula

Normal cnt n value = "0"
Normal cnt formula = "base_cnt"
Martial Artist cnt n value = "counter attack skill variable"
Martial Artist formula = "base_cnt + n"
Kid 1 = no change
Kid 2 = no change
Kid 3 = no change
Kid 4 = no change
Teenage girl = no change
Teenage boy = no change

HRG Formula

Normal hrg n value = "0"
Normal hrg formula = "base_hrg"
All = no change

MRG Formula

Normal mrg n value = "0"
Normal mrg formula = "base_mrg"
All = no change

TRG Formula

Normal trg n value = "0"
Normal trg formula = "base_trg"
All = no change

Spoiler: Special Formulas
TGR Formula

Normal tgr n value = "0"
Normal tgr formula = "base_tgr"
Martial Artist tgr n value = "hindrance variable"
Martial Artist tgr formula = "base_tgr - n"
Kid 1 tgr n value = "kid 1 usefulness variable"
Kid 1 formula = "base_tgr + n"
Kid 2 tgr n value = "kid 2 usefulness variable"
Kid 2 formula = "base_tgr + n"
Kid 3 tgr n value = "kid 3 usefulness variable"
Kid 3 formula = "base_tgr + n"
Kid 4 tgr n value = "kid 4 usefulness variable"
Kid 4 formula = "base_tgr + n"
Teenage girl = no change
Teenage boy = no change

GRD Formula

Normal grd n value = "0"
Normal grd formula = "base_grd"
Martial Artist grd n value = "guard experience variable"
Martial Artist grd formula = "base_grd + n"
Kid 1 grd n value = "kid 1 guard inexperience variable"
Kid 1 grd formula "base_grd - n"
Kid 2 grd n value = "kid 2 guard inexperience variable"
Kid 2 grd formula "base_grd - n"
Kid 3 grd n value = "kid 3 guard inexperience variable"
Kid 3 grd formula "base_grd - n"
Kid 4 grd n value = "kid 4 guard inexperience variable"
Kid 4 grd formula "base_grd - n"
Teenage girl = no change
Teenage boy grd n value = "illness variable"
Teenage boy grd formula = "base_grd - illness variable"

REC Formula

Normal rec n value = "0"
Normal rec formula = "base_rec"
Martial Artist = no change
Kid 1 rec n value = "kid 1 magical affinity variable"
Kid 1 rec formula = "base_rec - n"
Kid 2 rec n value = "kid 2 magical affinity variable"
Kid 2 rec formula = "base_rec - n"
Kid 3 rec n value = "kid 3 magical affinity variable"
Kid 3 rec formula = "base_rec - n"
Kid 4 rec n value = "kid 4 magical affinity variable"
Kid 4 rec formula = "base_rec - n"
Teenage girl = no change
Teenage boy = no change

PHA Formula

Normal pha n value = "0"
Normal pha formula = "base_pha"
Martial Artist pha n value = "efficiency variable"
Martial Artist pha formula = "base_pha + n"
Kid 1 = no change
Kid 2 = no change
Kid 3 = no change
Kid 4 = no change
Teenage girl =no change
Teenage boy pha n value = "inefficiency variable"
Teenage boy pha formula = "base_pha - n"

MCR Formula

Normal mcr n value = "0"
Normal mcr formula = "base_mcr"
Martial Artist = no change
Kid 1 mcr n value = "kid 1 magical skill variable"
Kid 1 mcr formula = "base_mcr - n"
Kid 2 mcr n value = "kid 2 magical skill variable"
Kid 2 mcr formula = "base_mcr - n"
Kid 3 mcr n value = "kid 3 magical skill variable"
Kid 3 mcr formula = "base_mcr - n"
Kid 4 mcr n value = "kid 4 magical skill variable"
Kid 4 mcr formula = "base_mcr - n"
Teenage girl = no change
Teenage boy = no change

TCR Formula

Normal tcr n value = "0"
Normal tcr formula = "base_tcr"
Martial Artist tcr n value = "efficiency variable"
Martial Artist tcr formula = "base_tcr + n"
Kid 1 = no change
Kid 2 = no change
Kid 3 = no change
Kid 4 = no change
Teenage girl = no change
Teenage boy tcr n value = "inefficiency variable"
Teenage boy tcr formula = "base_tcr - n"

PDR Formula

Normal pdr formula = "base_pdr - (n / (256.0 + n)) * 0.500 - 0.000"
Martial Artist pdr formula = "base_pdr - tougness variable - (n / (256.0 + n)) * 0.500 - 0.000"
Kid 1 pdf formula = "base_pdf + kid 1 weakness variable - (n / (256.0 + n)) * 0.500 - 0.000"
Kid 2 pdf formula = "base_pdf + kid 2 weakness variable - (n / (256.0 + n)) * 0.500 - 0.000"
Kid 3 pdf formula = "base_pdf + kid 3 weakness variable - (n / (256.0 + n)) * 0.500 - 0.000"
Kid 4 pdf formula = "base_pdf + kid 4 weakness variable - (n / (256.0 + n)) * 0.500 - 0.000"
Teenage girl = no change
Teenage boy = Kid 1 pdf formula = "base_pdf + illness variable - (n / (256.0 + n)) * 0.500 - 0.000"

MDR Formula

Normal mdr formula = "base_mdr - (n / (256.0 + n)) * 0.500 - 0.000"
Martial Artist mdr formula = "base_mdr - tougness variable - (n / (256.0 + n)) * 0.500 - 0.000"
Kid 1 mdf formula = "base_mdf - kid 1 magical toughness variable - (n / (256.0 + n)) * 0.500 - 0.000"
Kid 2 mdf formula = "base_mdf - kid 2 magical toughness variable - (n / (256.0 + n)) * 0.500 - 0.000"
Kid 3 mdf formula = "base_mdf - kid 3 magical toughness variable - (n / (256.0 + n)) * 0.500 - 0.000"
Kid 4 mdf formula = "base_mdf - kid 4 magical toughness variable - (n / (256.0 + n)) * 0.500 - 0.000"
Teenage girl = no change
Teenage boy = Kid 1 mdf formula = "base_mdf + illness variable - (n / (256.0 + n)) * 0.500 - 0.000"

FDR Formula

Normal fdr n value = "0"
Normal fdr formula = "base_fdr"
Martial Artist fdr n value = "toughness variable"
Martial Artist fdr formula = "base_fdr - n"
Kid 1 fdr n value = "kid 1 weakness variable"
Kid 1 fdr formula = "base_fdr + n"
Kid 2 fdr n value = "kid 2 weakness variable"
Kid 2 fdr formula = "base_fdr + n"
Kid 3 fdr n value = "kid 3 weakness variable"
Kid 3 fdr formula = "base_fdr + n"
Kid 4 fdr n value = "kid 4 weakness variable"
Kid 4 fdr formula = "base_fdr + n"
Teenage girl = no change
Teenage boy grd n value = "illness variable"
Teenage boy grd formula = "base_grd + illness variable"

EXR Formula

Normal exr n value = "0"
Normal exr formula = "base_exr"
Martial Artist exr n value = "genius variable"
Martial Artist exr formula = "base_exr + n"
Kid 1 = no change
Kid 2 = no change
Kid 3 = no change
Kid 4 exr n value = "smart variable"
Kid 4 exr formula = base_exr + n"
Teenage girl = no change
Teenage boy exr n value = "trouble focusing variable"
Teenage boy exr formula = "base_exr - n"
Bump.
Bump.
Bump.
Bump.
Bump.
Bump.
You can use $game_variables in your formulas.

Basically what you're going to have to do is create a separate hit_n_value and hit_formula for each character and then edit the #{xparam} method at the bottom of the script to point to the one for that character. I would do this using their ID so that it's easier to insert.
Okay, here's something based on what you've given for the hit formula. Hopefully this makes sense and you can use it to create the other formulas.

In a new slot just above Yanfly's formula script, add in the following script:
Ruby:
class Game_BattlerBase
 
  def martial_arts_skill_variable
    # If anyone else tries to use this variable, it's 0
    return 0 unless actor? && @actor_id == 1 # Martial artist actor ID
    return $game_variables[1] # the variable for the martial artist's skill
  end
 
  def illness_variable
    # If anyone else tries to use this variable, it's 0
    return 0 unless actor? && @actor_id == 7 # Teenage boy actor ID
    return $game_variables[7] # the variable for the teenage boy's illness
  end

  def combat_inexperience_variable
    # If an enemy tries to use this variable, it's 0
    return 0 unless actor?
    case @actor_id
    # when ACTOR_ID; $game_variables[VARIABLE_ID]
    when 2; $game_variables[2]  # Kid 1
    when 3; $game_variables[3]  # Kid 2
    when 4; $game_variables[4]  # Kid 3
    when 5; $game_variables[5]  # Kid 4
    else 0 # for everyone else, 0
    end
  end

  # this is what we'll pass into the Yanfly formula
  def custom_hit_formula(n_value)
    # Get the string to pass to the Yanfly formula
    return n_value unless actor?
    case @actor_id
    when 1; "(atk + agi) * (2 + #{martial_arts_skill_variable})" # Martial artist
    when 2; "(atk + agi) / (2 + #{combat_inexperience_variable})" # Kid 1
    when 3; "(atk + agi) / (2 + #{combat_inexperience_variable})" # Kid 2
    when 4; "(atk + agi) / (2 + #{combat_inexperience_variable})" # Kid 3
    when 5; "(atk + agi) / (2 + #{combat_inexperience_variable})" # Kid 4
    when 6; n_value # Teenage girl
    when 7; "(atk + agi) * (2 + #{illness_variable})" # Teenage boy
    else n_value
    end
  end
 
end

Then you can call the custom formula like so:
Ruby:
      :hit_n_value => "(atk + agi) / 2",
      :hit_formula => "custom_hit_formula(n)",
That looks complex.
I'll create a new project and see if I get it to work.
Maybe I can.

If I can't, I'll just have to ask for help.
But thanks for what you've done so far.
Literally all you need to do with the provided code is copy and paste it and then replace the ID numbers with the correct ones for your characters.
If you can't get it to work, let me know and I can try to break it down further. You could also just do this:
Ruby:
# this is what we'll pass into the Yanfly formula
  def custom_hit_formula(n_value)
    # Get the string to pass to the Yanfly formula
    return n_value unless actor?
    case @actor_id
    when 1; "(atk + agi) * (2 + $game_variables[1])" # Martial artist
    when 2; "(atk + agi) / (2 + $game_variables[2])" # Kid 1
    when 3; "(atk + agi) / (2 + $game_variables[3])" # Kid 2
    when 4; "(atk + agi) / (2 + $game_variables[4])" # Kid 3
    when 5; "(atk + agi) / (2 + $game_variables[5])" # Kid 4
    when 6; n_value # Teenage girl
    when 7; "(atk + agi) * (2 + $game_variables[6]})" # Teenage boy
    else n_value
    end
  end

I just thought it'd be easier to have custom methods since you'll be repeating them a lot throughout the different formulas.
I really have no idea what goes where.
I've tried to get it to fit, but it won't.

Extra Parameter Script 1.png


This is the original hit formula.
I'm not sure what to put where.

I don't mind not using custom methods and doing it the long way round if it means I can get it to work.
I really have no idea what goes where.
I've tried to get it to fit, but it won't.

View attachment 149724

This is the original hit formula.
I'm not sure what to put where.

I don't mind not using custom methods and doing it the long way round if it means I can get it to work.

1593639816585.png


Press insert. A new script entry will be created above it. Call it "A-Moonless-Night edit" or something. It doesn't matter what you call it.

Paste the code AMN gave you in the right-hand window of the new script.

1593639904860.png
What Trihan said above, except it should be this:
Ruby:
class Game_BattlerBase

  # this is what we'll pass into the Yanfly formula
  def custom_hit_formula(n_value)
    # Get the string to pass to the Yanfly formula
    return n_value unless actor?
    case @actor_id
    when 1; "(atk + agi) * (2 + $game_variables[1])" # Martial artist
    when 2; "(atk + agi) / (2 + $game_variables[2])" # Kid 1
    when 3; "(atk + agi) / (2 + $game_variables[3])" # Kid 2
    when 4; "(atk + agi) / (2 + $game_variables[4])" # Kid 3
    when 5; "(atk + agi) / (2 + $game_variables[5])" # Kid 4
    when 6; n_value # Teenage girl
    when 7; "(atk + agi) * (2 + $game_variables[6]})" # Teenage boy
    else n_value
    end
  end
 
end

Replace the :hit_formula line in Yanfly's script with this:
Ruby:
:hit_formula => "custom_hit_formula(n)",

Original thread: https://forums.rpgmakerweb.com/threads/actor-specific-extra-parameters-that-include-variables.121524/