Turning luck into a different attribute?

So, I'm wondering if there is any way to turn Luck into a different attribute, namely something that can have a direct influence in battle. I considered a variable but I think variables CANNOT be used in damage formulas, am I wrong?

What would the downsides to this be?
I think this ENTIRELY depends on the context of your game...!! So I cannot be so sure what to tell you.

But I can give you my experience if it helps you.


In my 1st game, I decided to use Luck as a means of evading an attack that could be delivered by the only real "enemy" used in the RPG Battle System. (The 1st game was more centered around exploration and puzzle solving).
The way I would use Luck is to say if you had more Luck, then the higher chance the attack would fail, so it was a priority to find Lucky Items by doing other things before the main dungeon.

None of the other stats were used tho.

On the other hand, as I develop this 2nd game that actually has battles integrated into main gameplay, I find that Luck can be really really helpful when determining critical hits and evasion, which I really like because that sort of thing can be really tactically beneficial for a party member who's primary power is not directly attacking. But that's just me.


Now, to answer your main question, variables CAN and SHOULD be used because it can make damage output really interesting, and dynamic for your game. It's just a matter of coming up with some unique input or approach. But if you really plan out who can do what, what levels, etc....I think you can really come up with something unique to make it fun.
(For instance, instead of basing an attacker's attack on attack power, why not make it to where it's based on Luck? Then giving them an ability to boost their own luck....that's 1 idea)
you are wrong with all your assumptions.

nothing stops you to use luck in the same way as you use attack, defense or whatever in any damage formula.

If I remember correctly the short is luk, which means a.luk is the skill user luck and b.luk is the target luck value.
Anything can be used in damage formulas, including variables. They're just not as convenient to access as stats like a.atk or b.def, so you'd have to use something like $gameVariables.value(13) to access variable #0013. But nothing stops you from just renaming luck to whatever you want and use it in your damage formulas (a.luk or b.luk) however you wish.

From what I've seen, luck appears to mostly affect debuffs and adding states, but writing a plugin that disables it should be easy enough.
Anything can be used in damage formulas, including variables. They're just not as convenient to access as stats like a.atk or b.def, so you'd have to use something like $gameVariables.value(13) to access variable #0013. But nothing stops you from just renaming luck to whatever you want and use it in your damage formulas (a.luk or b.luk) however you wish.

From what I've seen, luck appears to mostly affect debuffs and adding states, but writing a plugin that disables it should be easy enough.
that was my worry in fact, but if I can use variables in Damage Formulas, then I guess I could leave luck where it is and simply create a new one! Could you tell me where to look for how?

Would I be able to assign this new variable value to monsters as well?
Could you tell me where to look for how?
the damage formula is nothing but a javascript eval. any function available as a script call can be used in the damage formula. just look up the script equivalents of event commands, that is a pinned list for each maker.

Would I be able to assign this new variable value to monsters as well?
only in the same way as you use the variables in eventing.
which means they keep the last value assigned until you change them, they do NOT update automatically.
that was my worry in fact, but if I can use variables in Damage Formulas, then I guess I could leave luck where it is and simply create a new one! Could you tell me where to look for how?

I'm not sure what you mean by "where to look for how", but everything you need to know about the RPG Maker engine is located in the .js files in the /js folder of your project.

Specifically, damage formulas are evaluated in Game_Action.prototype.evalDamageFormula() found in the rmmz_objects.js file:
JavaScript:
Game_Action.prototype.evalDamageFormula = function(target) {
    try {
        const item = this.item();
        const a = this.subject(); // eslint-disable-line no-unused-vars
        const b = target; // eslint-disable-line no-unused-vars
        const v = $gameVariables._data; // eslint-disable-line no-unused-vars
        const sign = [3, 4].includes(item.damage.type) ? -1 : 1;
        const value = Math.max(eval(item.damage.formula), 0) * sign;
        return isNaN(value) ? 0 : value;
    } catch (e) {
        return 0;
    }
};

And just now I realized that you actually do have convenient access to variables in damage formulas, through v[x] (where x is a number that represents the ID of the variable, for example v[42] for variable #0042)

Would I be able to assign this new variable value to monsters as well?

Yes, you could. But I'm guessing you'd want every monster to have its own unique value, so using a new variable for each monster could be a lot of work. It'd be a lot more manageable to put the value in a notetag, but accessing the value in the notetag is going to be a bit of a pain.

I'm sure there must be a plugin somewhere that allows to store values in a notetag on enemies that can then easily be retrieved from within a damage formula, but I don't really know much about plugins except for the ones I make myself.
that was my worry in fact, but if I can use variables in Damage Formulas, then I guess I could leave luck where it is and simply create a new one! Could you tell me where to look for how?

Would I be able to assign this new variable value to monsters as well?

I think you are overcomplicating things. The best thing for what you want would be to rename luck, and use the renamed luck stat in your formulae. Variables are not the same as attributes -- they don't have different values per monster.
If you're using visustella battle core, you also have access to damage style formulas. You have the premade default ones and you can create new ones.
Damage styles can be applied to all or individual users.
Visustella Damage Settings
I am indeed using visustella, but I'm not sure I understand what I'm meant to do with damage settings.
I am indeed using visustella, but I'm not sure I understand what I'm meant to do with damage settings.
I feel like some answers and advice are veering off track because we're not sure what you're trying to do at this point.

Your original post asked about changing Luck into something that can be used directly in battle (which it already can, per post 3).

It also asked about variables - and I don't see what that has to do with Luck - but you can also use variables in damage formulae via the v[n] notation (all of this comes from mousing over the damage formula box and looking at the MZ help file).

So at this point, does the above information answer your original question? You've had some more options thrown at you by Nolonar, but it seems like you might be getting more confused.

If this doesn't answer your original question, perhaps you can re-articulate it so we understand better what you're going for.
So, my original point was, incorrectly worded, about LUK having a more tangible effect in the game combat, more than its status chance effect. It is possible but it might have unintended consequences.

So then I asked about using a variable in damage formulas, which you said it is possible, but that there is no easy way to add that same variable to enemies in the engine, as Notetags aren't possible and it would require heaving scripting.

Lastly, I asked what the point about Visustella was, I guess to change the default formulas?
So, my original point was, incorrectly worded, about LUK having a more tangible effect in the game combat, more than its status chance effect. It is possible but it might have unintended consequences.
Why? What consequences? I don't know what you mean here.

So then I asked about using a variable in damage formulas, which you said it is possible, but that there is no easy way to add that same variable to enemies in the engine, as Notetags aren't possible and it would require heaving scripting.
Why? If you need an additional parameter (I still don't get why you wouldn't just use Luck), there's a very easy way to add it to enemies. Make a Turn 0 troop event that sets the value on each member of the troop. It does require use of the Script box, but setting a variable equal to a value is about as simple as code gets 😉

Lastly, I asked what the point about Visustella was, I guess to change the default formulas?
I looked at the documentation and it seems pretty straightforward to me - it replaces the need for you to enter damage formulae for your skills with preformulated ones. I'm not sure that's super helpful to your original question.
The only possible "unintended consequence" of using luck in damage formulae is that it will also have its default effect on state application, so you can't, for example, give one actor more luck than another without having their ability to inflict states going along with it.

Fortunately, the default effect on state application is tiny, and you would never even notice it's there. But you can write or install a plugin to remove the default effect, if you want to be absolutely sure.
Fortunately, the default effect on state application is tiny, and you would never even notice it's there. But you can write or install a plugin to remove the default effect, if you want to be absolutely sure.
That doesn't sound like a terrible idea, thanks.
I looked at the documentation and it seems pretty straightforward to me - it replaces the need for you to enter damage formulae for your skills with preformulated ones. I'm not sure that's super helpful to your original question.
Yes, but my idea would require an alteration of the original default formula so I think I'll have to look in the JS default settings itself - maybe even save it somewhere just in case 🙂 One thing is unclear however: can I overwrite that parameter if I use one of my own formulas for special attacks?
(I still don't get why you wouldn't just use Luck)
Why? What consequences? I don't know what you mean here.
It's what @Aoi Ninami said, I didn't want to mess too much with the states, but if the chance is that tiny, I think I don't need to bother.
Yes, but my idea would require an alteration of the original default formula so I think I'll have to look in the JS default settings itself - maybe even save it somewhere just in case 🙂 One thing is unclear however: can I overwrite that parameter if I use one of my own formulas for special attacks?
Sorry, but I don't understand what you're asking here. If you're talking about damage formulae, why not just type your own into the damage formula box and incorporate a.luk or whatever as desired?

It's what Aoi Ninami said, I didn't want to mess too much with the states, but if the chance is that tiny, I think I don't need to bother.
Yes, it's for all intents and purposes worthless.
Sorry, but I don't understand what you're asking here. If you're talking about damage formulae, why not just type your own into the damage formula box and incorporate a.luk or whatever as desired?
VS battle core claims to overwrite that?
VS battle core claims to overwrite that?
Where? I haven't used the plugin, but looking at the documentation I don't see that claim. I do see this (emphasis mine for clarity 🙂):
Damage Styles are a new feature added through the Battle Core plugin. When using certain Battle Styles, you can completely ignore typing in the whole damage formula...Or just remove them if you want...figure out which Damage Style best fits your game, if you plan on using them.

If "Manual" is used, then no style will be used and all calculations will be made strictly based off the formula found inside the formula box.

Anyway, good luck with your project!
Where? I haven't used the plugin, but looking at the documentation I don't see that claim. I do see this (emphasis mine for clarity 🙂):


Anyway, good luck with your project!
that's what I meant, I don't get if picking a damage style overwrites ALL formulas or if custom ones will just take precedence, like, for gravity stuff.
it is early here so maybe that's why I'm confused.
that's what I meant, I don't get if picking a damage style overwrites ALL formulas or if custom ones will just take precedence, like, for gravity stuff.
it is early here so maybe that's why I'm confused.
If you're confused, I just don't understand why you're messing with it at all. It takes seconds to copy and paste a formula between different skills, so the whole damage styles thing saves you such minimal effort to begin with (in my opinion).

It doesn't seem to have anything to do with your original question with the Luck stuff.

If you've moved onto how the damage styles in this specific plugin work, that seems like that's about carefully reading the documentation or doing some really simple testing that would take, like, three minutes (make a style do 10 damage, overwrite one sklll to do 15 damage, see whether it does 10 or 15 damage in game. Done. 😉).

Original thread: https://forums.rpgmakerweb.com/threads/turning-luck-into-a-different-attribute.152406/