Dungeon Crawler: Limited Steps And Storage

So I want to make a step counter for certain maps which will boot you out to another map when it runs down to zero. Because otherwise the maze is more like an annoyance more than a real threat.
And I want to have items that will replenish that step counter. Like BREAD- recovers 100 steps.
And to prevent abuse of B R E A D, a limited inventory that affects only items (so that key items and armor and weapons are not accidentally dropped or something) and a chest to store those spare items.

Is it possible with an event or do I have to install a plugin? I'm using yanfly's abandoned ctb battle system so I'm scared some plugins may not work with it or something.
Yes. I think its possible to make all with events.
You can attach a variable to the step counts.
Then make a condition when the variable reaches X steps, teleport the player or do whatever you want.
I think you can make the same way with the items.
Attach them to a variable or put a condition of actor has x number of items a switch is on then a common event or parallel event will run doing what you want to do if the item reaches a x number.
This would probably best be handled by a custom plugin (it would be smoother and you should show the player their step counter anyhow, which you can't do with native behavior), but it can certainly be done with Events.

At the beginning of the map, set a variable to the player's Steps (this is an option under 'Game Data' in the Control Variables event command). Make a parallel process common event that, every 15 frames or so, will set another variable equal to the current Steps, and subtract from that the Steps counter at the beginning of the map, to figure out how many Steps the player has taken on this map. If it's greater than the limit, warp them out of the map.

If items like BREAD can increase the number of steps the player can take in the dungeon, track that "extra stamina" variable separately (adding to it every time the player eats BREAD, and resetting it to 0 at the beginning of a map), and subtract both the original steps variable AND the extra stamina variable from the Current Steps before comparing to the map's Steps Limit.

Remember that it's very important to keep the player informed about how close they are to reaching the limit. Nothing would suck more than nearly reaching your goal, thinking you made it (with BREAD in your inventory that you don't think you'll need), and then out of the wild blue you're warped right off the map and you've gotta do it all again.
Open rpg_object.js and find this part
Code:
Game_Party.prototype.increaseSteps = function() {
    this._steps++;
};
Now add a line within the function that increases a variable you choose, for example 9...
Code:
$gameVariables.setValue(9, $gameVariables.value(9) + 1);
So it looks something like
Code:
Game_Party.prototype.increaseSteps = function() {
    this._steps++;
    $gameVariables.setValue(9, $gameVariables.value(9) + 1);
};
Now you have a variable that increases every step but can be reset whenever you want!

Original thread: https://forums.rpgmakerweb.com/threads/dungeon-crawler-limited-steps-and-storage.104179/