Multiple Step counters

Discussion in 'JS Plugin Releases (RMMV)' started by Tea's Jams, Mar 1, 2019.

  1. Tea's Jams

    Tea's Jams I'm human Veteran

    Messages:
    776
    Likes Received:
    1,962
    First Language:
    English
    Primarily Uses:
    RMMV
    multipleStepCounts v1.0
    Authored by: Tea's Jams

    Terms of Use:
    Free for commercial and non-commercial projects
    Editing allowed
    Re-posting allowed
    Credit Tea's Jams (optional)

    Introduction
    This plugin provides 10 extra step counters in addition to the game data step counter. Choose a variable to store your step count in the parameters and use the engines built in variable manipulation tools to reset or otherwise change each step count to your needs.

    Features
    - 10 additional step counters
    - each count can be manipulated using the usual eventing options, no plugin commands or script calls needed.

    Video Preview


    How to Use
    -Assign the variables you would like to use for each step count.
    -Manipulate each step count through the variables tools in the game engine in your events.

    Script
    Code:
    /*:
     *
      * @plugindesc MultipleStepCount v1.0 This plugin allows you to store and reset mutilple step counts with variables in the parameters
      *
      * @author TeasJams
      *
      * @param Step Counter 1
      * @desc Set your desired variable
      * @default 0
      *
      * @param Step Counter 2
      * @desc Set your desired variable
      * @default 0
      *
      * @param Step Counter 3
      * @desc Set your desired variable
      * @default 0
      *
      * @param Step Counter 4
      * @desc Set your desired variable
      * @default 0
      *
      * @param Step Counter 5
      * @desc Set your desired variable
      * @default 0
      *
      * @param Step Counter 6
      * @desc Set your desired variable
      * @default 0
      *
      * @param Step Counter 7
      * @desc Set your desired variable
      * @default 0
      *
      * @param Step Counter 8
      * @desc Set your desired variable
      * @default 0
      *
      * @param Step Counter 9
      * @desc Set your desired variable
      * @default 0
      *
      * @param Step Counter 10
      * @desc Set your desired variable
      * @default 0
      *
      * @help
      *
      * Assign each step count to a variable of your choice, you can manipulate the step count using variable event options in the engine.
      */
    
      (function(){
    
          var parameters = PluginManager.parameters('MultipleStepCounter');
          var stepCount1 = Number(parameters['Step Counter 1']);
          var stepCount2 = Number(parameters['Step Counter 2']);
          var stepCount3 = Number(parameters['Step Counter 3']);
          var stepCount4 = Number(parameters['Step Counter 4']);
          var stepCount5 = Number(parameters['Step Counter 5']);
          var stepCount6 = Number(parameters['Step Counter 6']);
          var stepCount7 = Number(parameters['Step Counter 7']);
          var stepCount8 = Number(parameters['Step Counter 8']);
          var stepCount9 = Number(parameters['Step Counter 9']);
          var stepCount10 = Number(parameters['Step Counter 10']);
    
          var Game_Party_prototype_intitialize = Game_Party.prototype.initialize;
          Game_Party.prototype.initialize = function() {
              Game_Party_prototype_intitialize.call(this);
            Game_Unit.prototype.initialize.call(this);
            this._steps1 = 0;
            this._steps2 = 0;
            this._steps3 = 0;
            this._steps4 = 0;
            this._steps5 = 0;
            this._steps6 = 0;
            this._steps7 = 0;
            this._steps8 = 0;
            this._steps9 = 0;
            this._steps10 = 0;
            this.initAllItems();
    
        };
    
        var Game_Party_prototype_increaseSteps = Game_Party.prototype.increaseSteps;
        Game_Party.prototype.increaseSteps = function() {
            Game_Party_prototype_increaseSteps.call(this);
            this._steps1++;
            this._steps2++;
            this._steps3++;
            this._steps4++;
            this._steps5++;
            this._steps6++;
            this._steps7++;
            this._steps8++;
            this._steps9++;
            this._steps10++;
            var count1 = this._steps1;
            var count2 = this._steps2;
            var count3 = this._steps3;
            var count4 = this._steps4;
            var count5 = this._steps5;
            var count6 = this._steps6;
            var count7 = this._steps7;
            var count8 = this._steps8;
            var count9 = this._steps9;
            var count10 = this._steps10;
            $gameVariables.setValue(stepCount1, count1);
            $gameVariables.setValue(stepCount2, count2);
            $gameVariables.setValue(stepCount3, count3);
            $gameVariables.setValue(stepCount4, count4);
            $gameVariables.setValue(stepCount5, count5);
            $gameVariables.setValue(stepCount6, count6);
            $gameVariables.setValue(stepCount7, count7);
            $gameVariables.setValue(stepCount8, count8);
            $gameVariables.setValue(stepCount9, count9);
            $gameVariables.setValue(stepCount10, count10);
    
        }; 
    
    
    var Game_Variables_prototype_setValue = Game_Variables.prototype.setValue;
    Game_Variables.prototype.setValue = function(variableId, value) {
        Game_Variables_prototype_setValue.call(this);
        if (variableId > 0 && variableId < $dataSystem.variables.length && variableId == stepCount1) {
            if (typeof value === 'number') {
                value = Math.floor(value);
                $gameParty._steps1 = value;
            }
    
            this._data[variableId] = value;
            this.onChange();
        }
        if (variableId > 0 && variableId < $dataSystem.variables.length && variableId == stepCount2) {
            if (typeof value === 'number') {
                value = Math.floor(value);
                $gameParty._steps2 = value;
            }
    
            this._data[variableId] = value;
            this.onChange();
        }
        if (variableId > 0 && variableId < $dataSystem.variables.length && variableId == stepCount3) {
            if (typeof value === 'number') {
                value = Math.floor(value);
                $gameParty._steps3 = value;
            }
    
            this._data[variableId] = value;
            this.onChange();
        }
        if (variableId > 0 && variableId < $dataSystem.variables.length && variableId == stepCount4) {
            if (typeof value === 'number') {
                value = Math.floor(value);
                $gameParty._steps4 = value;
            }
    
            this._data[variableId] = value;
            this.onChange();
        }
        if (variableId > 0 && variableId < $dataSystem.variables.length && variableId == stepCount5) {
            if (typeof value === 'number') {
                value = Math.floor(value);
                $gameParty._steps5 = value;
            }
    
            this._data[variableId] = value;
            this.onChange();
        }
        if (variableId > 0 && variableId < $dataSystem.variables.length && variableId == stepCount6) {
            if (typeof value === 'number') {
                value = Math.floor(value);
                $gameParty._steps6 = value;
            }
    
            this._data[variableId] = value;
            this.onChange();
        }
        if (variableId > 0 && variableId < $dataSystem.variables.length && variableId == stepCount7) {
            if (typeof value === 'number') {
                value = Math.floor(value);
                $gameParty._steps7 = value;
            }
    
            this._data[variableId] = value;
            this.onChange();
        }
        if (variableId > 0 && variableId < $dataSystem.variables.length && variableId == stepCount8) {
            if (typeof value === 'number') {
                value = Math.floor(value);
                $gameParty._steps8 = value;
            }
    
            this._data[variableId] = value;
            this.onChange();
        }
        if (variableId > 0 && variableId < $dataSystem.variables.length && variableId == stepCount9) {
            if (typeof value === 'number') {
                value = Math.floor(value);
                $gameParty._steps9 = value;
            }
    
            this._data[variableId] = value;
            this.onChange();
        }
        if (variableId > 0 && variableId < $dataSystem.variables.length && variableId == stepCount10) {
            if (typeof value === 'number') {
                value = Math.floor(value);
                $gameParty._steps10 = value;
            }
    
            this._data[variableId] = value;
            this.onChange();
        }
    };
    
    
      })();

    FAQ
    reserved for future questions:

    Q:
    A:

    Credit and Thanks
    - Tea's Jams
    - DriftwoodGaming.

    Author's Notes
    This is a very basic script, excuse the noob format please. This is the first plugin I've written, I hope someone can find some use from it, enjoy!
     
    #1
    Kike likes this.
  2. Krystek_My

    Krystek_My Veteran Veteran

    Messages:
    186
    Likes Received:
    40
    First Language:
    Polish
    Primarily Uses:
    RMMV
    Your video is broken or something. Seems interesting. Meaby I'll try it.
     
    #2
    Tea's Jams likes this.
  3. Tea's Jams

    Tea's Jams I'm human Veteran

    Messages:
    776
    Likes Received:
    1,962
    First Language:
    English
    Primarily Uses:
    RMMV
    Oops, my bad. I fixed the video. :)
     
    #3

Share This Page