Increase stats permanently

This could be very easy to do, maybe i havent enough practice with rpg maker mv.

In pokemon there were these objects called protein, calcium...one for each stat.
They raised your stats permanently but you could use only a limited amount, otherwise you could level up your stats to infinite...
Like you only can use 100 in total. 50 protein+50 calcium. Or 50 protein+25 calcium+25iron...


There is a way to replicate that? Items that increase your stats but you can only use a global limited amount?
There's no way to replicate that without plugins. The reason for that is, there are no individual actor attributes, they obtain attributes from their class.
You can give items a Grow effect (Database > Items, double-click the Effects list on the right to add a new effect, Other > Grow) which works exactly like the Change Parameter event command: it grants a permanent flat bonus/malus to one basic parameter (max hp, max mp, atk, def, mat, mdf, agi, or luk) applied before traits. So no problems there! 🙏

However, I think the limit thing, assuming you're using these items from the inventory rather than at some kind of event/location on the map, will need some creative use of the damage formula and/or a plugin. Yanfly's Skill Core plugin offers an <After Eval> notetag for skills/items: should be possible to code something that'll do what you want, but at the moment I'm not sure how. Alternatively Himeworks has an Effect Conditions plugin, but that's scripting too. Maybe someone else has some ideas... 😴
@caethyril Would it be possible to apply a clamp(0, max) somewhere to limit the stat or the flat additive from growth?
@mathmaster74 not sure that's the desired solution since you could have, for instance, 50 HP boosts and 50 MP boosts, or 100 HP boosts and 0 MP boosts? Need a counter to do it properly, either via the existing game variables or a separate property on affected actors, and in that case you may as well check the counter directly rather than trying to clamp the bonuses themselves. 😅

Also, typically the parameter bonuses are applied individually, i.e. Grow Max HP +50 will add 50 to the target actor's _paramPlus value for the respective parameter ID. A clamp could be applied, but again that would need a plugin to provide the appropriate alias. I feel it's probably best to intercept the grow effect earlier than that, anyway. 😴
If you're looking to limit how many stat boosts a character can use, one option is to set the stat booster to give the recipient a "dummy" state. Then, have the item call a common event on use. In the common event, you can use conditional branches to check who has the dummy state, and remove the dummy state

From there, you can have another conditional branch to check if a variable (for example, Actor1_StatBoost) is below the amount you want to set your limit. If so, use Growth Effect to boost their stat, and increase that actor's variable by 1. If it isn't, then give the player a message along the lines of "There was no effect...", and refund them the stat boosting item (since otherwise it would still be consumed, even if it had no effect).
The reason for that is, there are no individual actor attributes, they obtain attributes from their class.

Actually, actors do have their own parameter/attribute data: the _paramPlus array which is specific to the actor object.

This is the data modified by the Grow Item Effect and by the Parameter Change Event command.

The params of an actor when called is
calculated using the following data

- class parameters
- paramPlus array of the actor
- equip parameters
- traits that modify parameters from all associated objects

@mathmaster74 - I'm with caethyril on this one, better capture it before the actual growth so that you can actually cancel/refund the item in case you're already above the limit.

Like, you can probably do this in the damage formula or via a plugin that allows code effect

Code:
if (a._paramPlus[ID] < 100) {a._paramPlus[ID] += value};else{$gameParty.gainItem(params of gain item here)};

Just supply the correct parameter ID (like MHP is ID # 0, MMP is # 1 and so on)
OK I've done a little experimenting...I personally don't like using the damage formula for something this complex (various reasons), but it should be doable. I got it working with Yanfly's Skill Core, using this notetag in the items' noteboxes:
Code:
<After Eval>
// which parameter to affect
var paramId = 0;
// how much to increase by
var grow = 50;
// maximum total stat growth item uses
var maxUses = 5;
// check if counter is defined
if (target._growCount === undefined) {
  // not defined, so initialise it
  target._growCount = 0;
}
// check if counter is below limit
if (target._growCount < maxUses) {
  // increase counter
  target._growCount++;
  // grow appropriate parameter
  target.addParam(paramId, grow);
} else {
  // item has no effect; refund item
  $gameParty.gainItem(item, 1);
}
</After Eval>
The first three lines of code (not counting "// comments") determine which parameter to affect, how much to grow it by, and the maximum number of growth items that can be used in total. Basically, after adjusting the maxUses value to your liking, you can copy+paste the notetag into different items' noteboxes and just change the paramId/grow values as needed (the rest of it should not need editing). paramId ranges from 0~7 inclusive for the basic parameters: mhp, mmp, atk, def, mat, mdf, agi, and luk respectively. E.g. use paramId = 1 for max MP. 🙏

Also, to ensure it's always usable in the menu, you can add a pointless item Effect such as Add State: Knockout 0%. This will trick the game into thinking the item always does something, thus allowing it to be used without ever adding the state (because any state rate times 0 is still 0). 😛

Original thread: https://forums.rpgmakerweb.com/threads/increase-stats-permanently.109461/