How to change LUK's default formula?

The RPG Maker reference manual contains the following note:

The change in states and debuff effectiveness due to luck is as shown below. Note, however, that 0 is the lower limit. 

Chance (%) = 100 + (user's luck - target's luck) ÷ 10 

I would like to know how I can change this formula. I want to retain LUK's purpose of altering the chance of states working / not working, but I just want to alter the formula a bit.
I *think* you can do this by altering the formula in the script editor.
I *think* you can do this by altering the formula in the script editor.
Any idea where exactly the formula is in the script editor?
Here it is:

luk.png

(I copied all the default scripts into a single text file so I could search for things like this.)
Here it is:

attachicon.gif
luk.png

(I copied all the default scripts into a single text file so I could search for things like this.)
Thank you, gonna mess around with the formula and see if I can get it to work as I want.

Edit: I may have spoken too soon, that formula contains a few strange looking parts. Would anybody happen to know how I can alter this formula so that if a battler has 10 LUK, the chance of inflicting a status condition is increased by 10%?
Try

(1.0 + user.luk * 0.01, 0.0).maxIt's probably unnecessary to leave the minimum of 0 in there with no subtraction, but I prefer to leave safeguards in place unless given a good reason to remove them.

My ruby isn't great yet, but I'll do my best to break the original formula down for you, in case you want to make more changes.

1.0 is the base chance of 100%. The chance entered in the database will effectively modify this value.

user.luk is the luck of the character who is using the skill, weapon, or whatever.
 

luk is the luck of the creature being targeted. The defender.

0.001 divides the luck by 1000, so that each luck point gives a one-tenth of one percent change to the overall success rate.

, 0.0).max specifies a minimum of 0. If the first option before the comma (the formula) is less than the second option after the comma (the 0.0), the game will use the 0.0 instead, as it is higher (the maximim value). This stops the game from ending up with a negative value where it could lead to an error.

Unless I'm missing something, which I may be. Like I said, I'm fairly new to ruby.
Try

(1.0 + user.luk * 0.01, 0.0).max
Unfortunately this formula doesn't seem to be working. I tested it by making a skill with a 1% chance to inflict a status condition and making the LUK stat of the user 100. I can't help but feel as if the formula is on to something, though.

Edit: Btw, the formula apparently needs brackets instead of parentheses or else it causes a crash.
I was curious about that. Apparently the formula is multiplicative by default, so while you are technically increasing the chance by 100%, it ends up as improving that 1% to 2% (twice as big, i.e. 100% larger)

I'll see if I can track down where the formula is called from to make it additive instead.

Edit: Got it.

LukFormulaCall.png

Change *= to += , then go back to the base formula and change it to:

(0.0 + user.luk * 0.01, 0.0).maxThat should work as you intend.

Sounds like you want luck to feel very useful. *nodnod* I approve.
I was curious about that. Apparently the formula is multiplicative by default, so while you are technically increasing the chance by 100%, it ends up as improving that 1% to 2% (twice as big, i.e. 100% larger)

I'll see if I can track down where the formula is called from to make it additive instead.
I know virtually nothing about ruby syntax. Is the asterisk what causes the multiplicative behavior?
Aye, * means multiply, as you should be able to confirm in the default damage formulas. It's how I learned it.
Aye, * means multiply, as you should be able to confirm in the default damage formulas. It's how I learned it.
Ah, I see. Also, I have one more question before I test out the new formula. Your screenshot shows the section of the script that seems to handle applying status effects to normal attacks. Right below that section is another section titled: "[Add State] Effect: Normal" that has a similar layout as the normal attack handling section. Should I change the asterisk to a "+" there as well?
Should I change the asterisk to a "+" there as well?
Oops! Yes, very much so. Sorry about that, I should have paid more attention.

Edit: There's one in Debuff too, line 653. There's no = this time, just change * to +.
Oops! Yes, very much so. Sorry about that, I should have paid more attention.
Heh, it's not a problem. However, what is a problem is the fact that despite me saying that my last question was supposed to be my last question, I have yet another question. Is it possible to alter the current variation of the formula to make it so that the target's LUK value is subtracted from the chance of success for the state infliction? For example, let's say I have a skill that has a 15% chance to inflict a state and the user has 20 LUK. With the current formula, the chance of success would be 35%, but is it possible to make it so that if the target has 10 LUK, the chance is reduced to 25%?
No problem. And certainly, just put the subtraction from the original version back in, like so:

(0.0 + (user.luk - luk) * 0.01, 0.0).maxEdit: However, this will not allow a target with very high luck to reduce the success rate below the database default. To do that, you'd need to remove the safeguard on the formula and modify the calls again instead, to make sure it can't drop anything below zero.
No problem. And certainly, just put the subtraction from the original version back in, like so:

(0.0 + (user.luk - luk) * 0.01, 0.0).max
Now that I think about it, that should have been obvious, but thank you very much for helping me with the formula. Now, when I look at a character's LUK stat, I'll be able to acknowledge it as something useful instead of grimacing at its uselessness.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-change-luks-default-formula.45331/