Jump to content
AJNR

Custom Damage Formulae Archive

Recommended Posts

The only problem is that people use different base formulas for their damage and healing and whatnot. People would have to be careful to let users know where to input their regular damage formulas within these unique effect formulas.

 

What? I created adjustable settings for Base and Handicap, the Rate is pretty monotone. It was originally set in but I edited it to be adjustable.

Share this post


Link to post
Share on other sites

What I'm saying is, I use wildly different formulas for physical and magic attacks, and most of the formulas posted by other users, I'd need to edit heavily to get them to behave the way I want in my own projects, so I'd be better off writing them myself in the first place, y'know?

 

This topic is great for giving people ideas on how to add in special effects to their formulas, though. We should keep that going, at least.

  • Like 1

Share this post


Link to post
Share on other sites

when in battle $game_party.members will automatically default to $game_party.battle_members

and the same behavior for alive_members/dead_members

  • Like 1

Share this post


Link to post
Share on other sites

Is there anyway to get the value from Kread-EX's Weapon Formula. I know the following part of the Script where the Damage is calculated - but how can I get that value to this "Custom Skill Formula" Script?

 

class Game_Battler
	#--------------------------------------------------------------------------
	# â— Calculates the damage value
	#--------------------------------------------------------------------------
	alias_method(:krx_wformula_gb_mdv, :make_damage_value)
	def make_damage_value(user, item)
		if item == $data_skills[1] && user.is_a?(Game_Actor)
			user.weapons.each do |wep|
				if wep.formula != nil
					value = wep.formula_eval(user, self, $game_variables)
					value *= item_element_rate(user, item)
					value *= pdr if item.physical?
					value *= mdr if item.magical?
					value *= rec if wep.formula_recovery
					value = apply_critical(value) if @result.critical
					value = apply_variance(value, wep.formula_variance)
					value = apply_guard(value)
					@result.make_damage(value.to_i, item)
					return
				end
			end
		end
		krx_wformula_gb_mdv(user, item)
	end

So I can use something like:

 

def Sunder_Strike(a, b, mult, thres)
   c = b.mp
    if if wep.formula == nil
      if b.mmp * (thres / 100.to_f) >= c
        (a.atk * 3 - b.def * 4) * mult
      else
        (a.atk * 3 - b.def * 4) / mult
      end
else
      if b.mmp * (thres / 100.to_f) >= c
        krx_wformula_gb_mdv(user, item) * mult
      else
        krx_wformula_gb_mdv(user, item) / mult
      end
    end
  # "krx_wformula_gb_mdv(user, item)" being the Weapon's Damage Result

Is this at all possible? (FYI, this is not necessary on my part - just curious)

Edited by AJNR

Share this post


Link to post
Share on other sites

If you have the script in your Script editor then if you call make_damage_value it will return the result of the script method (unless you have other scripts that modify that method) so

 

weapon_damage = make_damage_value(user, item)

should store what you want

Share this post


Link to post
Share on other sites

Tried that and it returns with 0. I'm testing it with the following:

    def crit_attack(a,
      weapon_damage = make_damage_value(user, item)
      b.result.critical = true
      make_damage_value(user, item)
    end

With this in the Skillbox

b.crit_attack(a,

Is there a way to get the 'Real' Damage value? (Value after all the modifications, ie. Element Rate, Apply Variance, etc.) Or is it already calculated?

Share this post


Link to post
Share on other sites

I think that it's because item or user (or both) are nil (i.e inexistant for the method) but I honestly have no idea on how you could fix that.

  • Like 1

Share this post


Link to post
Share on other sites

No problem thanks for the help  :)

 


 

Edit: Created a Custom Skill called "Life Root", Intended to Heal the Entire Party - except the User, who is KO'd by the Skill. "Life Root" increases incredibly by how low the User's HP is, Critically Low HP = Critically High Heal. This should be put under "HP Recover" Type Damage.

 

#--------------------------------------------------------------------------
#                    Life Root
#                    b.Life_Root(a,b,1.0)
#--------------------------------------------------------------------------
    def Life_Root(a,b, handicap)
        c = (1 - (a.hp / a.mhp.to_f).to_f) * (a.mhp / a.hp.to_f)
        d = (a.mhp - a.hp)
        a.hp -= a.hp.to_i
        (c * d) * handicap
    end

Examples of the Skill's Healing:

HP 75 / 400
                        Life Root: +1,408
HP 750 / 825
                        Life Root: +7
HP 20 / 775
                        Life Root: +22,801
HP 1 / 1000
                        Life Root: +998,001
HP 980 / 1000
                        Life Root: +0
HP 1 / 9999
                        Life Root: +99,960,004

 

The Skill comes with an adjustable Handicap for customization of the Skill: '1.0' is 100%. All of the above Skill Examples have a 1.0 Handicap

Edited by AJNR

Share this post


Link to post
Share on other sites

This thread as well as the original custom formulae thread are great.  Please keep this up.

  • Like 1

Share this post


Link to post
Share on other sites
  #--------------------------------------------------------------------------
  # * Determine default Transfusion formula
  #--------------------------------------------------------------------------
  # Restores target's HP equivalent to user's current HP, then the user dies.
  # USAGE EXAMPLE: b.transfusion(a, 
  #--------------------------------------------------------------------------
  def transfusion(a, 
    restore_amt = a.hp
    finaldamage = restore_amt
    a.hp -= a.hp
    finaldamage.to_i
  end

Here's the (not so popular) Blue Magic effect for Transfusion. It heals a party member's HP equivalent to the caster's current HP, and the caster immediately dies afterwards.

 

  #--------------------------------------------------------------------------
  # * Determine default Step Mine formula
  #--------------------------------------------------------------------------
  # Deals damage based on the number of steps the player has taken.
  # USAGE EXAMPLE: b.transfusion(a, 
  #--------------------------------------------------------------------------
  def step_mine(a, 
    num_steps = $game_party.steps
    stepdamage = num_steps / 32
    if stepdamage <= 1
      finaldamage = 1
    else
      finaldamage = stepdamage
    end
    finaldamage.to_i
  end

 

This one is really easy, but has a cool effect. It deals damage based on the number of steps the player has taken, just like Step Mine/Traveler from Final Fantasy VI/XII. I included a check to ensure that the minimum damage the ability can deal is 1 damage. Step Mine had a special effect in Final Fantasy VI where the MP cost was equal to the amount of minutes the game was played, divided by 30. Using Yanfly's Skill Cost Manager, users can re-create that MP cost for this ability, as well.

Edited by William C

Share this post


Link to post
Share on other sites
#--------------------------------------------------------------------------
#                    Penance
#                    b.Penance(a,b,1.5,"magical")
#--------------------------------------------------------------------------
    def Penance(a,b,power,type)
      case type
      when "physical"; (b.atk * 4 - a.def * 2) * power
      when "magical"; (b.mat * 4 - a.mdf * 2) * power
      when "both"; ((b.atk + b.mat) * 2 - (a.def + a.mdf)) * power
      end
    end

 

 

This is Penance, it's recommended for Characters that have attacks that self-inflict Offensive Debuffs, against Enemies who Buff themselves and against Bosses. This reverses the Default Attack Formula to deal more damage the stronger the Enemy is than the User. Edit: Fixed.

 


 

Created a different version of "Penance" - this one will flip the Formula if the User is stronger in the first formula and double the damage.

 

Penance v.B

#--------------------------------------------------------------------------
#                    Penance v.B
#                    b.Penance_b(a,b,1.5,"magical")
#--------------------------------------------------------------------------
    def Penance_b(a,b,power,type)
      c = (b.atk * 4 - a.def * 2) * power
      d = (b.mat * 4 - a.mdf * 2) * power
      e = ((b.atk + b.mat) * 2 - (a.def + a.mdf)) * power
      f = (a.atk * 4 - b.def * 2) * (power * 2)
      g = (a.mat * 4 - b.mdf * 2) * (power * 2)
      h = ((a.atk + a.mat) * 2 - (b.def + b.mdf)) * (power * 2)
      case type
      when "physical"
        if c <= 1
          a.hp -= f
          0
        else
          c
        end
      when "magical"
        if d <= 1
          a.hp -= g
          0
        else
          d
        end
      when "both"
        if e <= 1
          a.hp -= h
          0
        else
          e
        end
      end
    end
Edited by AJNR

Share this post


Link to post
Share on other sites
  #--------------------------------------------------------------------------
  # * Determine damage formula for "Souleater" Command Ability
  #--------------------------------------------------------------------------
  # This ability sacrifices 20% of the user's HP to deal damage based on the
  # user's current HP. It is stronger when the user has more HP.
  # USAGE EXAMPLE: b.souleater(a, 
  #--------------------------------------------------------------------------
  def souleater(a, 
    a.hp -= a.hp * 0.20
    basedamage = (a.atk * 5) + (a.level * 10) + (a.hp * 0.9)
    damagemod = basedamage.to_f
    finaldamage = damagemod.to_f
    finaldamage.to_i
  end

Replicated Souleater from Final Fantasy III. You may be more familiar with it by it's various other names, like Darkness or Darkwave. It eats a portion of the user's HP and deals damage based on the HP that remains. The most effective way to use this would be with Yanfly's Skill Cost Manager (make it cost 20% HP), as this code isn't taking into account a fatal usage of the skill (Yanfly's script disables the skill if the user doesn't have enough HP to survive it).

 

Some editing can make it standalone, though. Was just doing this one quick.

Share this post


Link to post
Share on other sites

g1335873246724378224.jpg

 

How would I get the amount of Buffs an Enemy has? I'm trying to get the "Punishment" Effect from Pokemon where the amount of Buffs the target has will increase the amount of damage. For example:

def Punishment(a,b,damage)
   buffs = b.added_buffs
    if buffs > 0
     c = buffs * damage
    else
     c = 0
   end
  c
 end


Edit:

And one more, how would I create the following skill:

If the Target's total parameters of 0-8 added together is greater than the User's total parameters added together - then the Party gains a State that increases all of their stats by 50%, if the User has more total parameters than the Target then the Target gains a State that increases all of it's stats (just that Target, not the Troop) by 50%

def True Balance
    m = 0
      6.times do |i|
        m += target.param(i+1)
      end
    return m
    l = 0
     6.times do |i|
        l += user.param(i+1)
      end
    return l
   if m > l
    game_party.add_state(0)
   elsif m == l
    0
   else
    b.add_state(0)
  end
 end
Edited by AJNR

Share this post


Link to post
Share on other sites

for the first one.

def Punishment(a,b,damage)
  buffs = 0
  for i in 0..7
    buffs += b.buffs[i]
  end
  damage * buffs
end

havent tested

 

for the second

 

 

class Game_BattlerBase

  #Total param of battler
  def param_total
    m = 0
      6.times do |i|
        m += param(i+2)
      end
    return m
  end
 
end

class Game_Battler < Game_BattlerBase  

  def True_Balance(a,
    if a.param_total > b.param_total
      if a.actor?
        $game_party.members.each do |i|
          i.add_state(0)
        else
        $game_troop.members.each do |i|
          i.add_state(0)
        end
    else
    b.add_state(0)
    end
 
end

 

havent tested this one either

Edited by Xypher
  • Like 1

Share this post


Link to post
Share on other sites

def atlas_armlet(a, 
  if a.armors.include?($data_armors[1])
    damage = YOUR FORMULA * 1.5
  else
    damage = YOUR FORMULA
  end
  damage.to_i
end
Just a little method that can check the user's equipment and change the damage output based on what is worn. Useful for having accessories that directly multiply damage, rather than increasing stats or using passive states.

 

In this example, if the actor has armor ID 1 equipped, the damage is increased by 50%.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted