How to record the total increase of a variable?

How to record the total increase of a variable across different parts of the game?
===
Recently, I've been working on an achievement system for my game. Simply put, it's a medical-themed game where you can improve patients' health score through various methods, such as psychological counseling, providing items, and offering daily life support.
Since there are many ways to boost health and a lot of characters in the game, I feel that manually creating a separate variable to record each time a change occurs would be too complicated.
Besides that, if the player doesn't perform well, it might also lower the patient's health score. However, I only want to record the increases in the health score, not the decreases.
I remember seeing a plugin with a similar function before, but I can't find it anymore.
===
Any solution?Thank you for your reply!:ptea:
of a x-mas game jam, I use this code:

JavaScript:
    GiftTotal = function() {
        let collected = $gameVariables.value(3);
        let total = $gameVariables.value(4);
        $gameVariables.setValue(4, total + collected)
    }

// or with custom variable to total

    achieveTotal = function(setTotal) {
        let collected = $gameVariables.value(setTotal);
        let total = $gameVariables.value(4);
        $gameVariables.setValue(4, total + collected)
    }

just change total variable fixed, so you can set your collected variable
to another to add to the other one. (easy and fast).

but you have to reset the variable you set to 0 just in case.

I used 2 different one, but it can work out for you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-record-the-total-increase-of-a-variable.177235/