A help with this script

Hy there
I just find this script:
#--------------------------------------------------------------------------
# * Determine default Goblin Punch formula [allies]
#--------------------------------------------------------------------------
def goblin_punch(a,
basedamage = a.level
if a.level == b.luk # Feel free to swap Luck for any other stat
actualdamage = (basedamage.to_i + a.level) * a.level
else
actualdamage = basedamage.to_i + a.level
end
actualdamage.to_i
end

i found it in this post: https://www.rpgmakercentral.com/topic/18183-custom-damage-formulae-archive/

I created the skill... however it give's this error
Error.png


Can you able to find the problem? Thank you
because it's missing an ")" and while i dont know RGSSx,
My guess its behind a.level) before the 1st "if" statement
I though it looked wrong.
I checked the site from the internet archive and the template script should look like this.
Spoiler: Custom Damage Formulas
Ruby:
  module Custom_Damage_Formulae
    class Game_Battler < Game_BattlerBase
#=======================================================================================
#                              Antipode Tempest Skill Formula
#              'b.xstat.Arm' is a custom term from Nelderon's N.A.S.T.Y Stats
#=======================================================================================
  def Antipode_Tempest(a, b)
     basedamage = ((a.mat * 8) * (v[150]/100.to_f)) - b.xstat.Arm * (a.mat / b.mdf.to_f)
     actualdamage = basedamage
     actualdamage
  end
#=======================================================================================
#                              Reverent Defense Skill Formula
#
#=======================================================================================
  def Reverent_Defense(a, b)
     c = ($game_party.alive_members.count / $game_troop.alive_members.count.to_f)
     basedamage = if c>=3; a.add_state(40); elseif c==2; a.add_state(41); else; a.add_state(42);end
     actualdamage = basedamage
     actualdamage
  end
#=======================================================================================
#                               Example Skill 03
#
#=======================================================================================
   def Example_Skill_03(a, b)
     basedamage = (a.atk * 4) - (b.def * 2)
     actualdamage = basedamage
     actualdamage
   end
#=======================================================================================
#                               Example Skill 04
#
#=======================================================================================
   def Example_Skill_04(a, b)
     basedamage = (a.atk ** 3) - (b.def ** 2)
     actualdamage = basedamage
     actualdamage
   end
end
end
Notice how the def ends with (a, that is incorrect.
It needs to be more. Such as (a, b)
Your code should be
Ruby:
  def goblin_punch(a, b)
    basedamage = a.level
    if a.level == b.luk # Feel free to swap Luck for any other stat
      actualdamage = (basedamage.to_i + a.level) * a.level
    else
      actualdamage = basedamage.to_i + a.level
    end
    actualdamage.to_i
  end
I though it looked wrong.
I checked the site from the internet archive and the template script should look like this.
Spoiler: Custom Damage Formulas
Ruby:
  module Custom_Damage_Formulae
    class Game_Battler < Game_BattlerBase
#=======================================================================================
#                              Antipode Tempest Skill Formula
#              'b.xstat.Arm' is a custom term from Nelderon's N.A.S.T.Y Stats
#=======================================================================================
  def Antipode_Tempest(a, b)
     basedamage = ((a.mat * 8) * (v[150]/100.to_f)) - b.xstat.Arm * (a.mat / b.mdf.to_f)
     actualdamage = basedamage
     actualdamage
  end
#=======================================================================================
#                              Reverent Defense Skill Formula
#
#=======================================================================================
  def Reverent_Defense(a, b)
     c = ($game_party.alive_members.count / $game_troop.alive_members.count.to_f)
     basedamage = if c>=3; a.add_state(40); elseif c==2; a.add_state(41); else; a.add_state(42);end
     actualdamage = basedamage
     actualdamage
  end
#=======================================================================================
#                               Example Skill 03
#
#=======================================================================================
   def Example_Skill_03(a, b)
     basedamage = (a.atk * 4) - (b.def * 2)
     actualdamage = basedamage
     actualdamage
   end
#=======================================================================================
#                               Example Skill 04
#
#=======================================================================================
   def Example_Skill_04(a, b)
     basedamage = (a.atk ** 3) - (b.def ** 2)
     actualdamage = basedamage
     actualdamage
   end
end
end
Notice how the def ends with (a, that is incorrect.
It needs to be more. Such as (a, b)
Your code should be
Ruby:
  def goblin_punch(a, b)
    basedamage = a.level
    if a.level == b.luk # Feel free to swap Luck for any other stat
      actualdamage = (basedamage.to_i + a.level) * a.level
    else
      actualdamage = basedamage.to_i + a.level
    end
    actualdamage.to_i
  end

Now I got this problem here:
Error 01.png
Now I got this problem here:
View attachment 138986
Never Mind... The error is myne and I already solved. However the damage is resulted 0. I just put in the formula box this: b.goblin_punch. Where's the error?
b.goblin_punch. Where's the error?
It should be b.goblin_punch(a,b)
Now I got this error:
Lunatic damage error.png


I removed the script and now I got this one:
Another error.png

How should I resolve?
Screenshot your code, put it here.
Never mind the two errors. It's just the damage is somehow resulted with 0. How's that possible?
Here:
#--------------------------------------------------------------------------
# * Determine default Goblin Punch formula [allies]
#--------------------------------------------------------------------------
def goblin_punch(a, b)
basedamage = a.level
if a.level == b.luk
actualdamage = (basedamage.to_i + a.level) * a.level
else
actualdamage = basedamage.to_i + a.level
end
actualdamage.to_i
end
Are you using this specific skill for the enemy attack?
Are you using this specific skill for the enemy attack?

No...
Alright so I actually looked up at the actual thread reference you linked above and I don't know why
Code:
  module Custom_Damage_Formulae
    class Game_Battler < Game_BattlerBase
is even necessary.

Now, try to create a script slot and put only this code and nothing else.
Code:
def goblin_punch(a, b)
  basedamage = a.level
  if a.level == b.luk
    actualdamage = (basedamage.to_i + a.level) * a.level
  else
    actualdamage = basedamage.to_i + a.level
  end
  return actualdamage.to_i
end

And in your formula, instead of b.goblin_punch(a,b) do this instead --> goblin_punch(a,b)

See if that makes a difference.
It deal damage... thank you
And in your formula, instead of b.goblin_punch(a,b) do this instead --> goblin_punch(a,b)
I was wondering about that. Interesting how most of the calls have an 'a' or 'b' in front. Is that because it was a module, but that's not required if it is a class?
I was wondering about that. Interesting how most of the calls have an 'a' or 'b' in front. Is that because it was a module, but that's not required if it is a class?
Because most of the examples on the internet need you to put the custom formula in Game_Battler. To use the formula, you need an instance of them in which 'a' and 'b' is the instance of Game_Battler(s) whether it is an actor or enemy. Hence you need to put 'a' or 'b' in front of them. If you put the method outside anything, you can just call it everywhere.

Now that said, the topic linked in this topic opening is misleading. The example given is that Game_Battler class but inside the module Custom_Damage_Formulae. Game_Battler inside the module is not the same as Game_Battler you have from the default script. Because it has its own namespace.

Consider
Code:
module Namespace
  class Game_Battler < Game_BattlerBase
  end
end

class Game_Battler
end
Both Game_Battler are totally different class altogether. One you can just reference it only by using Game_Battler, one another you need to put the namespace in front of it, so Namespace::Game_Battler
I think I got it.
Any damage formulas put in Game_Battler needs to be called with an 'a' or 'b' in front. But any formulas outside Game_Battler does not need it.

Reworking the formulas now.

Original thread: https://forums.rpgmakerweb.com/threads/a-help-with-this-script.119889/