Greater state: actor x equip

Hi everyone, um trying to make a special equip system where the user get the exactly amout of status of an equip if theirs states are inferior than equip state. But i fonte know How.

Lets get an example: If Harold has 10 of attack and get a sword that has 50, he will be with exactly 50 of attack, not 60. But If he has 100 of attack, noting chance, because he alread has a greater state.

I dont know If i Will need a plung or note to do this
So basically what you want is for parameters to only take equipment stats into account unless their natural value is already higher than what the equipment gives?
So basically what you want is for parameters to only take equipment stats into account unless their natural value is already higher than what the equipment gives?
Yes
You could theoretically do this with a parallel process common event, but using a plugin would likely be less prone to issues.
You could theoretically do this with a parallel process common event, but using a plugin would likely be less prone to issues.
Hun... Knows any plugin for that?
YEP has a custom parameters plugin that I think could do something like this.
I think in rpg_objects.js you could change paramPlus(), which adds the item's parameters to the actor, to instead add the difference or nothing.
Like
value += item.params[paramId];
into
value += item.params[paramId] >= this.paramBase(paramId) ? item.params[paramId] -this.paramBase(paramId) : 0;

In my head it's just a 1 line change. But I don't know about the Equipment Window showing the correct stat change. It'll probably require a few tweaks in other places too.
I think in rpg_objects.js you could change paramPlus(), which adds the item's parameters to the actor, to instead add the difference or nothing.
Like
value += item.params[paramId];
into
value += item.params[paramId] >= this.paramBase(paramId) ? item.params[paramId] -this.paramBase(paramId) : 0;

In my head it's just a 1 line change. But I don't know about the Equipment Window showing the correct stat change. It'll probably require a few tweaks in other places too.
Never change the core scripts directly; they'll be overwritten if the engine updates.
Never change the core scripts directly; they'll be overwritten if the engine updates.
Excellent advice, though it probably doesn't matter much for MV. It still isn't something I'd let people get in the habit of doing though.
I think in rpg_objects.js you could change paramPlus(), which adds the item's parameters to the actor, to instead add the difference or nothing.
Like
value += item.params[paramId];
into
value += item.params[paramId] >= this.paramBase(paramId) ? item.params[paramId] -this.paramBase(paramId) : 0;

In my head it's just a 1 line change. But I don't know about the Equipment Window showing the correct stat change. It'll probably require a few tweaks in other places too.
I can try create a plugin with that piece of code. I will search How to create a plugin and use that. But would still be nice if was alread done
It seems to work better than I thought it would. I don't think you need to change anything else. Although compatibility with other plugins is a different matter.
I don't think you'll get a simpler solution than this.

Spoiler: Minor differences in paramPlus between versions but the change is the same.
MV:
[img]https://i.imgur.com/JgApZwf.png[/img]
MZ:
[img]https://i.imgur.com/2WhUxNc.png[/img]

Bah. I wouldn't bother with a plugin when it's just 1 line of code. I encourage you to just edit the core script directly. It's 1 project for yourself. That's what everyone did in the XP and VX days. Only those editions had built in script editors. With MV and MZ you'll have to open your project's .js files in a seperate text editor. I use Notepad++
Just search for this block, make these changes. Done.

I could make this a plugin for you. But I'd rather not. If someone else wants to make this a plugin for you, be my guest.
It seems to work better than I thought it would. I don't think you need to change anything else. Although compatibility with other plugins is a different matter.
I don't think you'll get a simpler solution than this.

Spoiler: Minor differences in paramPlus between versions but the change is the same.
MV:
JgApZwf.png

MZ:
2WhUxNc.png

Bah. I wouldn't bother with a plugin when it's just 1 line of code. I encourage you to just edit the core script directly. It's 1 project for yourself. That's what everyone did in the XP and VX days. Only those editions had built in script editors. With MV and MZ you'll have to open your project's .js files in a seperate text editor. I use Notepad++
Just search for this block, make these changes. Done.

I could make this a plugin for you. But I'd rather not. If someone else wants to make this a plugin for you, be my guest.
Well thx a lot for the code, i try It later
If someone else wants to make this a plugin for you, be my guest.
"Making a plugin for it" simply consists of copying the text of the original function, making the change, then posting it here - let the other person copy and paste it into a file and save it.

You had already typed out the code in order to take the screenshot, all you had to do was copy and paste it into a code tag. Probably actually easier than taking, saving, and attaching a screenshot 🤣
"Making a plugin for it" simply consists of copying the text of the original function, making the change, then posting it here - let the other person copy and paste it into a file and save it.

You had already typed out the code in order to take the screenshot, all you had to do was copy and paste it into a code tag. Probably actually easier than taking, saving, and attaching a screenshot 🤣
Well i didnt know that was that simples, i thougth that i had to call some code in the plugin, beside the function that i was changing
Nope. Any function in a plugin file will automatically overwrite code from the default engine with the same name.

If you want to do more complicated things then yes, it's more complicated (not to be tautological), but to just change one thing in a function, that's all you need to do.

So you can copy this:
Code:
Game_Actor.prototype.paramPlus = function(paramId) {
    var value = Game_Battler.prototype.paramPlus.call(this, paramId);
    var equips = this.equips();
    for (var i = 0; i < equips.length; i++) {
        var item = equips[i];
        if (item) {
            value += item.params[paramId] >= this.paramBase(paramId) ? item.params[paramId]-this.paramBase(paramId) : 0;
        }
    }
    return value;
};

Paste it into Notepad or whatever, save it as a *.js file in your plugins folder, include it in your plugin manager.

If you accumulate any other little miscellaneous changes like this, you can just keep them all in the same file.
Nope. Any function in a plugin file will automatically overwrite code from the default engine with the same name.

If you want to do more complicated things then yes, it's more complicated (not to be tautological), but to just change one thing in a function, that's all you need to do.

So you can copy this:
Code:
Game_Actor.prototype.paramPlus = function(paramId) {
    var value = Game_Battler.prototype.paramPlus.call(this, paramId);
    var equips = this.equips();
    for (var i = 0; i < equips.length; i++) {
        var item = equips[i];
        if (item) {
            value += item.params[paramId] >= this.paramBase(paramId) ? item.params[paramId]-this.paramBase(paramId) : 0;
        }
    }
    return value;
};

Paste it into Notepad or whatever, save it as a *.js file in your plugins folder, include it in your plugin manager.

If you accumulate any other little miscellaneous changes like this, you can just keep them all in the same file.
wow nice, thx a lot
"Making a plugin for it" simply consists of copying the text of the original function, making the change, then posting it here - let the other person copy and paste it into a file and save it.

You had already typed out the code in order to take the screenshot, all you had to do was copy and paste it into a code tag. Probably actually easier than taking, saving, and attaching a screenshot 🤣
*flex* It's impressive. I know.
Sometimes you have to do 10 pushups to get someone else to attempt 1. But please, don't attempt my mental gymnastics.
*flex* It's impressive. I know.
Sometimes you have to do 10 pushups to get someone else to attempt 1. But please, don't attempt my mental gymnastics.
Don't. Just . . . don't. That's uncalled for and rather insulting.
Old thread, but just a reminder to people to keep things civil. Thank you.

Also, since this thread seems to be solved,

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/greater-state-actor-x-equip.155084/