LOGIN
SEARCH
PROFILE
keys: ↑ ↓
LOGOUT
INDEX
MEMBERS
keys: ↑ ↓
HOME
PORTAL
PLAY ALONG
PLAY with WORDS
PLAY with GRAPHICS
PLAY with SOUNDS
PLAY with CODES
PLAY with PROJECTS
keys: ← →
Guest Access
Register:
Members:



View previous topic View next topic Go down Message [Page 1 of 1]

EVENTALIST
EVENTALIST
#1 Test Might
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile

TestYorMight




  • Author: Mr_Wiggles | Version: 0.8.3 | Date: 11/20/15

Description:


Currently a work in progress, decided to share what I have so far. Its 4/5ths done as it stands and more features in the works. It will work as it is currently, you only have the ability to use FILL, TIMED, CHARGE, and REACT aspects of the TestMight script. The plugin includes full help documentation on useage and such.

Screen Shots:

Soon!


Version History:



  • Version 0.8.3 (11/20/15) - Initial Posting.

Script:

Demo Link: Demo V 0.8.3

The plugin is included in the demo, the script is too large to post here. :/

HELP:
Spoiler:
* @help This plugin allows you to test the player's might in a button pressing
* battle window. To call the window from event processing use the following
* comands for a plugin event comand:
* ------------------------------------------------------------------------------
*  'MightTest FILL' = Mash 'space' against resistance.
*     Optional Arguments - [need, resistance]
*        'need[#]'       = How much mashing is needed, a value 100 - 500 is
*                          recomended. (0 - 1000)
*        'resistance[#]' = How hard it is to reach the goal amount: (0 - 10)
* ------------------------------------------------------------------------------
*  'MightTest TIMED'  = Press 'space' with in the stopping zone to win.
*     Optional arguments - [speed, target, tlocat, penalty, spinning]
*        'target[#]'    = The Size of target to stop in: (5 - 80) number value.
*                           DEFAULT: rand
*        'tlocat[#]'    = The Placement of target area: (0 - 100) number value.
*                           DEFAULT: rand
*        'penalty[#]' = Amount to subtract from timmer in seconds for not
*                           landing in target. (0 - 10)
*        'spinning'   = Added dificulty with spinning bar.
* ------------------------------------------------------------------------------
*  'MightTest CHARGE' = Press and Hold 'space' to release at the right time.
*     Optional Arguments - [speed, varID, deadzone, dividen]
*        'varID[#]'   = The ID number of variable to store bar value: Will be
*                       rate of the bar. (0-2000) Is number value.
*        'deadzone[#] = The size of the area at the end of the charge bar that
*                       is considered 'overcharged' and returns a small portion
*                       of total. Number value (10 - 48).
*        'dividen[#]' = Amount of denominator to return when over charged. A
*                       Number value (2 - 10).
*                    -------------------------------------
*   Desciption of use:
*           The bar starts with a value up to that of 100000, deadzone adds
*      ontop of that 100000. If the bar lands in deadzone it will use dividen to
*      return a portion value of said 100000. After all thats been done and the
*      scene closes the variable ID that was set up to be used will contain that
*      value.
* ------------------------------------------------------------------------------
*  'MightTest REACT'   = Press the onscreen keys against a time limit.
*     REQUIRED Arguments - [time, keys[buttons]]
*        'keys[buttons]' = order of buttons to be pushed in an array: e.g.
*                                   [up, left, right, down]
*                          The first letter of each word works too: e.g.
*                                          [U,L,R,D]
*                          You may also use a random function: e.g.
*                                       [random, max#]
*                          Start the array with random and use the second  
*                       number 'max#' for the max amount of buttons for the bar.
*       'time[#]' = Number of frames to hit the required button in. (25 - 80)
* ------------------------------------------------------------------------------
* + 'MightTest MEMORY' = remember the onscreen keys against a time limit.
*
* ------------------------------------------------------------------------------
*  Common type extra commands, typed once to save space.
*    'speed[#]'  = The speed that bar moves at: (1 - 10) number value.
*    'time[#]'   = How many seconds you have to reach the goal. (3 - 20)
*
* Each bar will also need a reward switch to activate if you want it to affect
* other things via event proccessing.
*
*    'reward
[*]' = Switch id or selfswitch key thats activated when goal is
*                    reached. (1- 2000) ID to that in the RMMV database.
*    'lose
[*]'   = Switch id or selfswitch key that's activated when you run out
*                    time. (1 - 2000) ID to that in the RMMV database.
*
* ==============================================================================
* After you have selected which Might Test to use, you have the option to tack
* on additional arguments to the end of the line in the pluggin command event
* task.
*
*    'vertical'  = Use a vertical bar instead of the defulat horizontal one.
*    'color[#]'  = Set color of bar, if not set it will use the default.
*    
*    'tcolor[#]' = Only for use with TIMED TestMight, changes the target
*                  location color to ID location in '\img\system\windowbase.png'
*
* ==============================================================================
* Some Sample Event Task 'Plugin Command' calls:
*
*    TestMight FILL need[100] time[5] resistance[3] reward[27]
*    TestMight FILL lose[1241]
*    TestMight TIMED target[75] tlocat[10] spinning
*    TestMight TIMED penalty[1000] time[5] speed[6]
*    TestMight CHARGE varID[1984] speed[8]
*    TestMight CHARGE dividen[3] deadzone[28]
*    TestMight REACT time[85] keys[U,L,L,D,R]
*    TestMight REACT time[55] keys[random,7]
*
* ==============================================================================
*/ //============================================================================
EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator
#2 Re: Test Might
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
simply awesome and amazing, this plug-in/script will add more interaction to the game... so many ideas come to mind in use, for example:

FILL: opening chests, arm wrestling, digging in the ground, having sex with the bar maid, downing a beer, putting out a fire, starting a fire, tickle torture, playing mercy, crafting,

TIMED: a chance to dodge an incoming attack, shooting a bullet, more crafting, cooking, lock picking,

CHARGED: throwing things, firing an arrow, even more crafting,

just to name a few...

@wiggles - great work, you plan on including button combos?

also for graphics... would you be interested in making use of a sprite sheet that has a two part image for each mode? for example this one for FILL
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
EVENTALIST
EVENTALIST
#3 Re: Test Might
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
Yea i can set it up to use that.

@wiggles - great work, you plan on including button combos?
REACT TestMight Type i think is one that will fill that request when its implemented. It slaps you in the face with a button, part of a combination that's random or predefined, and you have to hit during a time slot.

MEMORY will basically be a flash memorize theme to the REACT combo system. Your shown all the buttons at the beginning and have to hit them back in order against time with out seeing them again.
EVENTALIST
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
#4 Re: Test Might
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
Updated, cleaned a few things up and added React into the List of Test Mights. Been whittling on this on, got too many projects open at one time. :p

@game face101 - I'll add that graphic into the script when I finish the last part of the script and post it along with the demo, it appears that RMMV doesn't like to use .gif format.
EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator
#5 Re: Test Might
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
mr_wiggles wrote:@game face101 - I'll add that graphic into the script when I finish the last part of the script and post it along with the demo, it appears that RMMV doesn't like to use .gif format.

awesome, making original graphics for this, let me know the size of each frame and the size of the sheet
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
EVENTALIST
EVENTALIST
#6 Re: Test Might
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
Well that can really be up to you, the current window is 200 * 50, if you do make the graphics, throw all them into one picture file, i can make the script pull the bitmap out of the group threw view rects when displaying the data on screen. This way it will be in one neat clean file. Smile

Well if i had to give you a suggested size, maybe something like the size of an icon, square [24, 32, 48, 64] one or more of those sizes should work. I'd also like to work more with the hepatic feed back, window shake with some sounds or flashing color backs, when going threw a TestMight scene.
EVENTALIST
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
#7 Re: Test Might
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
Cleaned up the charge part of it, was issues with the dead zone on the end when changing the size of it. This script doesn't require it but makes use of the '$gameTemp.getRandomColor()' from "SimpleColors"; if its included in your plugin list. So if you'd like to see some flashing colors you can include it, other wise the script will just resort to the default colors, pulling them from the Img/System/windowskin.png file tile grid. It is not required to for use of this script, merely extra eye candy.

[edit]
Included a demo link in first post.
Spoiler:

Code:

//================================================================================
// TestYourMight.js
//================================================================================
/*: @author Mr_Wiggles | Version: 0.8.3 | Date: 11/20/15
 * ------------------------------------------------------------------------------
 * @plugindesc Test the players might with interactive on screen stress bars.
 *
 * @param SpriteHoldUp
 * @desc  Time in frames to retain showing the TestMight Sprite before finishing the return to map command. (0 - 90)
 * @default 30
 *
 * @param DefualtBarColor
 * @desc  This is the defualt "TextColor" color to use for the gradent bar graphic.
 * @default 19
 *
 * @param DefualtTime
 * @desc  This is the defualt Time limit to use when TestMight is running in game, in Seconds. (3 - 20)
 * @default 10
 *
 * @param DefualtWinSwitch
 * @desc  This is the defualt ID for the switch to activate when player Wins TestMight.
 * @default 1
 *
 * @param DefualtLoseSwitch
 * @desc  This is the defualt ID for the switch to activate when player lost TestMight.
 * @default 2
 *
 * @param DefualtFILL_resistance
 * @desc  This is the defualt TestMight FILL 'resistance' value to use. Neumeric(1 - 10)
 * @default 5
 *
 * @param DefualtFILL_need
 * @desc  This is the defualt TestMight FILL 'resistance' value to use. Neumeric(100 - 2000)
 * @default 350
 *
 * @param DefualtSpeed
 * @desc  This is the defualt TestMight TIMED 'speed' value to use. In Frames (25 - 80)
 * @default 60
 *
 * @param DefualtTIMED_barColor
 * @desc  Defualt TestMight TIMED color value for drawing in the target box for the timed event.
 * @default 12
 *
 * @param DefualtTIMED_penalty
 * @desc  Defualt TestMight TIMED penalty value in seconds. (0 - 10)
 * @default 2
 *
 * @param DefualtCHARGE_variable
 * @desc  This variable holds Test Might % value and used for conditanal branching
 * after the window closes. (charge_value / 100000) = return rate % value.
 * @default 1
 *
 * @param DefualtCHARGE_deadzone
 * @desc  This is the size of the area on the end of the charge bar that is penalty. (10 - 48)
 * @default 32
 *
 * @param DefualtCHARGE_dividen
 * @desc  If charge bar was over charged into penalty, return a value using this dividen. (2-10)
 * Higher number = lower return on fail.
 * @default 6
 *
 * @help This plugin allows you to test the player's might in a button pressing
 * battle window. To call the window from event processing use the following
 * comands for a plugin event comand:
 * ------------------------------------------------------------------------------
 *  'MightTest FILL' = Mash 'space' against resistance.
 *    Optional Arguments - [need, resistance]
 *        'need[#]'      = How much mashing is needed, a value 100 - 500 is
 *                          recomended. (0 - 1000)
 *        'resistance[#]' = How hard it is to reach the goal amount: (0 - 10)
 * ------------------------------------------------------------------------------
 *  'MightTest TIMED'  = Press 'space' with in the stopping zone to win.
 *    Optional arguments - [speed, target, tlocat, penalty, spinning]
 *        'target[#]'    = The Size of target to stop in: (5 - 80) number value.
 *                          DEFAULT: rand
 *        'tlocat[#]'    = The Placement of target area: (0 - 100) number value.
 *                          DEFAULT: rand
 *        'penalty[#]' = Amount to subtract from timmer in seconds for not
 *                          landing in target. (0 - 10)
 *        'spinning'  = Added dificulty with spinning bar.
 * ------------------------------------------------------------------------------
 *  'MightTest CHARGE' = Press and Hold 'space' to release at the right time.
 *    Optional Arguments - [speed, varID, deadzone, dividen]
 *        'varID[#]'  = The ID number of variable to store bar value: Will be
 *                      rate of the bar. (0-2000) Is number value.
 *        'deadzone[#] = The size of the area at the end of the charge bar that
 *                      is considered 'overcharged' and returns a small portion
 *                      of total. Number value (10 - 48).
 *        'dividen[#]' = Amount of denominator to return when over charged. A
 *                      Number value (2 - 10).
 *                    -------------------------------------
 *  Desciption of use:
 *          The bar starts with a value up to that of 100000, deadzone adds
 *      ontop of that 100000. If the bar lands in deadzone it will use dividen to
 *      return a portion value of said 100000. After all thats been done and the
 *      scene closes the variable ID that was set up to be used will contain that
 *      value.
 * ------------------------------------------------------------------------------
 *  'MightTest REACT'  = Press the onscreen keys against a time limit.
 *    REQUIRED Arguments - [time, keys[buttons]]
 *        'keys[buttons]' = order of buttons to be pushed in an array: e.g.
 *                                  [up, left, right, down]
 *                          The first letter of each word works too: e.g.
 *                                          [U,L,R,D]
 *                          You may also use a random function: e.g.
 *                                      [random, max#]
 *                          Start the array with random and use the second 
 *                      number 'max#' for the max amount of buttons for the bar.
 *      'time[#]' = Number of frames to hit the required button in. (25 - 80)
 * ------------------------------------------------------------------------------
 * + 'MightTest MEMORY' = remember the onscreen keys against a time limit.
 *
 * ------------------------------------------------------------------------------
 *  Common type extra commands, typed once to save space.
 *    'speed[#]'  = The speed that bar moves at: (1 - 10) number value.
 *    'time[#]'  = How many seconds you have to reach the goal. (3 - 20)
 *
 * Each bar will also need a reward switch to activate if you want it to affect
 * other things via event proccessing.
 *
 *    'reward[*]' = Switch id or selfswitch key thats activated when goal is
 *                    reached. (1- 2000) ID to that in the RMMV database.
 *    'lose[*]'  = Switch id or selfswitch key that's activated when you run out
 *                    time. (1 - 2000) ID to that in the RMMV database.
 *
 * ==============================================================================
 * After you have selected which Might Test to use, you have the option to tack
 * on additional arguments to the end of the line in the pluggin command event
 * task.
 *
 *    'vertical'  = Use a vertical bar instead of the defulat horizontal one.
 *    'color[#]'  = Set color of bar, if not set it will use the default.
 *   
 *    'tcolor[#]' = Only for use with TIMED TestMight, changes the target
 *                  location color to ID location in '\img\system\windowbase.png'
 *
 * ==============================================================================
 * Some Sample Event Task 'Plugin Command' calls:
 *
 *    TestMight FILL need[100] time[5] resistance[3] reward[27]
 *    TestMight FILL lose[1241]
 *    TestMight TIMED target[75] tlocat[10] spinning
 *    TestMight TIMED penalty[1000] time[5] speed[6]
 *    TestMight CHARGE varID[1984] speed[8]
 *    TestMight CHARGE dividen[3] deadzone[28]
 *    TestMight REACT time[85] keys[U,L,L,D,R]
 *    TestMight REACT time[55] keys[random,7]
 *
 * ==============================================================================
 */ //============================================================================
//--------------------------------------------------------------------------------
// Auto run: Sets plugin items that are user defined in RMMV.
//--------------------------------------------------------------------------------
(function() {
  //------------------------------------------
  Game_Action.prototype.evalDamageFormula = function(target) {
    try { // Work in progress adding flag 'TMF' to Skill damage formula. * currently not working 100%
        var item = this.item();
        var string = item.damage.formula;
        var a = this.subject();
        if (a.constructor === Game_Actor) {
          if (string.contains("TMF")) { // if found flag for test might scene calling.
            $gameTemp.initialize_TestMight(); // reset flag data for new round.
            $gameSwitches.setValue($gameTemp._testMight_reward, false);
            $gameSwitches.setValue($gameTemp._testMight_lose, false);
            $gameTemp._testMight_Type = 'FILL';
            this.overLayScene = new Scene_TestMight();
            this.overLayScene.create();
            this.overLayScene.start();
            string = string.replace("TMF", "");
            SceneManager._scene.addChild(this.overLayScene);
            SoundManager.playOk();
          }
        } else {
          if (string.contains("TMF")) {string = string.replace("TMF", "")};
        }
        var b = target;
        var v = $gameVariables._data;
        var sign = ([3, 4].contains(item.damage.type) ? -1 : 1);
        return Math.max(eval(string), 0) * sign;
    } catch (e) {
        return 0;
    }
  };
  //------------------------------------------
  Game_Battler.prototype.gainHp = function(value) {
    if ($gameTemp._testMight_Type != null) {
      value = value * $gameTemp._testMight_rate;
      $gameTemp._testMight_Type = null;
    }
    this._result.hpDamage = -value;
    this._result.hpAffected = true;
    this.setHp(this.hp + value);
  };
  //------------------------------------------
  var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  Game_Interpreter.prototype.pluginCommand = function(command, args) {
    _Game_Interpreter_pluginCommand.call(this, command, args);
    if (command === 'TestMight') {
      $gameTemp.initialize_TestMight(); // reset flag data for new round.
      $gameSwitches.setValue($gameTemp._testMight_reward, false);
      $gameSwitches.setValue($gameTemp._testMight_lose, false);
      SceneManager._backgroundBitmap = SceneManager.snap();
      for (var i = 1; i < args.length ; i++) {
        text = String(args[i]);
        this.read_aditional_args(text);
      }
      $gameTemp._testMight_Type = String(args[0]);
      SceneManager.push(Scene_TestMight);
    }
  };
  //------------------------------------------
  Game_Interpreter.prototype.read_aditional_args = function(string) {
    var value = 0;
    $gameTemp._testMight_eventID = this._eventId;
    if (text.contains("need")) {
      string = string.replace("need", "");
      value = string.replace(/\[(\d+)\]/gi, function() {
        return parseInt(arguments[1]);
      }.bind(this));
      $gameTemp._testMight_need = Number(value);
      // ----------------------
    } else if (text.contains("resistance")) {
      string = string.replace("resistance", "");
      value = string.replace(/\[(\d+)\]/gi, function() {
        return parseInt(arguments[1]);
      }.bind(this));
      $gameTemp._testMight_resistance = Number(value);
      // ----------------------
    } else if (text.contains("speed")) {
      string = string.replace("speed", "");
      value = string.replace(/\[(\d+)\]/gi, function() {
        return parseInt(arguments[1]);
      }.bind(this));
      $gameTemp._testMight_speed = Number(value);
      // ----------------------
    } else if (text.contains("time")) {
      //value = !isNaN(string); // This Line no work :/
      string = string.replace("time", "");
      value = string.replace(/\[(\d+)\]/gi, function() {
        return parseInt(arguments[1]);
      }.bind(this));
      $gameTemp._testMight_time = Number(value);
      // ----------------------
    } else if (text.contains("reward")) {
      string = string.replace("reward", "");
      value = string.replace(/\[(\d+)\]/gi, function() {
        return parseInt(arguments[1]);
      }.bind(this));
      $gameTemp._testMight_reward = Number(value);
      // ----------------------
    } else if (text.contains("lose")) {
      string = string.replace("lose", "");
      value = string.replace(/\[(\d+)\]/gi, function() {
        return parseInt(arguments[1]);
      }.bind(this));
      $gameTemp._testMight_lose = Number(value);
      // ----------------------
    } else if (text.contains("penalty")) {
      string = string.replace("penalty", "");
      value = string.replace(/\[(\d+)\]/gi, function() {
        return parseInt(arguments[1]);
      }.bind(this));
      $gameTemp._testMight_penalty = Number(value);
      // ----------------------
    } else if (text.contains("color")) {
      string = string.replace("color", "");
      value = string.replace(/\[(\d+)\]/gi, function() {
        return parseInt(arguments[1]);
      }.bind(this));
      $gameTemp._testMight_color = Window_Base.textColor(Number(value));
      // ----------------------
    } else if (text.contains("tcolor")) {
      string = string.replace("tcolor", "");
      value = string.replace(/\[(\d+)\]/gi, function() {
        return parseInt(arguments[1]);
      }.bind(this));
      $gameTemp._testMight_tcolor = Window_Base.textColor(Number(value));
      // ----------------------
    } else if (text.contains("tlocat")) {
      string = string.replace("tlocat", "");
      value = string.replace(/\[(\d+)\]/gi, function() {
        return parseInt(arguments[1]);
      }.bind(this));
      $gameTemp._testMight_tlocat = Number(value);
      // ----------------------
    } else if (text.contains("target")) {
      string = string.replace("target", "");
      value = string.replace(/\[(\d+)\]/gi, function() {
        return parseInt(arguments[1]);
      }.bind(this));
      $gameTemp._testMight_target = Number(value);
      // ----------------------
    } else if (text.contains("dividen")) {
      string = string.replace("dividen", "");
      value = string.replace(/\[(\d+)\]/gi, function() {
        return parseInt(arguments[1]);
      }.bind(this));
      $gameTemp._testMight_dividen = Number(value);
      // ----------------------
    } else if (text.contains("deadzone")) {
      string = string.replace("deadzone", "");
      value = string.replace(/\[(\d+)\]/gi, function() {
        return parseInt(arguments[1]);
      }.bind(this));
      $gameTemp._testMight_deadzone = Number(value);
      // ---------------------- 
    } else if (text.contains("varID")) {
      string = string.replace("varID", "");
      value = string.replace(/\[(\d+)\]/gi, function() {
        return parseInt(arguments[1]);
      }.bind(this));
      $gameTemp._testMight_varID = Number(value);
      // ----------------------
    } else if (text.contains("keys")) {
      string = string.replace("keys", "");
      try { // turn the string command into an array.
        string = string.replace("[", "");
        string = string.replace("]", "");
        value = string.split(',');
        if (value[0].contains("random")) {
          var max = parseInt(value[1]);
          value = new Array(0);
          var index = 0;
          while (value.length < max) {
            var rand = Math.randomInt(4);
            if (rand === 0) {
              value.push('U');
            } else if (rand === 1) {
              value.push('L');
            } else if (rand === 2) {
              value.push('R');
            } else {
              value.push('D');
            }
            index++;
          }
        }
        //throw new Error(value);
        $gameTemp._testMight_keys = value;
      } catch(e) { // if fail print this error.
        throw new Error(e + 'TestMight Incorect Value! ' + string);
      }
      // ----------------------
    } else if (text.contains("vertical")) {
      $gameTemp._testMight_origin = 'vert';
    // -----------------------
    } else if (text.contains("spinning")) {
      $gameTemp._testMight_origin = 'spin';
    }
    //throw new Error('Pulling Value! ' + string + ' ' + value);
    return value;
  };
//============================================================================
// Game Temp
//============================================================================
  var _Game_Temp_initTestMight = Game_Temp.prototype.initialize;
  Game_Temp.prototype.initialize = function() {
    _Game_Temp_initTestMight.call(this);
    this.initialize_TestMight();
  };
  //------------------------------------------
  var parameters = PluginManager.parameters('TestYourMight'); // Define plugin name, Pulls GUI data.
  //------------------------------------------
  Game_Temp.prototype.initialize_TestMight = function() {
    this._testMight_rate        = 0.0;
    this._testMight_Type        = null;                                              // global container for the type of TestMight to perform.
    this._testMight_origin      = 'horiz';                                          // Unless other wise spcified the bar will be horizontal.
    this._testMight_resistance  = Number(parameters['DefualtFILL_resistance'] || 5); // from minus ten each 7/60th second frame removes this much.
    this._testMight_need        = Number(parameters['DefualtFILL_need'] || 250);    // amount that is required to fullfill TestMight.
    this._testMight_speed      = Number(parameters['DefualtSpeed'] || 5);          // defualt speed to use for bars that use it.
    this._testMight_time        = Number(parameters['DefualtTime'] || 10);          // number in seconds.
    this._testMight_reward      = Number(parameters['DefualtWinSwitch'] || 1);      // switch ID # in RMMV database
    this._testMight_lose        = Number(parameters['DefualtLoseSwitch'] || 2);      // switch ID # in RMMV database
    this._testMight_color      = Number(parameters['DefualtBarColor'] || 19);      // color ID # in window skin file
    this._testMight_tcolor      = Number(parameters['DefualtTIMED_barColor'] || 4);  // color ID # in window skin file
    this._testMight_penalty    = Number(parameters['DefualtTIMED_penalty'] || 2);  // number of seconds to pentalize player.
    this._testMight_dividen    = Number(parameters['DefualtCHARGE_dividen'] || 6);  // number to use as a divider for return value out of 1000.
    this._testMight_varID      = Number(parameters['DefualtCHARGE_variable'] || 1); // variable ID to sue to store charge value.
    this._testMight_deadzone    = Number(parameters['DefualtCHARGE_deadzone'] || 32) * 420;// size of deadzone.
    this._testMight_keys        = [];                                                // array container for keys to be pressed.
    this._testMight_current    = null;                                              // container for current key to be pressed.
    this._testMight_eventID    = 0;                                                // stores call event ID number for self switch reffrencing.
    this._testMight_tlocat      = Math.randomInt(100);                              // defaults to random.
    this._testMight_target      = 100 - Math.randomInt(80);                          // defaults to random.
    this._testMight_util        = null;                                              // misc. things.
  };
//============================================================================
// Scene Test Might
//============================================================================
  function Scene_TestMight() {this.initialize.apply(this, arguments)}
  // Inherit parrent class functions.
  Scene_TestMight.prototype = Object.create(Scene_Base.prototype);
  Scene_TestMight.prototype.constructor = Scene_TestMight;
  // set class variable using RMMV Plugin GUI paramiter.                  || Default value to use if not a number.
  //------------------------------------------
  Scene_TestMight.prototype.initialize = function() {
    Scene_Base.prototype.initialize.call(this); // *super()
    this.initialize_variables();
  };
  //------------------------------------------
  Scene_TestMight.prototype.initialize_variables = function() {
    // Clear old switch values
    this._resWait      = 5;
    this._amount      = 0.0;
    this._frameCount  = 0;
    this._isMovingDown = false;
    this._speed        = 0;
    this._startClock  = false;
    this.keysIndex    = 0;
    this._timeMax      = $gameTemp._testMight_time;
    this._buffer      = 0;
    this._makeLag      = Number(parameters['SpriteHoldUp'] || 30); // slows down scene change this many frames, so player can appreciate a job well done.
  };
  //------------------------------------------
  Scene_TestMight.prototype.update = function() {
    if ($gameTemp._testMight_util === 'returning to map') {
      if (this._makeLag > 0) { // slows down the transition so that the player can appreciate the art.
        this._makeLag--;
        return;
      } else {
        this._MightWindow.refresh();
        //throw new Error($gameSwitches.value($gameTemp._testMight_reward) + ' ' + $gameTemp._testMight_reward);
        //$gameMap.requestRefresh(); // Makes events move a step if trying auto run.
        if (SceneManager._scene.constructor != Scene_Battle) {
          SceneManager.goto(Scene_Map);
        }
        return $gameTemp._testMight_rate;
      }
    };
    // --------------------
    // Update count down timer
    if (this._startClock) {
      if (this._frameCount <= 0) {
        if ($gameTemp._testMight_time > 0) {
          $gameTemp._testMight_time--;
        }
        if ($gameTemp._testMight_Type === 'REACT') {
        this._frameCount = 0;
        } else {
        this._frameCount = 60;
        }
      }
      this._frameCount--;
    }
    // --------------------
    // outta time ~ lost
    if ($gameTemp._testMight_time <= 0) {
      var switch_id = $gameTemp._testMight_lose;
      if (switch_id > 0) {
        $gameSwitches.setValue(switch_id, true);
        //var key = [$gameMap._mapId, $gametemp._testMight_eventID, reward]
        //$gameSelfSwitches.setValue(key, true)
      }
      SoundManager.playBuzzer();
      this.returnToMap();
      return 0;
    }
    // --------------------
    // Input Update
    if (this._MightWindow) {
    if ($gameTemp._testMight_Type === 'FILL') {
      this.update_Fill();
      this._MightWindow.refresh_Fill($gameTemp._testMight_rate);
    } else if ($gameTemp._testMight_Type === 'TIMED') {
      this.update_Timed();
      this._MightWindow.refresh_Timed(this._amount);
    } else if ($gameTemp._testMight_Type === 'CHARGE') {
      this._MightWindow.refresh_Charge(this._amount);
      this.update_Charge();
    } else if ($gameTemp._testMight_Type === 'REACT') {
        if (this._buffer <= 0) {
          this.update_React();
        } else {
          this._buffer--;
        }
        this._MightWindow.refresh_React();
        this._startClock = true;
    } else if ($gameTemp._testMight_Type === 'MEMORY') {
       
    }
    this._MightWindow.update();
    }
    // --------------------
    // exit called?
    Scene_Base.prototype.update.call(this); // *super()
    if (Input.isTriggered('cancel')) {
      SoundManager.playBuzzer();
      this.returnToMap();
    }
    // SoundManager.playCursor();
  };
  //------------------------------------------
  Scene_TestMight.prototype.update_Fill = function() {
    // --------------------
    // update resistance factor
    var _resis = $gameTemp._testMight_resistance;
    var _need = $gameTemp._testMight_need;
    if (this._resWait <= 0) {
      if (this._amount > _resis) {
        this._amount -= _resis;
        $gameTemp._testMight_rate = this._amount / _need;
      } else {
        this._amount = 0.0;
        $gameTemp._testMight_rate = 0.0;
      }
      this._resWait = 7;
    } else {
      this._resWait--;
    }
    // --------------------
    // udpate input factor.
    if (Input.isTriggered('ok')) {
      $gameTemp._testMight_util = 'hit space';
      this._startClock = true; // don't start the clock till player starts mashing.
      this._amount += 19.0; // add ammount if mashing
      $gameTemp._testMight_rate = this._amount / _need; // find percentage
    }
    // --------------------
    // was goal reached?
    if ($gameTemp._testMight_rate >= 1.0) {
      var switch_id = $gameTemp._testMight_reward;
      //throw new Error(switch_id)
      if (switch_id > 0) {
        $gameSwitches.setValue(switch_id, true);
        //var key = [$gameMap._mapId, $gameTemp._testMight_eventID, reward];
        //$gameSelfSwitches.setValue(key, true);
      }
      SoundManager.playOk(); // sound test for trigger press.
      this.returnToMap();
    }
  };
  //------------------------------------------
  Scene_TestMight.prototype.update_Timed = function() {
    this._startClock = true; // start clock immediately.
    // --------------------
    // was goal reached?
    if (Input.isTriggered('ok')) {
      $gameTemp._testMight_util = 'hit space';
      if (this._amount > $gameTemp._testMight_tlocat && this._amount < ($gameTemp._testMight_tlocat + $gameTemp._testMight_target)) {
        var switch_id = $gameTemp._testMight_reward;
        if (switch_id > 0) {
          $gameSwitches.setValue(switch_id, true);
        } else {
          var key = [$gameMap._mapId, $gameTemp._testMight_eventID, reward];
          $gameSelfSwitches.setValue(key, true);
        }
        SoundManager.playOk(); // sound test for trigger press.
        $gameTemp._testMight_rate = 1.0;
        this.returnToMap();
      } else { // hit space but was not in target zone.
        SoundManager.playBuzzer();
        $gameTemp._testMight_time = $gameTemp._testMight_time - $gameTemp._testMight_penalty;
        if ($gameTemp._testMight_time < 0) {
          $gameTemp._testMight_time = 0;
          $gameTemp._testMight_rate = 0.25;
        }
      }
      return;
    }
    // --------------------
    // move bar back and forth in zone.
    var max = this._MightWindow.bitmap.width - 20;
    if (this._isMovingDown) {
      this._amount = this._amount - $gameTemp._testMight_speed;
      if (this._amount < 0) {
        this._amount = this._amount * -1;
        this._isMovingDown = false;
      }
      http://SoundManager.playCursor();
    } else { // reverse movement.
      this._amount = this._amount + $gameTemp._testMight_speed;
      if (this._amount >= max) {
        this._amount = max - (this._amount - max);
        this._isMovingDown = true;
        //throw new Error(this._amount + ' ' + max);
      }
      http://SoundManager.playCursor();
    };
  };
  //------------------------------------------
  Scene_TestMight.prototype.update_Charge = function() {
    if (this._resWait > 0) { // Input buffer, would start as soon as it was called other wise.
      this._resWait = this._resWait - 1
      return;
    }
    if (Input.isPressed('ok')) { // Check to see if player is holding space.
      this._isMovingDown = true;
      $gameTemp._testMight_util = 'hold space';
      var max = 100000 + $gameTemp._testMight_deadzone;
      this._amount = this._amount + ($gameTemp._testMight_speed * 196.7);
      if (this._amount >= max) { // over charged bar.
        this._amount = max;
        this._startClock = true;
        $gameTemp._testMight_time = 0;
        $gameTemp._testMight_rate = 100000 / $gameTemp._testMight_dividen;
        $gameVariables.setValue($gameTemp._testMight_varID, $gameTemp._testMight_rate);
        SoundManager.playBuzzer(); // sound for over charge.
        this.returnToMap();
      }
    } else if (this._isMovingDown) { // if player held space and then let go of it.
      $gameTemp._testMight_util = null;
      if (this._amount > 100000) {
        $gameTemp._testMight_rate = 100000 / $gameTemp._testMight_dividen;
        SoundManager.playBuzzer(); // sound for over charge.
      } else {
        $gameTemp._testMight_rate = this._amount;
        SoundManager.playOk(); // sound test for trigger release.
      }
      $gameVariables.setValue($gameTemp._testMight_varID, $gameTemp._testMight_rate);
      this.returnToMap();
    }
  };
  //------------------------------------------
  Scene_TestMight.prototype.update_React = function() { // rpgCore.js  line# 2241
    $gameTemp._testMight_current = $gameTemp._testMight_keys[this.keysIndex];
    if (Input.isTriggered('up')) {
      if ($gameTemp._testMight_current === "U" || $gameTemp._testMight_current === "up") {this.reactRight()} else {this.reactWrong()};
    } else if (Input.isTriggered('left')) {
      if ($gameTemp._testMight_current === "L" || $gameTemp._testMight_current === "left") {this.reactRight()} else {this.reactWrong()};
    } else if (Input.isTriggered('right')) {
      if ($gameTemp._testMight_current === "R" || $gameTemp._testMight_current === "right") {this.reactRight()} else {this.reactWrong()};
    } else if (Input.isTriggered('down')) {
      if ($gameTemp._testMight_current === "D" || $gameTemp._testMight_current === "down") {this.reactRight()} else {this.reactWrong()};
    }
  };
  //------------------------------------------
  Scene_TestMight.prototype.reactRight = function() {
    this._buffer = 3;
    SoundManager.playCursor();
    $gameTemp._testMight_util = 'hit key right';
    this.keysIndex++;
    if (this.keysIndex >= $gameTemp._testMight_keys.length) {
      var switch_id = $gameTemp._testMight_reward;
      if (switch_id > 0) {
        $gameSwitches.setValue(switch_id, true);
        //var key = [$gameMap._mapId, $gameTemp._testMight_eventID, reward];
        //$gameSelfSwitches.setValue(key, true);
      }
      SoundManager.playOk(); // sound test for trigger press.
      this.returnToMap();
      return;
    }
    $gameTemp._testMight_time = this._timeMax;
  };
  //------------------------------------------
  Scene_TestMight.prototype.reactWrong = function() {
    this._buffer = 3;
    $gameTemp._testMight_util = 'hit key wrong';
    SoundManager.playBuzzer();
    $gameTemp._testMight_time = 0;
  };
  //------------------------------------------
  Scene_TestMight.prototype.stop = function() {
    Scene_Base.prototype.stop.call(this);
  };
  //------------------------------------------
  Scene_TestMight.prototype.returnToMap = function() {
    $gameTemp._testMight_util = 'returning to map';
  };
  //------------------------------------------
  Scene_TestMight.prototype.createBackground = function() {
    this._backgroundSprite = new Sprite();
    this._backgroundSprite.bitmap = SceneManager.backgroundBitmap();
    this.addChild(this._backgroundSprite);
  };
  //------------------------------------------
  Scene_TestMight.prototype.create = function() {
    Scene_Base.prototype.create.call(this);
    this.start();
    this.createBackground();
    this.create_Sprite();
  };
  //------------------------------------------
  Scene_TestMight.prototype.create_Sprite = function() {
    this._MightWindow = new Sprite_TestMight();
    this.addChild(this._MightWindow);
  };
  //------------------------------------------
  Scene_TestMight.prototype.exit = function() {
    return ($gameTemp._testMight_util === 'returning to map');
  };
//============================================================================
// Window HUD
//============================================================================
  function Sprite_TestMight() {
    this.initialize.apply(this, arguments);
  }
  Sprite_TestMight.prototype = Object.create(Sprite_Base.prototype);
  Sprite_TestMight.prototype.constructor = Sprite_TestMight;
  //------------------------------------------
  Sprite_TestMight.prototype.initialize = function() {
    Sprite_Base.prototype.initialize.call(this);
    this.windowskin = ImageManager.loadSystem('Window');
    this.show(); // un hide sprite, Hidden by defualt.
    this.bitmap = new Bitmap(200, 50);
    this.setFrame(0, 0, this.bitmap.width, this.bitmap.height);
    this.centerSelf();
    http://this.x = 32; this.y = 32;
    this._frame_count = 0;
    this._spinCount = 0;
    this.update();
  };
  //------------------------------------------
  // Refresh properties for bar FILL with arguments passed
  // threw the scene class.
  Sprite_TestMight.prototype.refresh_Fill = function(rate) {
    if (this.bitmap) {
      this.bitmap.clear();
      this.draw_windowBack();
      var _lH = 36; // get line hight for sepreating multi lines.
      this.bitmap.drawText('*Mash* !SPACE! Time:' + $gameTemp._testMight_time + '!', 10, 0, this.bitmap.width - 20, _lH, 'left');
      var _color1 = this.getColor($gameTemp._testMight_color);
      if ($gameTemp._testMight_util === 'hit space') { // heptic feed back
        var _color2 = this.getColor(9);
        this.x = this.x - 2;
        this.y = this.y - 2;
        $gameTemp._testMight_util = null;
      } else { // normal color
        this.centerSelf();
        var _color2 = this.getColor(9);
      }
      var x = 0;
      var y = 0;
      var img = ImageManager.loadSystem('Smash10'); // must be png format!
      this.bitmap.blt(img, 0, 0, img.width, img.height, x, y);
      this.drawGauge(10, 10, this.bitmap.width - 20, rate, _color2, _color1);
      http://SoundManager.playCursor();
    }
  };
  //------------------------------------------
  // Refresh properties for bar TIMED with arguments passed
  // threw the scene class.
  Sprite_TestMight.prototype.refresh_Timed = function(bar_loc) {
    if (this.bitmap) {
      this.bitmap.clear();
      var _lH = 36; // get line hight for sepreating multi lines.
      var _color2 = this.getColor(8);
      var _color3 = this.getColor($gameTemp._testMight_tcolor);
      if ($gameTemp._testMight_origin === 'spin') { // spin type
        http://this.regX = this.bitmap.width / 2;  // doesnt work
        http://this.regY = this.bitmap.height / 2;// doesnt work
        this.anchor.x = 0.5; // float point of offset of center
        this.anchor.y = 0.5; // float point of offset of center
        //if (this._frame_count % 10 === 0)  // this ones funny
        //  this.rotation += 4; // rotate bitmap // goes with above.
        if (this._spinCount <= 0) {
          this.rotation += 0.25;
          this._spinCount = 6;
        } else {
          this._spinCount--;
        }
        var _bar_thickness = 8;
        this.bitmap.fillRect(10, this.bitmap.height / 2, this.bitmap.width - 20, _bar_thickness, _color2);
        var _tarBarL = $gameTemp._testMight_tlocat;
        var _tarBarT = $gameTemp._testMight_target;
        this.bitmap.fillRect(10 + _tarBarL, this.bitmap.height / 2, _tarBarT, _bar_thickness, _color3);
      } else { // normal bar type, horizontal
        this.draw_windowBack();
        var _bar_thickness = 6;
        this.bitmap.fillRect(10, _lH, this.bitmap.width - 20, _bar_thickness, _color2);
        var _tarBarL = $gameTemp._testMight_tlocat;
        var _tarBarT = $gameTemp._testMight_target;
        this.bitmap.fillRect(10 + _tarBarL, _lH, _tarBarT, _bar_thickness, _color3);
      }
      // update depending on space bar being triggered or not.
      if ($gameTemp._testMight_util === 'hit space') { // flash the selection bar a diffrent color for hptic feed back.
        var _color1 = this.getColor(18);
        this.y = this.y - 2;
        _bar_thickness = _bar_thickness * 1.5;
        $gameTemp._testMight_util = null;
      } else { // use normal color
        this.centerSelf();
        var _color1 = this.getColor($gameTemp._testMight_color);
      }
      var _bar_width = 6;
      if ($gameTemp._testMight_origin === 'spin') {
        this.bitmap.fillRect(10 + bar_loc - 3, this.bitmap.height / 2, _bar_width, _bar_thickness, 16);
        this.bitmap.fillRect(10 + bar_loc - 2, (this.bitmap.height / 2) + 1, _bar_width - 2, _bar_thickness - 2, _color1); // outline
      } else {
        this.bitmap.fillRect(10 + bar_loc - 3, _lH, _bar_width, _bar_thickness, 16);
        this.bitmap.fillRect(10 + bar_loc - 2, _lH + 1, _bar_width - 2, _bar_thickness - 2, _color1); // outline
      }
      http://SoundManager.playCursor();
      if ($gameTemp._testMight_origin === 'horiz') {
        this.bitmap.drawText('*Time* !SPACE! Timer:' + $gameTemp._testMight_time + '!', 10, 0, this.bitmap.width -20, _lH, 'center');
      }
    }
  };
  //------------------------------------------
  // Refresh properties for bar Charge with arguments passed
  // threw the scene class.
  Sprite_TestMight.prototype.refresh_Charge = function(bar_loc) {
    if (this.bitmap) {
      this.bitmap.clear();
      this.draw_windowBack();
      var max = 100000 + $gameTemp._testMight_deadzone;
      var _lH = 36; // get line hight for sepreating multi lines.
      var _color2 = this.getColor(8);
      var _bar_thickness = 6;
      this.bitmap.fillRect(10, _lH, this.bitmap.width - 20, _bar_thickness, _color2);
      // make dead zone on the end of bar.
      var deadZone = (this.bitmap.width - 20) * ($gameTemp._testMight_deadzone / max);
      var x = this.bitmap.width - 15 - deadZone;
      this.bitmap.fillRect(x , _lH, deadZone + 5, _bar_thickness, 'rgba(250,30,30,240)');
      if ($gameTemp._testMight_util === 'hold space') { // flash the charge bar when holding space
        this.y = (Graphics.height / 2) - (this.bitmap.height / 2) - 2;
        if (bar_loc <= 100000) { // reflect color of bar to charge amount.
          var r = Math.round(255 * (bar_loc / 100000));
          var g = 0;
          var b = Math.round(255 - (255 * (bar_loc / 100000)));
          var _color1 = 'rgba(' + r + ',' + g + ',' + b + ',255)'
        } else { // over charged
          var _color1 = 'rgba(180,180,180,240)'
        }
      } else { // use normal color if released space
        this.centerSelf();
        var _color1 = this.getColor($gameTemp._testMight_color);
      }
      // If detected SimpleColor plugin, call a color from it.
      if (PluginManager._scripts.contains('SimpleColor')) {
        try {
          _color1 = $gameTemp.getRandomColor();
        } catch(e) {throw new Error(e); }
      }
      //            ---------------------------
      var _bar_width = (this.bitmap.width - 20) * (bar_loc / max);
      this.bitmap.fillRect(10, _lH, _bar_width, _bar_thickness, _color1);
      http://SoundManager.playCursor();
      if (bar_loc > 100000) {
        this.bitmap.drawText('!OVER CHARGED!', 10, 0, this.bitmap.width - 20, _lH, 'left');
      } else if (bar_loc > 92000) {
        this.bitmap.drawText('Release *!SPACE!*', 10, 0, this.bitmap.width - 20, _lH, 'left');
      } else {
        this.bitmap.drawText('*Charge* Hold !SPACE!', 10, 0, this.bitmap.width - 20, _lH, 'left');
      }
    }
  };
  //------------------------------------------
  // Refresh properties for bar Charge with arguments passed
  // threw the scene class.
  Sprite_TestMight.prototype.refresh_React = function() {
    if (this.bitmap) {
      this.bitmap.clear();
      this.draw_windowBack();
      var _lH = 36;
      var key = $gameTemp._testMight_current;
      this.bitmap.drawText('Press ' + key + '!', 10, 0, this.bitmap.width - 20, _lH, 'left');
      var a = $gameTemp._testMight_time / 60;
      var time = Math.round(a * 100.0) / 100.0;
      this.bitmap.drawText('Time: ' + time, 10, 20, this.bitmap.width - 20, _lH, 'left');
    }
  };
  //------------------------------------------
  // center sprite on screen
  Sprite_TestMight.prototype.centerSelf = function() {
    this.x = (Graphics.width / 2) - (this.bitmap.width / 2);
    this.y = (Graphics.height / 2) - (this.bitmap.height / 2);
  };
  //------------------------------------------
  // draws baground objects for TestMight Sprite
  Sprite_TestMight.prototype.draw_windowBack = function() {
    var _border_size = 4;
    var _color = this.getColor(19); // draw "outline"
    this.bitmap.fillRect(0, 0, this.bitmap.width, this.bitmap.height, _color);
    if (this._frame_count > 29) { // draw "fill" *flashy* -lol
      _color = this.getColor(30);
    } else {
      _color = this.getColor(31);
    }
    this.bitmap.fillRect(_border_size / 2, _border_size / 2, this.bitmap.width - _border_size, this.bitmap.height - _border_size, _color);
  };
  //------------------------------------------
  Sprite_TestMight.prototype.update = function() {
    Sprite_Base.prototype.update.call(this); // *super()
    // throw new Error('Got to update!');
    // majority of the updating is done in the Scene class and
    // passsed threw refresh calls to this one.
    this._frame_count++;
    if (this._frame_count > 60) {
      this._frame_count = 0;
    };
  };
  //------------------------------------------
  // Basic Sprite refresh call
  Sprite_TestMight.prototype.refresh = function() {
    if (this.bitmap) {
      this.bitmap.clear();
      http://this.draw_windowBack();
    }
  };
  //------------------------------------------
  Sprite_TestMight.prototype.drawGauge = function(x, y, width, rate, color1, color2) {
    if (rate > 1.0) {rate = 1.0};
    var fillW = Math.floor(width * rate);
    var gaugeY = y + 28;
    this.bitmap.fillRect(x, gaugeY, width, 6, color2);
    this.bitmap.fillRect(x, gaugeY, fillW, 6, color1);
  };
  //------------------------------------------
  Sprite_TestMight.prototype.getColor = function(n) {
    var px = 96 + (n %  * 12 + 6;
    var py = 144 + Math.floor(n /  * 12 + 6;
    return this.windowskin.getPixel(px, py);
  };
  //------------------------------------------------------------------------------
  PluginManager.checkPluginInstalled = function(name) {
    return this._scripts.includes(name);
  };
 //================================================================================
})(); // End of plugin block.
EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator
#8 Re: Test Might
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
looking forward to memory and react! Cool
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
#9 Re: Test Might
Loading

Sponsored content

profile

View previous topic View next topic Back to top Message [Page 1 of 1]

 

Chatbox system disabled
Personal messaging disabled