Advertisement
kura2yamato

GWComboSwitch.js

May 13th, 2024 (edited)
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //---------------------------------------------------------
  2. // GWComboSwitch.js
  3. // Copyright (c) 2024 GBison. All rights reserved.
  4. // Released under the MIT license.
  5. // http://opensource.org/licenses/mit-license.php
  6. //=========================================================
  7.  
  8. /*:
  9.  * @plugindesc Combo System By Checking the Switch.
  10.  * @author Gbison
  11.  * @version 1
  12.  *
  13.  * @param Plugin Version
  14.  * @desc Version for the Plugins
  15.  *
  16.  * @param Version
  17.  * @type number
  18.  * @default 0
  19.  * @parent Plugin Version
  20.  *
  21.  * @param Sub Version
  22.  * @type number
  23.  * @range 0,99
  24.  * @desc Variable to Use
  25.  * @default 0
  26.  * @parent Plugin Version
  27.  *
  28.  * @param Condition
  29.  * @desc Condition For Action
  30.  *
  31.  * @param Combo Condition
  32.  * @desc Condition For Combo
  33.  * @parent Condition
  34.  *
  35.  * @param Combo Switch
  36.  * @type switch
  37.  * @default 10
  38.  * @desc Switch to use
  39.  * @parent Combo Condition
  40.  *
  41.  * @param Combo Variable
  42.  * @type variable
  43.  * @default 10
  44.  * @desc Variable to Use
  45.  * @parent Combo Condition
  46.  *
  47.  * @param Slice Condition
  48.  * @desc Condition For Slice
  49.  * @parent Condition
  50.  *
  51.  * @param Slice Switch
  52.  * @type switch
  53.  * @default 11
  54.  * @desc Switch to use
  55.  * @parent Slice Condition
  56.  *
  57.  * @param Slice Variable
  58.  * @type variable
  59.  * @default 11
  60.  * @desc Variable to Use
  61.  * @parent Slice Condition
  62.  *
  63.  * @param Strike Condition
  64.  * @desc Condition For Strike
  65.  * @parent Condition
  66.  *
  67.  * @param Strike Switch
  68.  * @type switch
  69.  * @default 12
  70.  * @desc Switch to use
  71.  * @parent Strike Condition
  72.  *
  73.  * @param Strike Variable
  74.  * @type variable
  75.  * @default 12
  76.  * @desc Variable to Use
  77.  * @parent Strike Condition
  78.  *
  79.  * @param Stab Condition
  80.  * @desc Condition For Stab
  81.  * @parent Condition
  82.  *
  83.  * @param Stab Switch
  84.  * @type switch
  85.  * @default 13
  86.  * @desc Switch to use
  87.  * @parent Stab Condition
  88.  *
  89.  * @param Stab Variable
  90.  * @type variable
  91.  * @default 13
  92.  * @desc Variable to Use
  93.  * @parent Stab Condition
  94.  *
  95.  * @help
  96.  * Copyright (c) 2024 GBison. All rights reserved.
  97.  * Released under the MIT license.
  98.  * ===================================================================
  99.  * The Idea from JoeBumpster
  100.  * https://forums.rpgmakerweb.com/index.php?threads/no-idea-why-this-switch-wont-flip.168634/
  101.  * To use this, just run plugin
  102.  *     GWComboStat ComboIncrease
  103. */
  104.  
  105. (function() {
  106.     // parameters
  107.     var _thisPluinName = 'GWComboSwitch'; //change with your filename.
  108.     var parameters = PluginManager.parameters(_thisPluinName);
  109.  
  110.     var _combo = {
  111.         "switch": Number(parameters['Combo Switch'] || 10),
  112.         "variable": Number(parameters['Combo Variable'] || 10)
  113.     };
  114.     var _slice = {
  115.         "switch": Number(parameters['Slice Switch'] || 11),
  116.         "variable": Number(parameters['Slice Variable'] || 11)
  117.     };
  118.     var _strike = {
  119.         "switch": Number(parameters['Strike Switch'] || 12),
  120.         "variable": Number(parameters['Strike Variable'] || 12)
  121.     };
  122.     var _stab = {
  123.         "switch": Number(parameters['Stab Switch'] || 13),
  124.         "variable": Number(parameters['Stab Variable'] || 13)
  125.     };
  126.  
  127.     var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  128.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  129.         _Game_Interpreter_pluginCommand.call(this, command, args);
  130.         runPlugins = false;
  131.         if (command === 'GWComboStat') {
  132.             switch (args[0]) {
  133.                 case 'ComboIncrease':
  134.                     $gameSystem.ComboIncrease();
  135.                     runPlugins = [command, args];
  136.                     break;
  137.             }
  138.  
  139.         }
  140.  
  141.     };
  142.  
  143.     Game_System.prototype.ComboIncrease = function() {
  144.  
  145.         let listCond = [];
  146.         let switchID = 0;
  147.         let varID = 0;
  148.         let oldValue = 0;
  149.         let switchStat = 0;
  150.         //=====combo=================
  151.         listCond = _combo;
  152.  
  153.         switchID = listCond.switch;
  154.         varID = listCond.variable;
  155.         oldValue = $gameVariables.value(varID);
  156.         switchStat = $gameSwitches.value(switchID);
  157.         /*Check result*/
  158.         if (switchStat) {
  159.             $gameVariables.setValue(varID, ++oldValue);
  160.             $gameSwitches.setValue(switchID, 0);
  161.         }
  162.         //=====SLICE=================
  163.         listCond = _slice;
  164.  
  165.         switchID = listCond.switch;
  166.         varID = listCond.variable;
  167.         oldValue = $gameVariables.value(varID);
  168.         switchStat = $gameSwitches.value(switchID);
  169.         /*Check result*/
  170.         if (switchStat) {
  171.             $gameVariables.setValue(varID, ++oldValue);
  172.             $gameSwitches.setValue(switchID, 0);
  173.         }
  174.  
  175.  
  176.         //=====STRIKE=================
  177.         listCond = _strike;
  178.  
  179.         switchID = listCond.switch;
  180.         varID = listCond.variable;
  181.         oldValue = $gameVariables.value(varID);
  182.         switchStat = $gameSwitches.value(switchID);
  183.         /*Check result*/
  184.         if (switchStat) {
  185.             $gameVariables.setValue(varID, ++oldValue);
  186.             $gameSwitches.setValue(switchID, 0);
  187.         }
  188.  
  189.  
  190.         //=====STAB=================
  191.         listCond = _stab;
  192.  
  193.         switchID = listCond.switch;
  194.         varID = listCond.variable;
  195.         oldValue = $gameVariables.value(varID);
  196.         switchStat = $gameSwitches.value(switchID);
  197.         /*Check result*/
  198.         if (switchStat) {
  199.             $gameVariables.setValue(varID, ++oldValue);
  200.             $gameSwitches.setValue(switchID, 0);
  201.         }
  202.  
  203.     };
  204.  
  205.  
  206.  
  207. })();
  208.  
  209. /*
  210. The Idea from JoeBumpster
  211.  https://forums.rpgmakerweb.com/index.php?threads/no-idea-why-this-switch-wont-flip.168634/
  212. I have a combo system in my game which increases a variable by 1 for each time you land a hit. The way I have it registering if the attack landed or not is by flipping a switch on whenever
  213. Source:
  214. https://forums.rpgmakerweb.com/index.php?threads/no-idea-why-this-switch-wont-flip.168634/
  215.  
  216. Refference:
  217. https://forums.rpgmakerweb.com/index.php?threads/parameter-structs.105978/
  218. https://docs.google.com/document/d/1Ep71x_l0BVbNkyW2-b_63Li8UFZcAyJQVSNQL-C7ETI/edit?usp=sharing
  219. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement