I've heard that luck doesn't really effect status chance that much and I want to change that for my game. Does anyone know how I can buff the luck stat through plugins? I want it to just increase the chance of status effects being inflicted but better than it already is. If there isn't really a way or if its simpler, can somebody give me details on how luck affects statuses?
How do I buff luck's effect?
RPG Maker MZ SupportThe default settings for luck are hard coded in rmmz_objects.js:
So having a luck difference of 100 would result in a factor of 0.1 difference in susceptibility or resistance. In other words if the default success rate of a certain ability is 50%, it would increase to 55% or decrease to 45%. Which is admittedly not really noticeable.
You can overwrite this by changing the "0.001" portion, and loading it as a plugin, e.g.:
JavaScript:
Game_Action.prototype.lukEffectRate = function(target) {
return Math.max(1.0 + (this.subject().luk - target.luk) * 0.001, 0.0);
};
So having a luck difference of 100 would result in a factor of 0.1 difference in susceptibility or resistance. In other words if the default success rate of a certain ability is 50%, it would increase to 55% or decrease to 45%. Which is admittedly not really noticeable.
You can overwrite this by changing the "0.001" portion, and loading it as a plugin, e.g.:
JavaScript:
(function () {
Game_Action.prototype.lukEffectRate = function (target) {
return Math.max(1.0 + (this.subject().luk - target.luk) * 0.01, 0.0);
};
})();
Nice thanks for helping me again, I'll find a way to test this plugin out.
By the way what is a good way to test this plugin?
Okay, I'm definitely NOT the right person to ask that, since I test software for a living and I take these questions too seriously😊👋.
It depends on to what degree you want to test...
It depends on to what degree you want to test...
For testing purposes you could add a
Then during test, press F8 (or F12) to open the dev tools window and check the values that get logged to the Console tab of that window.
As @werzaque implies, choosing test cases/scope/etc is another matter. In this case any numerical result should be OK: the core scripts only ever use it as a multiplier for random check thresholds.
console.log to the plugin, e.g.
JavaScript:
/*:
* @target MZ
* @url https://forums.rpgmakerweb.com/threads/161242/
*/
Game_Action.prototype.lukEffectRate = function (target) {
const a = this.subject();
const b = target;
const r = Math.max(1.0 + (a.luk - b.luk) * 0.01, 0.0);
console.log(`lukEffectRate for ${a.name()} (${a.luk}) vs ${b.name()} (${b.luk}) is: ${r}`);
return r;
};
As @werzaque implies, choosing test cases/scope/etc is another matter. In this case any numerical result should be OK: the core scripts only ever use it as a multiplier for random check thresholds.
What do you need to test?
If you want to test that the plugin has loaded and the code is running, you can press F8, look at the Console tab, and make sure there are no errors about the plugin loading.
If you want to test what it does...it's just math. Put numbers into a calculator or spreadsheet and see what the odds of doing various things at various levels are.
Or playtest the game and see if you like how it feels.
I added your code Caethyril but nothing showing up on the console
OK, here are some things to check:
- Have you saved it as a .js file and imported it as a plugin, through the Plugin Manager?
- Have you saved your project to apply Plugin Manager changes before testing?
- Are you doing something that should be checking the luck effect? E.g. use a skill or item that is not Certain Hit, and has at least one Add State or Add Debuff effect.
Changing attack to physical worked, completely forgot about that option, can see the stuff now. Thanks!
Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-buff-lucks-effect.161242/