Problem with states applying/being removed in the Map

I have a skill that heals, and applies the "Motivated" state, which restores Mana for three turns. When I use this skill in the map, it still applies this state. Since the state's mana regen isn't active on the map, that wouldn't be such a big deal, but after 30 or so steps, a giant message pops up stating "X has lost motivation" and the state is removed. It's pretty obnoxious.

My ideal scenario would be only have the state be applied in battle, but I think the easier solution would simply be just not having states removed in the map screen at all. I think there's probably a "map = turn" line of code somewhere since it doesn't apply to "action end" restrictions, but I wouldn't know where to find it, or how to change it so it behaves. If anyone could help me out, I would really appreciate it, thank you.
Couldn't you just make your skill unusable on the map?

And the state itself can just be removed at the end of combat.
I have a skill that heals, and applies the "Motivated" state, which restores Mana for three turns. When I use this skill in the map, it still applies this state. Since the state's mana regen isn't active on the map, that wouldn't be such a big deal, but after 30 or so steps, a giant message pops up stating "X has lost motivation" and the state is removed. It's pretty obnoxious.

My ideal scenario would be only have the state be applied in battle, but I think the easier solution would simply be just not having states removed in the map screen at all. I think there's probably a "map = turn" line of code somewhere since it doesn't apply to "action end" restrictions, but I wouldn't know where to find it, or how to change it so it behaves. If anyone could help me out, I would really appreciate it, thank you.
Definitely could but this is one of few Heals. Would be nice to get the Heal part of it between fights, while not caring about the state it applies on the map.
After a quick look I think these two functions found in rpg_objects.js are the ones you are looking for:

JavaScript:
Game_Actor.prototype.stepsForTurn = function() {
    return 20;
};

Game_Actor.prototype.turnEndOnMap = function() {
    if ($gameParty.steps() % this.stepsForTurn() === 0) {
        this.onTurnEnd();
        if (this.result().hpDamage > 0) {
            this.performMapDamage();
        }
    }
};

Essentially, every 20 steps all active states advance by 1 turn.
And if a state expires from this effect, they will disappear and the message will appear.

Now, the easiest solution would probably be to go to this function:

JavaScript:
Game_Actor.prototype.onPlayerWalk = function() {
    this.clearResult();
    this.checkFloorEffect();
    if ($gamePlayer.isNormal()) {
        this.turnEndOnMap();  //This is where the function is called
        this.states().forEach(function(state) {
            this.updateStateSteps(state);
        }, this);
        this.showAddedStates();
        this.showRemovedStates();
    }
};

and comment out
JavaScript:
this.turnEndOnMap();

I went ahead and made a small plugin for you, let me know if it works.
After a quick look I think these two functions found in rpg_objects.js are the ones you are looking for:

JavaScript:
Game_Actor.prototype.stepsForTurn = function() {
    return 20;
};

Game_Actor.prototype.turnEndOnMap = function() {
    if ($gameParty.steps() % this.stepsForTurn() === 0) {
        this.onTurnEnd();
        if (this.result().hpDamage > 0) {
            this.performMapDamage();
        }
    }
};

Essentially, every 20 steps all active states advance by 1 turn.
And if a state expires from this effect, they will disappear and the message will appear.

Now, the easiest solution would probably be to go to this function:

JavaScript:
Game_Actor.prototype.onPlayerWalk = function() {
    this.clearResult();
    this.checkFloorEffect();
    if ($gamePlayer.isNormal()) {
        this.turnEndOnMap();  //This is where the function is called
        this.states().forEach(function(state) {
            this.updateStateSteps(state);
        }, this);
        this.showAddedStates();
        this.showRemovedStates();
    }
};

and comment out
JavaScript:
this.turnEndOnMap();

I went ahead and made a small plugin for you, let me know if it works.
The plugin definitely worked, thank you for looking through it! The only half-issue is that map slip damage doesn't occur anymore either as was kind of expected, but that's not the biggest deal. Slip damage states were always easy to remove anyways. Thank you very much again.

Original thread: https://forums.rpgmakerweb.com/threads/problem-with-states-applying-being-removed-in-the-map.148216/