How to reduce the amount of healing that can be done after each fight?

Kaneusta

Warper
Member
Joined
Feb 2, 2019
Messages
2
Reaction score
0
First Language
English
Primarily Uses
RMMV
Hey guys! On my first project right now and I just have a quick question.

I'm trying to make it a game where HP/MP gets capped after each battle so eventually, one must go back to an inn to restore health back to max even with Healing Spells and whatnot. While a health pot can only heal up to 75% of the damage.

Example:
Character A starts with 100 Hp
After Battle, he ends up with 60 Hp.
Character A cast heal, -> 80 Hp. Can't heal past 80 outside of battle.
Next battle occurs, Character A can only heal up to 80 in that fight.
After Battle, he ends up with 40 Hp.
Character A cast heal -> 60 Hp. Can't heal past 60 Hp outside of battle or next fight.

Is there's a series of commands that will allow this or a plugin that has this feature out there?
 

Renseiryuu

Villager
Member
Joined
Jan 7, 2019
Messages
14
Reaction score
2
First Language
Indonesia
Primarily Uses
RMMV
You could try storing the character max hp after battle, and then made the operation based on that. Try using a plugin that could call event after battle end (http://himeworks.com/2015/10/end-phase-triggers-mv/, credit to Hime as the maker).

So what we're going to do is this:
1. At battle end, set two variables. One stores the character's max hp, the other is number of battle fought ever since last rest. The max hp one is only done when number of battle is only 1.
2. Make the operation that calculate character max hp based on number of battle fought. You could use another variable to calculate that, and then use it to set the character's new max hp. I'll leave the calculation to you, but if you're having trouble with it, you could try ask again.
3. The more battle the character fought, the worse his/her max hp will be. If you want to, you could limit so the penalty only increase until some point (ex: only 50% max hp after 50 battle. After 51st battle, the penalty stays at 50%).
4. When character rest at inn, set so that the calculation run once more, this time restoring the character's max hp to it's original by using the first variable. You also need to reset the number of battle variable to 0 here.

There's still an issue about if the character leveled up and got an increase in max hp, though. I haven't think of a workaround there yet.
 

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
Give this Plugin a try. It will reduce the party's MHP values after every battle by either a certain percentage or a certain value, configured in the Plugin's parameters. You can also set the maximum percentage or maximum value an Actor's MHP can be reduced by. When you want to remove the penalty, have an event perform the following script call (for example, whenever the party rests at an inn):
Code:
Zevia.BattleFatigue.clearFatigue();
Either copy this code into a file and save it as "BattleFatigue.js" in your js/plugins folder, or download the file from this post.
Code:
/*:
* @plugindesc Lowers the MHP of each member in the party by a certain percentage or value
* after every battle until a script call is made to restore it to normal.
* @author Zevia
*
* @help Two modes are available for fatigue - percentage and value. When
* percentage is enabled, every battle will cause the party's MHP values
* to be reduced by a certain percentage. When value is enabled, every
* battle will cause the party's MHP values to be reduced by a flat
* value.
*
* The maximumPercentPenalty and maximumValuePenalty are the highest
* percentage or value that MHP can be reduced by before further battles
* no longer reduce MHP.
*
* In order to remove the penalty, have an event perform a script call
* with the line:
* Zevia.BattleFatigue.clearFatigue();
*
* MHP cannot be reduced below 1.
*
* @param fatigueMode
* @text Fatigue Mode
* @desc The mode to reduce MHP by - choose either percentage or value
* @type combo
* @option percentage
* @option value
* @default percentage
*
* @param --- Percentage Settings ---
* @default
*
* @param fatiguePercent
* @text Fatigue Percentage
* @desc The amount to reduce MHP by after each battle, as a percentage
* @type Number
* @max 100
* @min 1
* @default 10
*
* @param maximumPercentPenalty
* @text Maximum Fatigue Percentage
* @desc The highest percentage MHP can be reduced by
* @type Number
* @max 100
* @min 1
* @default 50
*
* @param --- Value Settings ---
* @default
*
* @param fatigueValue
* @text Fatigue Value
* @desc The amount to reduce MHP by after each battle, as a value
* @type Number
* @min 1
* @default 20
*
* @param maximumValuePenalty
* @text Maximum Fatigue Value
* @desc The highest value MHP can be reduced by
* @type Number
* @min 1
* @default 200
*/

(function(module) {
    'use strict';

    module.Zevia = module.Zevia || {};
    var BattleFatigue = module.Zevia.BattleFatigue = {};

    var parameters = PluginManager.parameters('BattleFatigue');
    var fatigueMode = parameters.fatigueMode;
    var fatiguePercent = parseInt(parameters.fatiguePercent);
    var maximumPercentPenalty = parseInt(parameters.maximumPercentPenalty);
    var fatigueValue = parseInt(parameters.fatigueValue);
    var maximumValuePenalty = parseInt(parameters.maximumValuePenalty);

    if (maximumPercentPenalty < fatiguePercent) {
        throw new Error(
            'Configuration Error: Fatigue Percentage must be lower than the Maximum Fatigue Percentage.' +
            ' Check the Plugin Parameters for BattleFatigue'
        );
    }
    if (maximumValuePenalty < fatigueValue) {
        throw new Error(
            'Configuration Error: Fatigue Value must be lower than the Maximum Fatigue Value.' +
            ' Check the Plugin Parameters for BattleFatigue'
        );
    }
    if (fatigueMode !== 'percentage' && fatigueMode !== 'value') {
        throw new Error(
            'Configuration Error: Fatigue Mode must be either percentage or value.' +
            ' Check the Plugin Parameters for BattleFatigue'
        );
    }

    BattleFatigue.battleCount = 0;

    BattleFatigue.clearFatigue = function() {
        BattleFatigue.battleCount = 0;
    };

    BattleFatigue.actorParam = Game_Actor.prototype.param;
    Game_Actor.prototype.param = function(paramId) {
        var baseValue = BattleFatigue.actorParam.call(this, paramId);
        if (paramId !== 0) { return baseValue; }

        if (fatigueMode === 'percentage') {
            return Math.max(
                1,
                (baseValue * (1 - (Math.min(BattleFatigue.battleCount * fatiguePercent, maximumPercentPenalty) * 0.01)))
            );
        } else {
            return Math.max(
                1,
                (baseValue - (Math.min(BattleFatigue.battleCount * fatigueValue, maximumValuePenalty)))
            );
        }
    };

    BattleFatigue.endBattle = BattleManager.endBattle;
    BattleManager.endBattle = function(result) {
        BattleFatigue.battleCount++;
        BattleFatigue.endBattle.call(this, result);
    };
})(window);
 

Attachments

Last edited:

Kaneusta

Warper
Member
Joined
Feb 2, 2019
Messages
2
Reaction score
0
First Language
English
Primarily Uses
RMMV
Thank you so much you two! The plugin is exactly what I needed!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top