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

N-Amata

Percarus
Veteran
Joined
Nov 10, 2017
Messages
36
Reaction score
13
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
476
Reaction score
687
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
36
Reaction score
13
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,003
Reaction score
5,644
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
36
Reaction score
13
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
476
Reaction score
687
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
662
Reaction score
284
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
36
Reaction score
13
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,787
Reaction score
14,582
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,003
Reaction score
5,644
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
36
Reaction score
13
First Language
Filipino
Primarily Uses
RMMV
Thanks so much for the replies, my curiosities have been satisfied and confusions have been erased :)
 

Latest Profile Posts

I wish I can work faster on my game. But I don't want to get burned out. :(
I've been working on something on and off for a few years now, and I've been reluctant to share any details on the project before I had anything playable because I did not want to generate hype only for the project to go back on hiatus. That being said I believe what I'm working on is very unique and pushes the boundaries of what RPG Maker projects can be. Bold claims, I know but just wait.
Happy Mother's Day to all the moms :)
Create Anime Art w/ AI, Tall Sprites with Aurora, Customize Variable Display | RPG Maker News #34

[My favorite slow moving track I've made so far]

Forum statistics

Threads
111,196
Messages
1,059,201
Members
144,445
Latest member
thegr8gibsoni
Top