Adding user's luck to critical damage

Hi,

I'm trying to make it so that the player's luk parameter gets added to the damage whenever he lands a critical hit on an enemy.

I first tried changing the formula for "Apply Critical" in Game_Battler to "damage + luk", but I noticed that this added the target's luck value, not the user's.

I then tried changing the formula to "damage + user.luk" but then, whenever I landed a critical, I returned an error message saying 'undefined local variable or method 'user'

Wondering how I can accomplish this?  Thanks in advance.
Well if you don't mind using script both Victor and Yanfly have scripts that do this:

https://yanflychannel.wordpress.com/rmvxa/core-scripts/extra-param-formulas/

Victor's can be found by going to his website and following the instructions.
Unless I'm missing something, Yanfly's script only allows the modification of the critical chance formula.  I want to change the critical damage formula.

So like say player has 10 attack and 5 luck, and enemy has 2 defense.

If my damage formula is a.atk - b.def, I want attacks to do 8 dmg normally, but then 13 damage whenever landing a critical hit.
My formulae edit might help:

http://forums.rpgmakerweb.com/index.php?/topic/23113-doublex-rmvxa-formulae-edit/?hl=formulae

For example, to set the critical damage applied to enemies to be original damage * (3 + enemies' luk / 999), set:

(For enemies meaning the users and the targets are of the opposite side)

Cri_Enemy = "damage *= 3 + luk / 999(For enemies meaning a troop member and all battlers being either actor or enemy)

Cri_Dmg = "actor? ? eval(DoubleX_RMVXA::Formulae_Edit::Cri_Ally) : eval(DoubleX_RMVXA::Formulae_Edit::Cri_Enemy)"Cri_Enemy = "damage *= 3 + luk / 999Although you may need little scripting knowledge to set your desired critical damage formula, you can ask me if you need help 🙂

Original thread: https://forums.rpgmakerweb.com/threads/adding-users-luck-to-critical-damage.38403/