Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*=============================================================================
- * Gilgamar - ButtonCast
- * By Gilgamar
- * G_ButtonCast.js
- * Version: 1
- * Free for commercial and non commercial use.
- *=============================================================================*/
- /*:
- * @plugindesc v1.0 Adds ability to instantly cast skills with button.
- * @author Gilgamar
- *
- * @param Skill 1
- * @desc ID of skill to bind to key 1
- * Default: 1
- * @default 1
- */
- var parameters = PluginManager.parameters('G_ButtonCast');
- // console.log(parameters)
- var ButtonCast = {};
- ButtonCast.battler = 2 // Pick battler here
- ButtonCast.skill1 = Number(parameters['Skill 1']);
- var skillKeys = [1,2,3,4,5,6,7,8,9];
- // Make sure game can poll keys 1-9
- Input.keyMapper[49] = '1';
- Input.keyMapper[50] = '2';
- Input.keyMapper[51] = '3';
- Input.keyMapper[52] = '4';
- Input.keyMapper[53] = '5';
- Input.keyMapper[54] = '6';
- Input.keyMapper[55] = '7';
- Input.keyMapper[56] = '8';
- Input.keyMapper[57] = '9';
- var aliasPluginCommand = Game_Interpreter.prototype.pluginCommand;
- Game_Interpreter.prototype.pluginCommand = function(command, args) {
- aliasPluginCommand.call(this, command, args);
- if (command == 'ButtonCast') {
- switch (args[0]) {
- case 'init':
- break;
- }
- }
- }
- function checkInput() {
- for (var i = 0; i < skillKeys.length; i++){
- k = skillKeys;
- if (Input.isPressed(String(k))) return k;
- }
- return null;
- }
- function runSkill(k, battleManager) {
- var battler = $gameParty.battleMembers()[ButtonCast.battler];
- action = new Game_Action(battler);
- action.setSkill(9);
- battler._actions.push(action);
- // battleManager.startATBInput(battler); // Use this to select an action in battle
- battleManager.startATBAction(battler);
- }
- //----------------------------------------------------------------------------//
- // YANFLY OVERRIDES
- BattleManager.updateATBTicks = function() {
- k = checkInput();
- if (k) runSkill(k, this);
- this._atbTicks += 1 * this.tickRate();
- if (this._atbTicks < this._atbFullTurn) return;
- $gameTroop.increaseTurn();
- this._atbTicks = 0;
- if (this.isTurnBased()) {
- this.endTurn();
- } else {
- this.endTurn();
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment