Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // SBOEO
- // by Astfgl
- // Date: 15/04/2017
- // Latest: 21/04/2017
- // TOU:
- // Free to use both commercially and non commercially
- // Edits allowed under the condition that the edits must share the same
- // license and be clearly labelled as such. Redistribution allowed.
- // Credits required: Any of Astfgl/Pierre MATEO/Pierre MATEO (Astfgl)
- // You cannot remove or alter this header under any condition.
- //=============================================================================
- /*:
- * @plugindesc In turn selection window
- * @author Astfgl
- * @help
- * Call the selection window with:
- * $gameSystem.startSelection(subject,skillId)
- * The subject must be the actor ir enemy object, not its ID.
- * The given skill ID doesn't have to be the skill that will be cast,
- * it's just a dummy skill used for targetting purposes, it will not be cast.
- * Then get the results IN ANOTHER SCRIPT CALL with:
- * $gameSystem.getSelectionResult();
- * This will return the actor or enemy object targeted for single target skills.
- * For multiple target skills, you don't really need this plugin. Yanfly
- * is inconsistent with his notation and it will only return the index of
- * who was selected, disregarding if it's a party or troop members.
- *
- * If the selection is cancelled the result will be "cancelled"
- * You should wrap your event in a conditional script:
- * $gameSystem.getSelectionResult() !== "cancelled"
- * in the else field you can then do what you want if the selection was cancelled.
- */
- (function(){
- var var1;
- var var2;
- var var3;
- var _Astfgl_aliasSBOEO = Scene_Battle.prototype.onEnemyOk
- Scene_Battle.prototype.onEnemyOk = function() {
- if (BattleManager._phase === "turn" || BattleManager._phase === "actionList") {
- var1 = this._enemyWindow.enemyIndex();
- this._enemyWindow.hide();
- this._enemyWindow.deselect();
- this._enemyWindow.deactivate();
- } else {
- _Astfgl_aliasSBOEO.call(this);
- }
- };
- var _Astgfl_aliasSBOEC = Scene_Battle.prototype.onEnemyCancel
- Scene_Battle.prototype.onEnemyCancel = function() {
- if (BattleManager._phase === "turn" || BattleManager._phase === "actionList") {
- var1 = "cancelled";
- this._enemyWindow.hide();
- this._enemyWindow.deselect();
- this._enemyWindow.deactivate();
- } else {
- _Astgfl_aliasSBOEC.call(this);
- }
- };
- var _Astgl_aliasGIUWM = Game_Interpreter.prototype.updateWaitMode
- Game_Interpreter.prototype.updateWaitMode = function() {
- var bool = false
- if (SceneManager._scene._enemyWindow) {
- bool = SceneManager._scene._enemyWindow.active
- }
- return _Astgl_aliasGIUWM.call(this) || bool
- }
- Window_BattleEnemy.prototype.action = function() {
- if (BattleManager._phase === "actionList") {
- var action = new Game_Action(var2,false)
- action.setSkill(var3);
- return action
- }
- return BattleManager.inputtingAction();
- };
- Game_System.prototype.startSelection = function(subject,skillId) {
- if ($gameParty.inBattle()) {
- SceneManager._scene._enemyWindow.activate();
- SceneManager._scene._enemyWindow.select(0);
- var2 = subject;
- var3 = skillId;
- SceneManager._scene._enemyWindow.refresh();
- }
- }
- Game_System.prototype.getSelectionResult = function() {
- var txt = var1
- if (typeof txt === "Number") {
- return var1
- } else if (var1 !== "cancelled"){
- var reg = /\d+/
- var num = Number(txt.match(reg)[0])
- if (txt.match("ACTOR")) {
- return $gameParty.battleMembers()[num]
- } else {
- return $gameTroop.members()[num]
- }
- } else {
- return var1
- }
- }
- })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement