Using skills in battle via Button Input

Greetings everyone - I had a problem writing my own scripts for RPG Maker MV, so I thought I would request something.


Disclaimer: I checked all possible plugins for MV, none could provide the functionality for me. I also tried scripting myself, but I cannot understand RPG Maker's structure at all....


- Currently using Yanfly's Engine, and ATB Plugin. 


Question:


Is there a way to Bind SPECIFIC KEYBOARD KEYS in battle to trigger the character to use a desired skill? 


I am trying to make something like this:


Pressing A, S, D, F or G on the keyboard during ATB system battles would bring in a script that works like this:


if (character_with_ID_1_current_MP >=  X) {


 use_Skill_with_ID_x_on(target)


decrease_character_with_ID_1_MP_by_X


}


else {


play sound file


};


Or to be more specific:


I want to make it so that, at any time while the ATB guage charges for the main character (there is literally only one character in our team), if I press a desired button on the keyboard, the character will unleash a skill (either on all enemies OR a random target OR target chosen via a parameter evaluation, like Highest HP) IF he has enough MP to do the action, otherwise he gets a "no-MP" sound out. Everything else works like normal in Yanfly's ATB script, even our main character gets to make a move, once his ATB fills up. 


I know a tiny bit of Java Script, but I am entirely new to RPG Maker and its incredibly hard to understand how I access its functions or items(skills, actors, etc.) in the database... 


Can someone help me with writing a script for this?


Or, if you would be so kind, direct me to somewhere where I could learn how to access Battle.Manager's functions? I tried skimming through it, but the code tells me nothing in how it accesses the database... I tried reading the Help File, but I am too new to RPG Maker perhaps...  Searching online only gets me ready scripts. I am somehow missing tutorials or documentation (if it exists) on how to use the existing functions in MV. 


You could say my main problem is "I kinda know the syntax and some standard functions of JS, but have no idea what RPG Maker does with its functions..."


Also I tried to use Events to call a common event in battle, but using Force Action crashes the game. So... yes. Common Events seem to not work with the ATB system....


I kindly ask for your support here. 
It seems like this might be what you need?


http://yanfly.moe/2015/10/30/yep-22-instant-cast-2/


Although it doesn't seem to have input control..
It seems like this might be what you need?


http://yanfly.moe/2015/10/30/yep-22-instant-cast-2/


Although it doesn't seem to have input control..

Oi, that would be a part of it I assume... might be wrong. I just don't know how to bind skills to input at the ready during battles.


This actually might be a harder problem than it looks to be honest. 


I am more used to how Unity works - since it has the "Update" function in which you put your code that needs to be checked each frame. I assume that Yanfly's ATB system has some kind of "tick" as well that updates actions and THAT is where I would put the code of "If button is held down, do attack, otherwise run the rest of the code".


Alas... I dunno how to access "skills" to be used regardless... 
I was just looking at that tick. I think that's the key. Find yanfly's function that checks tick or updates the ATB bar and throw in a custom function to poll user input, such as Input.isPressed('1'). As for the player skills, hp and other stats check out the $gameActor class. Something like actor = $gameActors.actor(1) will give you access to actor 1's stats. As for battler functions the actor class inherits from Game_Battler and Game_BattlerBase and I think battle based functions are in there although I haven't tried using it myself.


If you can find yanfly's tick function you can probably override it or extend it in your own custom plugin, have it checkInput() then in checkInput() have a big switch statement for all your keys you wanna bind to, then do something with parameters to bind keys to skills. I haven't done much scripting in the Battle scene but I have a similar requirement to poll a function during battle in parallel so I will look into this.


Oh and check out these split source files if you're reading up on the game classes, I found it helpful.
I think this might be the ticker function:

Spoiler
Code:
BattleManager.updateATBTicks = function() {
    this._atbTicks += 1 * this.tickRate();
    if (this._atbTicks < this._atbFullTurn) return;
    $gameTroop.increaseTurn();
    this._atbTicks = 0;
    if (this.isTurnBased()) {
      this.endTurn();
    } else {
      this.endTurn();
    }
};
Thanks a lot Gilgamar. I'll definitelly try it out, although if someone else also has any ideas, I'll be glad to hear more input on this. 


I'll give this a try tomorrow after work. Judging from the script.... When update ATBTicks is called, it will add +1 to the tick counter, afterwards if atbTicks variable is less than atbFullTurn (which I guess is asking if the ATB gauge is full) will do something in the code.... probably tick again.

Afterwards if the gauge is full, it will increase the Turn count.... and will reset the Ticks. 


SO I guess I put the function for Input listening before it checks if the ticks are full or not.
It works as expected. I had it run checkInput() for every tick, 157 in total with the default player stats. It called my function on every tick. Now I'm just having trouble getting it to poll the user input.... doesn't seem to work in battle.


Update:


Okay so Input.isPressed() works for default keys but not the extended keys that Yanfly added. I thought maybe Yanfly updated isPressed() to work for all keys but I guess not. Or it could be that it's only added if I assign it to a common event, which we don't necessarily want...
I did it!


Demo Video:


https://drive.google.com/open?id=0B8xGgxim_gkbNlh1amlzcEJMZGM


Script:

Spoiler
/*=============================================================================
* 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();
}
};






Explanation:
There is a lot of 'template' stuff in there that isn't being used at present such as parameters and plugin calls. The main bit is checkInput(), runSkill(), and the first two lines in updateATBTicks().


I'd like to add the parameter option to set the skills bound to keys 1-9 as currently I've hard-coded the fire skill (id 9) to key 1.


Terms of Use/Credits:


You can do whatever you like with this even claim it as your own as long as you put me down as an additional source/credits. You can credit me as Gilgamar. If you want to work together on this to make it more professional and fully featured I'm up for that as well. This is a really rough template and I'd love to keep working on it as it's really cool.
Smashing work out there Gilgamar!


I did a few really minor tweaks to it. First of all, I put DMV's FullKeyboardInput plugin above yours and pulled the ASD keys from it into the script. Afterwards I set the skills to be respective increments based on button order (put your skillKeys array directly into the action.setSkill(k)) . (So the 1st assigned button will cast Skill 1, 2nd Assigned button casts skill 2, etc.)


Script:

Spoiler
/*=============================================================================
* 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 = 1 // 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[65] = '1';
Input.keyMapper[83] = '2';
Input.keyMapper[68] = '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(k);
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();
}
};




It still needs one more function - checking the skill cost before firing. Technically that can be set by Eventing - which is what I did. You can set the skill to do nothing and set their MP as a variable. Then it uses a conditional branch to determine whether to Force Action or to state there is not enough MP for it. 


Works alright, but is a work-around solution.


I don't have the time right now, but I'll take another jab at it later.


Also, it would be great to work with you on this script. It would be a minor extension to Yanfly's ATB system, but it might provide interesting gameplay options. 
Update:


I updated the script to include parameters now. You can bind any skill ID to keys 1-9 using the plugin manager. Down on line 61 you can change the active battler, I could add this as a parameter too. I set it to 0 to use the first actor as the button caster. If you have more than one party member you can change it to use them instead. There are no plugin calls. It just works as is if included in a project and turned ON.


It does not check if the actor actually has the skill bound to the hotkey but that shouldn't be too hard to add, I think there is a $gameActors.actor(1).isLearned(skillId) command that can check for that. It will automatically consume MP/TP if necessary and reset the ATB bar since I am using the built-in game functions I didn't need to do anything extra there.


If you want to use keys other than 1-9 you can check the key mapper in Yanfly's ButtonCommonEvents.js plugin to get the appropriate settings. As long as you include the Input.keyMapper entry for the key needed you shouldn't need any other scripts to make it work.


Notes:


At present this plugin requires Yanfly's core, battle engine and ATB system.


startATBAction(battler) command already does the required work for MP/TP consumption since it is an extension of the games own startAction(battler) function and does all the checking for damage, skill cost, enemy died etc.


Future Work:


1. Need to check if actor has the bound skill


2. Add support for more skill keys


3. Add parameter for button caster (which actor to use), It seems like it would be possible to have different key sets tied to different actors for even more immersion


4. Any other suggestions?

Spoiler
Code:
/*=============================================================================
 * 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
 *
 * @param Skill 2
 * @desc ID of skill to bind to key 2
 * Default: 2
 * @default 2
 *
 * @param Skill 3
 * @desc ID of skill to bind to key 3
 * Default: 3
 * @default 3
 *
 * @param Skill 4
 * @desc ID of skill to bind to key 4
 * Default: 4
 * @default 4
 *
 * @param Skill 5
 * @desc ID of skill to bind to key 5
 * Default: 5
 * @default 5
 *
 * @param Skill 6
 * @desc ID of skill to bind to key 6
 * Default: 6
 * @default 6
 *
 * @param Skill 7
 * @desc ID of skill to bind to key 7
 * Default: 7
 * @default 7
 *
 * @param Skill 8
 * @desc ID of skill to bind to key 8
 * Default: 8
 * @default 8
 *
 * @param Skill 9
 * @desc ID of skill to bind to key 9
 * Default: 9
 * @default 9
 */
var parameters = PluginManager.parameters('G_ButtonCast');
// console.log(parameters)
var ButtonCast = {};
ButtonCast.battler = 0 // Pick battler here
ButtonCast.skill1 = Number(parameters['Skill 1']);
ButtonCast.skill2 = Number(parameters['Skill 2']);
ButtonCast.skill3 = Number(parameters['Skill 3']);
ButtonCast.skill4 = Number(parameters['Skill 4']);
ButtonCast.skill5 = Number(parameters['Skill 5']);
ButtonCast.skill6 = Number(parameters['Skill 6']);
ButtonCast.skill7 = Number(parameters['Skill 7']);
ButtonCast.skill8 = Number(parameters['Skill 8']);
ButtonCast.skill9 = Number(parameters['Skill 9']);
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[i];
        if (Input.isPressed(String(k))) return k;
    }
    return null;
}
function runSkill(k, battleManager) {
    var battler = $gameParty.battleMembers()[ButtonCast.battler];
    action = new Game_Action(battler);
    if (k === 1) action.setSkill(ButtonCast.skill1);
    if (k === 2) action.setSkill(ButtonCast.skill2);
    if (k === 3) action.setSkill(ButtonCast.skill3);
    if (k === 4) action.setSkill(ButtonCast.skill4);
    if (k === 5) action.setSkill(ButtonCast.skill5);
    if (k === 6) action.setSkill(ButtonCast.skill6);
    if (k === 7) action.setSkill(ButtonCast.skill7);
    if (k === 8) action.setSkill(ButtonCast.skill8);
    if (k === 9) action.setSkill(ButtonCast.skill9);
    battler._actions.push(action); // Add action to queue
    // battleManager.startATBInput(battler); // Use this to select an action in battle
    battleManager.startATBAction(battler); // Execute action
}
//----------------------------------------------------------------------------//
// 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();
    }
};
That's a really cool script Gilgamar! You should totally release it in the plugin releases section since it's really awesome, it works really well for a fast paced game and would work AMAZINGLY with Tamfey's plugin HERE, to make a cool hand to hand combat minigame!
@Kloe Thanks! I'm going to release it when it's a bit more polished and tested. I've barely spent any time on it thus far. That Time Attack script looks really cool also, I'll have to check it out.
Update 1.01:


+Select actor to use button cast in parameter


+Bind skills to a,s,d keys in parameter


+Buttons not activated unless skill is assigned in parameter


+Skill assignments are now stored in ButtonCast.keyList for easier iteration and access


+Simplified checkInput() function for scalability


+The runSkill() function now checks if user has the skill and plays buzzer sound if not (added cool down timer to prevent overlapping sound effects)

Spoiler
Code:
/*=============================================================================
 * Gilgamar - ButtonCast
 * By Gilgamar
 * G_ButtonCast.js
 * Version: 1.01
 * Free for commercial and non commercial use.
 *=============================================================================*/
/*:
 * @plugindesc v1.0 Adds ability to instantly cast skills with button.
 * @author Gilgamar
 *
 * @param Actor
 * @desc ID of actor to use button cast
 * @default 0
 *
 * @param Key 1
 * @desc ID of skill to bind to key
 * @default 0
 *
 * @param Key 2
 * @desc ID of skill to bind to key
 * @default 0
 *
 * @param Key 3
 * @desc ID of skill to bind to key
 * @default 0
 *
 * @param Key 4
 * @desc ID of skill to bind to key
 * @default 0
 *
 * @param Key 5
 * @desc ID of skill to bind to key
 * @default 0
 *
 * @param Key 6
 * @desc ID of skill to bind to key
 * @default 0
 *
 * @param Key 7
 * @desc ID of skill to bind to key
 * @default 0
 *
 * @param Key 8
 * @desc ID of skill to bind to key
 * @default 0
 *
 * @param Key 9
 * @desc ID of skill to bind to key
 * @default 0
 *
 * @param Key A
 * @desc ID of skill to bind to key
 * @default 0
 *
 * @param Key S
 * @desc ID of skill to bind to key
 * @default 0
 *
 * @param Key D
 * @desc ID of skill to bind to key
 * @default 0
 */

var parameters = PluginManager.parameters('G_ButtonCast');
// console.log(parameters)
var ButtonCast = {};
ButtonCast.battler = Number(parameters['Actor']);
ButtonCast.keyList = {
    1: Number(parameters['Key 1']),
    2: Number(parameters['Key 2']),
    3: Number(parameters['Key 3']),
    4: Number(parameters['Key 4']),
    5: Number(parameters['Key 5']),
    6: Number(parameters['Key 6']),
    7: Number(parameters['Key 7']),
    8: Number(parameters['Key 8']),
    9: Number(parameters['Key 9']),

    a: Number(parameters['Key A']),
    s: Number(parameters['Key S']),
    d: Number(parameters['Key D'])
}

if (ButtonCast.keyList['1'] !== 0) Input.keyMapper[49]          = '1';
if (ButtonCast.keyList['2'] !== 0) Input.keyMapper[50]          = '2';
if (ButtonCast.keyList['3'] !== 0) Input.keyMapper[51]          = '3';
if (ButtonCast.keyList['4'] !== 0) Input.keyMapper[52]          = '4';
if (ButtonCast.keyList['5'] !== 0) Input.keyMapper[53]          = '5';
if (ButtonCast.keyList['6'] !== 0) Input.keyMapper[54]          = '6';
if (ButtonCast.keyList['7'] !== 0) Input.keyMapper[55]          = '7';
if (ButtonCast.keyList['8'] !== 0) Input.keyMapper[56]          = '8';
if (ButtonCast.keyList['9'] !== 0) Input.keyMapper[57]          = '9';

if (ButtonCast.keyList['a'] !== 0) Input.keyMapper[65]          = 'a';
if (ButtonCast.keyList['s'] !== 0) Input.keyMapper[83]          = 's';
if (ButtonCast.keyList['d'] !== 0) Input.keyMapper[68]          = 'd';

// 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 k in ButtonCast.keyList){
        if (Input.isPressed(String(k))) return k;
    }
    return null;
}

function runSkill(k, battleManager) {
    var battler = $gameParty.battleMembers()[ButtonCast.battler];
    action = new Game_Action(battler);
    skillId = ButtonCast.keyList[k];
    // console.log(battler);
    if (!battler.isLearnedSkill(skillId)){
        if (!battleManager.sePlaying){
            SoundManager.playBuzzer();
            battleManager['sePlaying'] = 10; // Cooldown timer for sound effect to prevent overlap
        }
        return;
    }
    // console.log(skillId);
    action.setSkill(skillId)
    battler._actions.push(action); // Add action to queue
    // battleManager.startATBInput(battler); // Use this to select an action in battle
    battleManager.startATBAction(battler); // Execute action
}

//----------------------------------------------------------------------------//
// YANFLY OVERRIDES

BattleManager.updateATBTicks = function() {
    k = checkInput();
    if (k) runSkill(k, this);
    if (this.sePlaying) this.sePlaying -= 1;

    this._atbTicks += 1 * this.tickRate();
    if (this._atbTicks < this._atbFullTurn) return;
    $gameTroop.increaseTurn();
    this._atbTicks = 0;
    if (this.isTurnBased()) {
      this.endTurn();
    } else {
      this.endTurn();
    }
};
This is getting interesting to be honest. I was not expecting for this little idea to be picked up, yet here you are doing the heavy lifting for me. 


I got a sudden surge of work so I'll probably not be able to contribute much till the 22nd of of February - guess I can only wish you luck for now Gilgamar. 
@BucketsOfRP No worries. This is only my second plugin for RPG Maker MV but I think I'm starting to get the hang of it now. Let me know what other features you want added. I'm decent at programming, but not so good in the imagination department.
Well, if I may be so bold to suggest what I had in mind fully for this idea, it would work somehow like this:


First - the plugin (using  DMV's FullKeyboardInput I planned) would have it so that every key on the keyboard is possible to be set as an input.


The only options to switch in the plugin is "targetting cursor" as ON or OFF. And the "image" used as the cursor graphic.


Afterwards, you would put a small note command in the Actor Note Box, something like this:


<Command Skill button X ID Y>


In which X is the button we press in combat, while Y is the ID of the skill being used.


During battle, the enemy has a small "target" arrow above(or next to) them suggesting which enemy is targetted. If you press the button (let's say, "A"), the actor who has A as a button will be the one performing the skill and the enemy with targetting cursor on them will be the one the skill is used on. 


The targetting cursor can be relocated by pressing the graphic of the enemy. (Yanfly has a script for choosing enemies like this I remember).


The command works kinda like this:


"First, check if the actor meets the requirements to use the skill:


- They learned the skill or have it bestowed on them via an equip.


- They have the MP, TP, HP, whatever to use it.


"Afterwards perform the skill. Target provided by the Targetting cursor". 
"Pay the costs of the skill".


And that is literally it. The gameplay from this can be anything. From giving a special "use Limit Skill" that is used instantly in ATB battles that drains a ton of resources but is useful in a pinch (like massive recovery for an absurd MP cost) to having actors just fight with skills limited by MP that they recover each time their slow ATB fills up to max (and unleashing a special skill from it). Maybe even having each actor use multiple skills and having dedicated buttons to their attacks during ATB charges.


At least, that was the core idea. Perhaps this helps how to plan the script's final version. 


EDIT:


Forgot to mention. The "targetting cursor ON or OFF" is in case someone would want to just use ONE, super skill under a button that the party can activate to either nuke the whole enemy team or recover all allies. In that case, targetting would be pointless, as ATB would go normally and this "super skill" would just be a "use in a pinch" trick that consumes ludicrous amounts of Mana or a special, rare item. So that's the only thing that would need switching off. 
@BucketsOfRP That is really cool and I didn't think about targeting as I've only tested with one enemy and so it simply never occurred to me. So far I've just been using plugin parameters to setup the skills and actors but notetags would be cool. I think I'll add that later once I learn how and have it override the parameters so that there is more than one way to set it up. 


The version I'm working on now is going to support multiple actors by assigning keys to actors and skills to keys. Then when it runs the skill it will check which actor has the key assigned to them and then process the skill. Again all the MP/TP checking is done outside my script so we don't need to worry about it. I've implemented the check for if the battler has the skill and if they don't it plays a buzzer sound. I'll have to think about ways of implementing targeting as we could do this a variety of ways and support multiple inputs for it such as click/touch or arrow keys.
@BucketsOfRP I think I'll leave the note tag capability for you to add when you get some time for it. You could add it as an override to my existing parameters until we decide which we prefer. Note tags will probably be less confusing since you know which actor you are assigning skills/keys to. Global parameters are easier to add but more confusing to remember which actor has which keys/skills. For development and testing I like the parameters since I don't have to open as many windows to set things up but for actual implementation I think note tags will be the way to go.
Demo Video of 1.02 showing multiple actor skill keys


https://drive.google.com/open?id=0B8xGgxim_gkbSTBZU2tMOVM5YjQ
Latest update 1.03


This took far longer then it should have.


Added targeting system. It's probably not ideal but I leveraged the existing targeting system so as to avoid some serious programming.


It was hard enough just to figure out how to pull up a target selection window.


This pauses action while you select a target. I imagine you can use mouse/touch or keypad since it uses the existing system. I thought it might take away from the whole 'instant cast' thing but I found it quite easy to select a target quickly and have it appear seamless. It didn't feel like it was interrupting the action too badly. Not sure if this is what you wanted but hopefully it works as anything else would be difficult to implement. Video demo to follow.

Spoiler
/*=============================================================================
* Gilgamar - ButtonCast
* By Gilgamar
* G_ButtonCast.js
* Version: 1.03
* Free for commercial and non commercial use.
*=============================================================================*/

/*:
* @plugindesc v1.03 Adds ability to instantly cast skills with button.
* @author Gilgamar
*
* @param Keys Actor 0
* @desc Keys assigned to actor 0, ex: 1 2 3
* @default 0
*
* @param Keys Actor 1
* @desc Keys assigned to actor 1, ex: 4 5 6
* @default 0
*
* @param Keys Actor 2
* @desc Keys assigned to actor 2, ex: 7 8 9
* @default 0
*
* @param Keys Actor 3
* @desc Keys assigned to actor 3, ex: a s d
* @default 0
*
* @param Key 1
* @desc ID of skill to bind to key
* @default 0
*
* @param Key 2
* @desc ID of skill to bind to key
* @default 0
*
* @param Key 3
* @desc ID of skill to bind to key
* @default 0
*
* @param Key 4
* @desc ID of skill to bind to key
* @default 0
*
* @param Key 5
* @desc ID of skill to bind to key
* @default 0
*
* @param Key 6
* @desc ID of skill to bind to key
* @default 0
*
* @param Key 7
* @desc ID of skill to bind to key
* @default 0
*
* @param Key 8
* @desc ID of skill to bind to key
* @default 0
*
* @param Key 9
* @desc ID of skill to bind to key
* @default 0
*
* @param Key A
* @desc ID of skill to bind to key
* @default 0
*
* @param Key S
* @desc ID of skill to bind to key
* @default 0
*
* @param Key D
* @desc ID of skill to bind to key
* @default 0
*/

/* ============================================================================
* Changelog
* ============================================================================
* Version 1.03:
* - Target selection after using button cast
*
* Version 1.02:
* - Can now button cast with multiple actors!
* - Assign keys to actors in parameter
*
* Version 1.01:
* - Buttons not activated unless skill assigned
* - Skill assignments now stored in ButtonCast.keyList for easier access
* - Added a,s,d keys
* - Choose actor in parameter
* - Simplified checkInput() function for scalability
* - runSkill() function checks if user has skill and plays buzzer sound if not
* - Cool down timer to prevent overlapping sound effects
*
* Version 1.00:
* - Single actor button cast!
*/
//=============================================================================


var parameters = PluginManager.parameters('G_ButtonCast');
// console.log(parameters)
var ButtonCast = {};
ButtonCast.keysActor = {
0: parameters['Keys Actor 0'].split(" ").map(String),
1: parameters['Keys Actor 1'].split(" ").map(String),
2: parameters['Keys Actor 2'].split(" ").map(String),
3: parameters['Keys Actor 3'].split(" ").map(String)
}
ButtonCast.keyList = {
1: Number(parameters['Key 1']),
2: Number(parameters['Key 2']),
3: Number(parameters['Key 3']),
4: Number(parameters['Key 4']),
5: Number(parameters['Key 5']),
6: Number(parameters['Key 6']),
7: Number(parameters['Key 7']),
8: Number(parameters['Key 8']),
9: Number(parameters['Key 9']),

a: Number(parameters['Key A']),
s: Number(parameters['Key S']),
d: Number(parameters['Key D'])
}

if (ButtonCast.keyList['1'] !== 0) Input.keyMapper[49] = '1';
if (ButtonCast.keyList['2'] !== 0) Input.keyMapper[50] = '2';
if (ButtonCast.keyList['3'] !== 0) Input.keyMapper[51] = '3';
if (ButtonCast.keyList['4'] !== 0) Input.keyMapper[52] = '4';
if (ButtonCast.keyList['5'] !== 0) Input.keyMapper[53] = '5';
if (ButtonCast.keyList['6'] !== 0) Input.keyMapper[54] = '6';
if (ButtonCast.keyList['7'] !== 0) Input.keyMapper[55] = '7';
if (ButtonCast.keyList['8'] !== 0) Input.keyMapper[56] = '8';
if (ButtonCast.keyList['9'] !== 0) Input.keyMapper[57] = '9';

if (ButtonCast.keyList['a'] !== 0) Input.keyMapper[65] = 'a';
if (ButtonCast.keyList['s'] !== 0) Input.keyMapper[83] = 's';
if (ButtonCast.keyList['d'] !== 0) Input.keyMapper[68] = 'd';

// 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 k in ButtonCast.keyList){
if (Input.isPressed(String(k))) return k;
}
return null;
}

function runSkill(k) {
for (var a in ButtonCast.keysActor){ // a is for actor ID
if (ButtonCast.keysActor[a].indexOf(k) > -1){ // Is key assigned to actor?
var battler = $gameParty.battleMembers()[a];
}
}
// console.log(battler);

if (!battler) return; // This should never happen but just in case

var skillId = ButtonCast.keyList[k];

if (!battler.isLearnedSkill(skillId)){ // Does battler have this skill?
if (!BattleManager.sePlaying){
// console.log(battler.name());
SoundManager.playBuzzer();
BattleManager['sePlaying'] = 10; // Cool down timer for sound effect to prevent overlap
}
return;
}

if (battler.isATBCharging()) return; // Action already queued
// battler.canInput() // Probably need to check this in case of status effects

BattleManager._actorIndex = battler.index();
battler.setActionState('inputting');
battler.spriteStepForward();
this._phase = 'input';
battler.forceAction(skillId);

SceneManager._scene.selectEnemySelection();
// We wont know the target until the next ATB tick
BattleManager['actorQueued'] = battler.index();
}

//----------------------------------------------------------------------------//
// Yanfly Overrides

BattleManager.updateATBTicks = function() {
if (this.actorQueued !== undefined){
var battler = $gameParty.battleMembers()[this.actorQueued];
this.startATBAction(battler); // Execute action
this.actorQueued = undefined;
}
k = checkInput();
if (k) runSkill(k);
if (this.sePlaying) this.sePlaying -= 1;

// Yanfly code below
this._atbTicks += 1 * this.tickRate();
if (this._atbTicks < this._atbFullTurn) return;
$gameTroop.increaseTurn();
this._atbTicks = 0;
if (this.isTurnBased()) {
this.endTurn();
} else {
this.endTurn();
}
};



Note: 


Fair warning I haven't done much input checking. Parameters need to be case sensitive until I feel like changing it. Too lazy to bother right now, gotta put the exciting stuff in here first ^^

Original thread: https://forums.rpgmakerweb.com/threads/using-skills-in-battle-via-button-input.56885/