Apologies in advance for being a snarky smartass - or at least, snarkier than normal - but I really feel the need to ask the obvious:
If you're going to make people use external plugins like Yanfly's Buff and States to make it work...... why don't you just tell them to go grab Yanfly's Instant Cast and Skill Cooldown plugins and be done with it? (Honestly speaking I didn't remember those until you brought up Yanfly's stuff, but I'm pretty sure they'd accomplish the same job without the hassle of dynamically generating skills from states or this insertion additional turns.)
Now before anyone runs off and actually does that, I'm going to go ahead and answer my own question.
Because.
Leaving aside from the fact that Yanfly's plugins tend to come with a whole bunch of extra features that you may not want, the fact is that GUI is not customisable. If you want a custom interface job like the OP requested, Yanfly doesn't do that. When you go with a Yanfly plugin, you're stuck with a Yanfly interface.
GUI mods need to be custom-coded. That's the reality.
On the other hand, many people don't actually realize how many gameplay mechanics you can implement without turning to scripting/plugins. And this is more or less one such example. And I'm going to explain why.
When it comes down to it, the fact is that the only gameplay mechanic in this system that actually needs a coded plugin solution is the instant-cast in the middle of the turn. The rest can be done with states and skills, the Sigil battle command itself being a Skill Type like 'Magic' or 'Special', and the selectable options simply being Sigil-skill type Skills that are instantly cast when selection. Even learning/removing skills and putting them on "cooldown" can be done with default mechanics.
But let's take a look at what actually needs the code work. We'll start with the GUI. Requester wants it in a single column box showing 5 options, just above the party HUD. Easiest way is to make a brand new Window for this. Depending on how the gameplay side of the stat/skill boost is implemented, you could use Command or Selectable as the base. But - and credit to you, Magnus0808 - Window_SkillList or BattleSkill makes a fine base to start since as you identified, we really only need to use Skills/States to pull it off.
All our new Window_BattleSigil needs to be is mostly a copy of Window_BattleSkill, except tweaked to change some dimensions. The only additional code necessary is the stuff to remember (and highlight yellow) the currently "equipped" selected options (and to default to the first on the list if there is none).
This will require giving actors a variable to store what their last personal sigil selection was, the same kind used to remember what their last ActorCommand selection was. This has nothing to do with stats, just affects what initially gets highlighted in the window.
Spoiler
Code:
// Game_Actor modified to add a "lastSigilSymbol" variable in order to store the
// last selected Sigil for recall. Basically copied from 'lastCommandSymbol'.
var sigil_alias_gmActor_initMembers_04042019 = Game_Actor.prototype.initMembers;
Game_Actor.prototype.initMembers = function() {
sigil_alias_gmActor_initMembers_04042019.call(this);
this._lastSigilSymbol = null; // This can be changed to give all actors a default.
// i.e. (this._lastSigilSymbol = 'Balance')
// Note - this has nothing to do with applying any stats.
}
Game_Actor.prototype.lastSigilSymbol = function() {
return this._lastSigilSymbol;
};
Game_Actor.prototype.setLastSigilSymbol = function(symbol) {
this._lastSigilSymbol = symbol;
};
Next we make the actual Window. This is by far the biggest chunk of code, because most of the new stuff (mainly to do with highlighting/remembered options, etc.) is in here.
Spoiler
Code:
// Create the BattleSigil window based BattleSkill window, tweaked for required specs.
function Window_BattleSigil() {
this.initialize.apply(this, arguments);
}
Window_BattleSigil.prototype = Object.create(Window_SkillList.prototype);
Window_BattleSigil.prototype.constructor = Window_BattleSigil;
Window_BattleSigil.prototype.initialize = function(x, y) {
// Width and height manually set below.
var width = 192; // Manually set width to 192px, same width as Actor Command window.
var height = this.fittingHeight(5); //Set height just enough for 5 rows.
Window_SkillList.prototype.initialize.call(this, x, y, width, height);
this.hide();
};
Window_BattleSigil.prototype.show = function() {
this.selectLast();
this.showHelpWindow();
Window_SkillList.prototype.show.call(this);
};
Window_BattleSigil.prototype.hide = function() {
this.hideHelpWindow();
Window_SkillList.prototype.hide.call(this);
};
Window_BattleSigil.prototype.maxCols = function() {
return 1;
};
Window_BattleSigil.prototype.numVisibleRows = function() {
return 5;
};
// Highlight Yellow if the sigil is the currently selected/remembered one.
Window_BattleSigil.prototype.drawItemName = function(item, x, y, width) {
width = width || 312;
if (item) {
var iconBoxWidth = Window_Base._iconWidth + 4;
this.resetTextColor();
this.drawIcon(item.iconIndex, x + 2, y + 2);
if (item.name == this._highlightedCommand) {
this.changeTextColor(this.crisisColor());
// crisisColor() refers to Color #17 on the message box skin.
// So named because it is the bright yellow used for near-death HP display.
};
this.drawText(item.name, x + iconBoxWidth, y, width - iconBoxWidth);
this.resetTextColor();
}
};
// Code below is for remembering/highlighting the sigil selection.
Window_BattleSigil._highlightedCommand = null;
Window_BattleSigil.prototype.selectLast = function() {
var lastActorSigil = this._actor.lastSigilSymbol();
// Run through the sigil list and select actor's remembered sigil if exists.
if (lastActorSigil) {
for (var i = 0; i < this._data.length; i++) {
if (this._data[i].name == lastActorSigil) {
this.select(i);
}
}
} else {
// If not, select the first option on the list.
this.select(0);
};
// Updated the highlighted option and refresh the window.
this.refresh();
this._highlightedCommand = this.item().name;
}
And then we alter Scene_Battle to create and display the window at the desired co-ordinates. The only tricky bit is adding the new window to the list of those checked by the update. There is probably an sleeker way to do this by aliasing the update function (updateBattleProcess) but I'm lazy, so I just overwrite reader function here.
Spoiler
Code:
var sigil_alias_scBattle_createAllWindows_04042019 = Scene_Battle.prototype.createAllWindows;
Scene_Battle.prototype.createAllWindows = function() {
sigil_alias_scBattle_createAllWindows_04042019.call(this);
this.createSigilWindow();
};
// Slightly modified copy of createSkillWindow function, generates the window.
Scene_Battle.prototype.createSigilWindow = function() {
var wx = this._statusWindow.x; // Set X-coordinates to that of the party status HUD.
var wy = this._statusWindow.y - this._statusWindow.height; // Set Y to the same as HUD.
var wy = wy - (this._statusWindow.standardPadding() * 2); // Push Y above the window and its padding.
this._sigilWindow = new Window_BattleSigil(wx, wy);
this._sigilWindow.setHelpWindow(this._helpWindow);
this._sigilWindow.setHandler('ok', this.onSigilOk.bind(this));
this._sigilWindow.setHandler('cancel', this.onSigilCancel.bind(this));
this.addWindow(this._sigilWindow);
};
// Add sigil window to the detection of active input windows.
// This is an OVERWRITE of the default method. Anything that also overwrites this will clash.
Scene_Battle.prototype.isAnyInputWindowActive = function() {
return (this._partyCommandWindow.active ||
this._actorCommandWindow.active ||
this._skillWindow.active ||
this._itemWindow.active ||
this._actorWindow.active ||
this._enemyWindow.active ||
this._sigilWindow.active);
};
Next we have to alter both Scene_Battle and Window_ActorCommand so that the Sigil window opens up INSTEAD of the BattleSkill window when the Sigil command is selected.
How do we do this? Well Actor_Command generates its options on-the-fly based on what skill types the actor is set to use. We can just hijack that code to detect a specifically named skill type - i.e. "Sigil" - and make it it generate a special command that opens BattleSigil from that.
This needs an overwrite, AFAIK, there's no real way around it. Even if you try to change makeCommandList instead, it still needs an overwrite. So anything else you have that also overwrites the ActorCommand window will invariable clash with this.
Spoiler
Code:
// Changes Window_ActorCommand to generate a special option instead of the regular if actor has 'Sigil' Skill Type.
// This OVERWRITES the 'addSkillCommands' function.
Window_ActorCommand.prototype.addSkillCommands = function() {
var skillTypes = this._actor.addedSkillTypes();
skillTypes.sort(function(a, b) {
return a - b;
});
skillTypes.forEach(function(stypeId) {
var name = $dataSystem.skillTypes[stypeId];
// This is the only part we're actually changing, everything before this is default code.
if (name === 'Sigil') {
// Flags the option as a 'sigil' command instead of a generic 'skill' command.
this.addCommand(name, 'sigil', true, stypeId);
} else {
// Default behaviour.
this.addCommand(name, 'skill', true, stypeId);
}
// End changes.
}, this);
};
// Directs options flagged as 'sigil' to run the 'commandSigil' function.
var sigil_alias_scBattle_createActorComandWindow_04042019 = Scene_Battle.prototype.createActorCommandWindow;
Scene_Battle.prototype.createActorCommandWindow = function() {
sigil_alias_scBattle_createActorComandWindow_04042019.call(this);
this._actorCommandWindow.setHandler('sigil', this.commandSigil.bind(this));
};
// Function used to open the BattleSigil window.
// Except for 1 line, it's just a carbon copy of 'commandSkill', except for 'sigilWindow' instead of 'skillWindow'.
Scene_Battle.prototype.commandSigil = function() {
this._sigilWindow._highlightedCommand = BattleManager.actor().lastSigilSymbol(); // Highlights the actor's current sigil.
this._sigilWindow.setActor(BattleManager.actor());
this._sigilWindow.setStypeId(this._actorCommandWindow.currentExt());
this._sigilWindow.refresh();
this._sigilWindow.show();
this._sigilWindow.activate();
};
Now we need some code to deal with what happens when an option on the Sigil menu option is selected or canceled. It's going to be 'instantly' applied BUT do we want the Sigil state - cooldown and all - to be applied the VERY MOMENT it is selected? Or only applied after the menu is shut, giving the player room to change their mind if they accidentally selected something they didn't want while it is open?
We'll assume the latter, because the former is rather player-unfriendly. Even if it is slightly harder to code. Slightly. Not really. Compared to making a whole new window, it's a much shorter section.
Spoiler
Code:
// Highlight the new selection when OK is pressed.
Scene_Battle.prototype.onSigilOk = function() {
var skill = this._sigilWindow.item();
this._sigilWindow._highlightedCommand = skill.name;
this._sigilWindow.refresh();
this._sigilWindow.activate(); // Keeps the window active and usable.
// Since all Windows deactivate by default on pressing OK.
};
// Check if the highlighted sigil is different from the actor's. If it is, apply effects and close window.
// If not, just close the window.
Scene_Battle.prototype.onSigilCancel = function() {
if (BattleManager.actor().lastSigilSymbol() != this._sigilWindow._highlightedCommand) {
// Select the skill based on the name.
for (var i = 0; i < this._sigilWindow._data.length; i++) {
if (this._sigilWindow._data[i].name == this._sigilWindow._highlightedCommand) {
var skill = this._sigilWindow._data[i];
}
}
// Apply the effects (use the skill immediately).
BattleManager.actor().setLastSigilSymbol(skill.name);
var sigilAction = new Game_Action(BattleManager.actor());
sigilAction.setItemObject(skill);
sigilAction.apply(BattleManager.actor());
this._statusWindow.refresh();
}
this._sigilWindow.hide();
this._actorCommandWindow.activate();
};
...And we're done. That's all the code we need. All that's left is to wrap it up in a plugin function and present it as a plugin. While we're at it, we can also make it so that instead of looking for the specific word "Sigil", ActorCommand instead looks to plugin parameters to determine the word it uses for the special menu option.
Spoiler
Code:
//=============================================================================
// "Sigil" System
// By: Traverse
//=============================================================================
//
/*:
* @plugindesc Allows the user to designate a Skill Type for instant casting via special menu.
*
* @param Designated Skill Type
* @type text
* @desc Text string. The name of the skill type that uses the special menu. Must match the name in database.
* @default Sigil
*/
(function() {
var substrBegin = document.currentScript.src.lastIndexOf('/');
var substrEnd = document.currentScript.src.indexOf('.js');
var scriptName = document.currentScript.src.substring(substrBegin + 1, substrEnd);
var parameters = PluginManager.parameters(scriptName);
var sigilDesignatedSkillType = String(parameters['Designated Skill Type']);
// PART 1 //
// Modifies Game Actor to remember selected sigil and create the Sigil menu.
// Game_Actor modified to add a "lastSigilSymbol" variable in order to store the
// last selected Sigil for recall. Basically copied from 'lastCommandSymbol'.
var sigil_alias_gmActor_initMembers_04042019 = Game_Actor.prototype.initMembers;
Game_Actor.prototype.initMembers = function() {
sigil_alias_gmActor_initMembers_04042019.call(this);
this._lastSigilSymbol = null; // This can be changed to give all actors a default.
// i.e. (this._lastSigilSymbol = 'Balance')
// Note - this has nothing to do with applying any stats.
}
Game_Actor.prototype.lastSigilSymbol = function() {
return this._lastSigilSymbol;
};
Game_Actor.prototype.setLastSigilSymbol = function(symbol) {
this._lastSigilSymbol = symbol;
};
// Creates the BattleSigil window based BattleSkill window, tweaked for required specs.
function Window_BattleSigil() {
this.initialize.apply(this, arguments);
}
Window_BattleSigil.prototype = Object.create(Window_SkillList.prototype);
Window_BattleSigil.prototype.constructor = Window_BattleSigil;
Window_BattleSigil.prototype.initialize = function(x, y) {
// Width and height manually set below.
var width = 192; // Manually sets width to 192px, same width as Actor Command window.
var height = this.fittingHeight(5); // Sets height just enough for 5 rows.
Window_SkillList.prototype.initialize.call(this, x, y, width, height);
this.hide();
};
Window_BattleSigil.prototype.show = function() {
this.selectLast();
this.showHelpWindow();
Window_SkillList.prototype.show.call(this);
};
Window_BattleSigil.prototype.hide = function() {
this.hideHelpWindow();
Window_SkillList.prototype.hide.call(this);
};
Window_BattleSigil.prototype.maxCols = function() {
return 1;
};
Window_BattleSigil.prototype.numVisibleRows = function() {
return 5;
};
// Highlights in yellow if the sigil is the currently selected/remembered one.
Window_BattleSigil.prototype.drawItemName = function(item, x, y, width) {
width = width || 312;
if (item) {
var iconBoxWidth = Window_Base._iconWidth + 4;
this.resetTextColor();
this.drawIcon(item.iconIndex, x + 2, y + 2);
if (item.name == this._highlightedCommand) {
this.changeTextColor(this.crisisColor());
// crisisColor() refers to Color #17 on the message box skin.
// So named because it is the bright yellow used for near-death HP display.
};
this.drawText(item.name, x + iconBoxWidth, y, width - iconBoxWidth);
this.resetTextColor();
}
};
// Code below is for remembering/highlighting the sigil selection.
Window_BattleSigil._highlightedCommand = null;
Window_BattleSigil.prototype.selectLast = function() {
var lastActorSigil = this._actor.lastSigilSymbol();
// Runs through the sigil list and selects actor's remembered sigil if exists.
if (lastActorSigil) {
for (var i = 0; i < this._data.length; i++) {
if (this._data[i].name == lastActorSigil) {
this.select(i);
}
}
} else {
// If not, selects the first option on the list.
this.select(0);
};
// Updates the highlighted option and refreshes the window.
this.refresh();
this._highlightedCommand = this.item().name;
}
// PART 2 //
// Modifies Scene_Battle to create the new window.
var sigil_alias_scBattle_createAllWindows_04042019 = Scene_Battle.prototype.createAllWindows;
Scene_Battle.prototype.createAllWindows = function() {
sigil_alias_scBattle_createAllWindows_04042019.call(this);
this.createSigilWindow();
};
// Slightly modified copy of createSkillWindow function, generates the window.
Scene_Battle.prototype.createSigilWindow = function() {
var wx = this._statusWindow.x; // Sets X-coordinates to that of the party status HUD.
var wy = this._statusWindow.y - this._statusWindow.height; // Sets Y to the same as HUD.
var wy = wy - (this._statusWindow.standardPadding() * 2); // Pushes Y above the window and its padding.
this._sigilWindow = new Window_BattleSigil(wx, wy);
this._sigilWindow.setHelpWindow(this._helpWindow);
this._sigilWindow.setHandler('ok', this.onSigilOk.bind(this));
this._sigilWindow.setHandler('cancel', this.onSigilCancel.bind(this));
this.addWindow(this._sigilWindow);
};
// Adds sigil window to the detection of active input windows.
// This is an OVERWRITE of the default method. Anything that also overwrites this will clash.
Scene_Battle.prototype.isAnyInputWindowActive = function() {
return (this._partyCommandWindow.active ||
this._actorCommandWindow.active ||
this._skillWindow.active ||
this._itemWindow.active ||
this._actorWindow.active ||
this._enemyWindow.active ||
this._sigilWindow.active);
};
// PART 3 //
// Alters Scene_Battle and Actor_Command to make the Sigil command open the BattleSigil window.
// Changes Window_ActorCommand to generate a special option if actor has 'Sigil' Skill Type.
// This OVERWRITES the 'addSkillCommands' function.
Window_ActorCommand.prototype.addSkillCommands = function() {
var skillTypes = this._actor.addedSkillTypes();
skillTypes.sort(function(a, b) {
return a - b;
});
skillTypes.forEach(function(stypeId) {
var name = $dataSystem.skillTypes[stypeId];
// This is the only part we're actually changing, everything before this is default code.
//if (name === 'Sigil') {
if (name === sigilDesignatedSkillType) {
// Flags the option as a 'sigil' command instead of a generic 'skill' command.
this.addCommand(name, 'sigil', true, stypeId);
} else {
// Default behaviour.
this.addCommand(name, 'skill', true, stypeId);
}
// End changes.
}, this);
};
// Directs options flagged as 'sigil' to run the 'commandSigil' function.
var sigil_alias_scBattle_createActorComandWindow_04042019 = Scene_Battle.prototype.createActorCommandWindow;
Scene_Battle.prototype.createActorCommandWindow = function() {
sigil_alias_scBattle_createActorComandWindow_04042019.call(this);
this._actorCommandWindow.setHandler('sigil', this.commandSigil.bind(this));
};
// Function used to open the BattleSigil window.
// Except for 1 line, it's just a carbon copy of 'commandSkill', except for 'sigilWindow' instead of 'skillWindow'.
Scene_Battle.prototype.commandSigil = function() {
this._sigilWindow._highlightedCommand = BattleManager.actor().lastSigilSymbol(); // Highlights the actor's current sigil.
this._sigilWindow.setActor(BattleManager.actor());
this._sigilWindow.setStypeId(this._actorCommandWindow.currentExt());
this._sigilWindow.refresh();
this._sigilWindow.show();
this._sigilWindow.activate();
};
// PART 4 //
// Logic for selection/cancelation of Sigil menu commands.
// Highlights the new selection when OK is pressed.
Scene_Battle.prototype.onSigilOk = function() {
var skill = this._sigilWindow.item();
this._sigilWindow._highlightedCommand = skill.name;
this._sigilWindow.refresh();
this._sigilWindow.activate(); // Keeps the window active and usable.
// Since all Windows deactivate by default on pressing OK.
};
// Checks if the highlighted sigil is different from the actor's. If it is, applies effects and closes window.
// If not, just closes the window.
Scene_Battle.prototype.onSigilCancel = function() {
if (BattleManager.actor().lastSigilSymbol() != this._sigilWindow._highlightedCommand) {
// Find skill based on the name.
for (var i = 0; i < this._sigilWindow._data.length; i++) {
if (this._sigilWindow._data[i].name == this._sigilWindow._highlightedCommand) {
var skill = this._sigilWindow._data[i];
}
}
// Apply the effects (use the skill immediately).
BattleManager.actor().setLastSigilSymbol(skill.name);
var sigilAction = new Game_Action(BattleManager.actor());
sigilAction.setItemObject(skill);
sigilAction.apply(BattleManager.actor());
this._statusWindow.refresh();
}
this._sigilWindow.hide();
this._actorCommandWindow.activate();
};
}) ();
Now that's done, you're probably asking "what about the cooldowns and the skill removal, etc. etc."
Well. That doesn't need a plugin.
Remember, each Sigil is a skill. That means damage formulas can be used to add/remove skills (b.forgetSkill(99)) and can be used to apply states that SEAL or restrict a whole skill type. Like the Sigil skill type. A State that can be set to last for 4 or any amount of turns.
See where this is going?
Make and add the Skill Type 'Sigil' to an actor. Make 5 (or however many) Skills you want, call them Balance, Strike, Defend, whatever and set them under the 'Sigil' skill type. For each one, you will want them to do at least 2 things: A ) Apply a State that gives you the stat boost/adds skill you want and B ) Apply another state that inflicts Seal Skill Type (Sigil) on the actor for however many turns you need and disappears at the end of battle. If you want to remove skills, you use the damage formula to do so.
Now there's only one thing left - applying a "default" Sigil to the party at the start of combat. The solution?
Battle events. The way it was done in the 2k/3 era. Inflict the appropriate State on the whole party at the start of every fight. You can also use script box to manually set the last remembered Sigil for the actors. You will also need to manually wipe lastSigilSymbol off all the actors after every fight, or else when you open the menu next battle, the old selection will remain highlighted from them.
There is also no functionality to display the number of remaining turns of cooldown, as this was never requested in the opening post.
However, you can always modify this plugin if you need to make those additions, which should not be too difficult, given that you have now been walked through the entire construction of this plugin from start to end.