LUCK, and how state/buff/debuff application chance works.

N-Amata

Percarus
Veteran
Joined
Nov 10, 2017
Messages
38
Reaction score
14
First Language
Filipino
Primarily Uses
RMMV
The Luck stat had always been vague- within the editor, it is described as "Affects the chance of things like status ailments occurring." All well and good, it can be assumed then that Luck applies to the application of Buffs, Debuffs, and Status Effects.

Here is my question: is there a definitive formula on how exactly it affects it? How does the probability in a skill's "Effects" tab interact with it?
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
489
Reaction score
701
First Language
German
Primarily Uses
RMMV
First off, I am not sure if luk affects buffs and debuffs. I think they are always 100%.

In rpg_objects there is a function called lukEffectRate which determines how luk changes the probability of inflicting states.

JavaScript:
Game_Action.prototype.lukEffectRate = function(target) {
    return Math.max(1.0 + (this.subject().luk - target.luk) * 0.001, 0.0);
};

Translating this to "RPG Maker language", it would look something like this:

Math.max(1.0 + (a.luk - b.luk) * 0.001, 0.0)

Don't mind the Math.max, it just ensures that the %-Chance does not go below 0%.
We go with this instead:

1 + (a.luk - b.luk) * 0.001

The result of this formula is the modifyer for the state chance.

As an example:
You have a 40% chance of inflicting burn with a skill
You have 100 Luck
The enemy has 20 Luck.

0.4 * (1 + (100 - 20) * 0.001)
= 0.48
= 0.432

So the chance to ACTUALLY inflict burn is 48% 43.2%.
 
Last edited:

N-Amata

Percarus
Veteran
Joined
Nov 10, 2017
Messages
38
Reaction score
14
First Language
Filipino
Primarily Uses
RMMV
First off, I am not sure if luk affects buffs and debuffs. I think they are always 100%.

In rpg_objects there is a function called lukEffectRate which determines how luk changes the probability of inflicting states.

JavaScript:
Game_Action.prototype.lukEffectRate = function(target) {
    return Math.max(1.0 + (this.subject().luk - target.luk) * 0.001, 0.0);
};

Translating this to "RPG Maker language", it would look something like this:

Math.max(1.0 + (a.luk - b.luk) * 0.001, 0.0)

Don't mind the Math.max, it just ensures that the %-Chance does not go below 0%.
We go with this instead:

1 + (a.luk - b.luk) * 0.001

The result of this formula is the modifyer for the state chance.

As an example:
You have a 40% chance of inflicting burn with a skill
You have 100 Luck
The enemy has 20 Luck.

0.4 * 1 + (100 - 20) * 0.001
= 0.48

So the chance to ACTUALLY inflict burn is 48%.
This is amazing- really cleared up a lot of things. Thanks so much!
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
6,018
Reaction score
5,667
First Language
English
Primarily Uses
RMVXA
First off, I am not sure if luk affects buffs and debuffs. I think they are always 100%.

In rpg_objects there is a function called lukEffectRate which determines how luk changes the probability of inflicting states.

JavaScript:
Game_Action.prototype.lukEffectRate = function(target) {
    return Math.max(1.0 + (this.subject().luk - target.luk) * 0.001, 0.0);
};

Translating this to "RPG Maker language", it would look something like this:

Math.max(1.0 + (a.luk - b.luk) * 0.001, 0.0)

Don't mind the Math.max, it just ensures that the %-Chance does not go below 0%.
We go with this instead:

1 + (a.luk - b.luk) * 0.001

The result of this formula is the modifyer for the state chance.

As an example:
You have a 40% chance of inflicting burn with a skill
You have 100 Luck
The enemy has 20 Luck.

0.4 * 1 + (100 - 20) * 0.001
= 0.48

So the chance to ACTUALLY inflict burn is 48%.
Nicely presented, but not quite accurate. What you missed is that the lukEffectRate is a multiplier for the base chance - it is not added to the base chance. You can see this in the methods itemEffectAddAttackState and itemEffectAddNormalState (they may have different names in MV; I am looking at the MZ code but I am certain the mathematical mechanics are similar between MV and MZ).

In other words, if the skill normally has a 40% chance to inflict burn, the modified chance will be 40% * (1 + ((100 - 20) * 0.001)) = 40% * 1.08 = 43.2% chance to inflict burn. As you can see, the effect of LUK is very minimal, which is why you'd want to either use it on other places (eventing, skill formulas) or just leave it out of your game entirely.

Also, lukEffectRate is not applied on any skill designated as a "Certain Hit" skill (which makes sense, as you wouldn't want it to affect, for example, a healing state given to an ally).

It looks like itemEffectAddDebuff is affected by lukEffectRate too, meaning that Debuffs (but not buffs) are affected by LUK of the user and opponent target.
 

N-Amata

Percarus
Veteran
Joined
Nov 10, 2017
Messages
38
Reaction score
14
First Language
Filipino
Primarily Uses
RMMV
Nicely presented, but not quite accurate. What you missed is that the lukEffectRate is a multiplier for the base chance - it is not added to the base chance. You can see this in the methods itemEffectAddAttackState and itemEffectAddNormalState (they may have different names in MV; I am looking at the MZ code but I am certain the mathematical mechanics are similar between MV and MZ).

In other words, if the skill normally has a 40% chance to inflict burn, the modified chance will be 40% * (1 + ((100 - 20) * 0.001)) = 40% * 1.08 = 43.2% chance to inflict burn. As you can see, the effect of LUK is very minimal, which is why you'd want to either use it on other places (eventing, skill formulas) or just leave it out of your game entirely.

Also, lukEffectRate is not applied on any skill designated as a "Certain Hit" skill (which makes sense, as you wouldn't want it to affect, for example, a healing state given to an ally).

It looks like itemEffectAddDebuff is affected by lukEffectRate too, meaning that Debuffs (but not buffs) are affected by LUK of the user and opponent target.
Ohhh I see. Thanks for the clarification! Is there a way to modify this lukEffectRate to make it more impactful status effects-wise?
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
489
Reaction score
701
First Language
German
Primarily Uses
RMMV
What you missed is that the lukEffectRate is a multiplier for the base chance - it is not added to the base chance

Ah, yes. I did miss that. I even had that in my formula, but for some reason I added it instead of multiplied it. Edit: No I did not add it, instead I forgot to put another () in the right place. I just punched the formula into a calculator and got a wrong result.

It should have been
0.4 * (1 + (100 - 20) * 0.001)
not
0.4 * 1 + (100 - 20) * 0.001


I was wondering why the increase was 8% considering luck was never that impactful to begin with.
I corrected my first post.
 
Last edited:

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
669
Reaction score
292
First Language
english
Primarily Uses
RMMV
Ohhh I see. Thanks for the clarification! Is there a way to modify this lukEffectRate to make it more impactful status effects-wise?
some plugins can allow you to change the formula used. would also be able to change the formula in the rpg_objects base code but im no good with that stuff, so i just use yanfly's baseparam control plugin to change it from the plugin parameters.
(i changed "luck effect" so it just says "1" making luck have no effect at all on state rates so i could rename luck and use it however i wanted without it effecting anything else and state rates became just flat database apply/resist rates.)
 

N-Amata

Percarus
Veteran
Joined
Nov 10, 2017
Messages
38
Reaction score
14
First Language
Filipino
Primarily Uses
RMMV
some plugins can allow you to change the formula used. would also be able to change the formula in the rpg_objects base code but im no good with that stuff, so i just use yanfly's baseparam control plugin to change it from the plugin parameters.
(i changed "luck effect" so it just says "1" making luck have no effect at all on state rates so i could rename luck and use it however i wanted without it effecting anything else and state rates became just flat database apply/resist rates.)
Thank you for your responses friend, I appreciate it a lot :)
I'll make sure to take note of that.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,789
Reaction score
14,594
First Language
English
Primarily Uses
RMVXA
It would take a plugin to change it. I actually changed it in my last game to be (this is not in Javascript code, just psuedocode, FYI):

* 1.014^(your luck - enemy luck).

The ^ is raise to power. The result was that a difference of 50 LUK now returned about 2, which meant your chance had doubled.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
6,018
Reaction score
5,667
First Language
English
Primarily Uses
RMVXA
Ohhh I see. Thanks for the clarification! Is there a way to modify this lukEffectRate to make it more impactful status effects-wise?
You would need to either do it with a mini-plugin of your own, someone else's plugin, or by making a small change to the code in your project's js folder (I think you're looking for rpg_objects.js). Making that small code change is actually really easy - for example you could make Luck's effect on status application ten times as impactful by replacing 0.001 with 0.01 in the method that @ScorchedGround pasted earlier, and that's all you need to do. However, it is usually advised to use a plugin instead because if you update the core scripts, your changes may be reverted, and it can be a little wonky if other plugins that you use are also modifying the same method.
 

N-Amata

Percarus
Veteran
Joined
Nov 10, 2017
Messages
38
Reaction score
14
First Language
Filipino
Primarily Uses
RMMV
Thanks so much for the replies, my curiosities have been satisfied and confusions have been erased :)
 

Latest Threads

Latest Posts

Latest Profile Posts


concept: zombie slayer fest.

Lag because of outdated hardware.

Lots todo:
-Terrax lightning should have another step for the flashlight, between up down left right.
-Also Online mv from Nelderson should emit the flashlight from the other player.
-Animation needed for killing the zombie...
Before adding it to #crypchania.
Working on a case. Get all the evidence to prosecute some bad guys. :kaojoy:
But, the game development schedule delayed. :kaoswt2:
The moral of the story: No good deed goes unpunished... I guess...
Except that, nothing to see here. :kaoswt2:
just beat ff7 original for the first time since 2010. having played remake last year, I have a much better appreciation for the original oddly enough. I still like some of the character presentation in remake more, but the original's got a lot going for it.
Ever reach that moment in your life when your juggling a dozen or more projects that you know will never be made but don't have the heart to delete them? Ugh, I hate those moments...
:kaosigh: Why must you hurt me so?

Forum statistics

Threads
111,451
Messages
1,061,206
Members
144,818
Latest member
OMEGASS
Top