Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*:
- *
- * @plugindesc Yanfly Gab Windows State Status Alert Ext
- *
- * @author Ritter
- *
- * @help
- *
- * Add state notetags to display a gab window for add/remove states!
- * Works with evented 'Change State' command and step removal.
- * This script requires you to own Yanfly Gab Windows Plugin.
- *
- * Just add both note tags for each state you want to display a gab
- * window for.
- *
- * note tags:
- *
- * <addGab:text>
- * <removeGab:text>
- *
- * Example usage:
- *
- * <addGab:Suffering from Poison>
- * <removeGab:No longer suffering from Poison>
- *
- * You can also use the word actor to display actors name.
- *
- * <addGab:actor is suffering from Poison>
- * <removeGab:actor is no longer suffering from Poison>
- *
- * This would make it say Harold is suffering from Poison
- * Harold is no longer suffering from Poison
- *
- *-----------------------------------------------------------------
- *
- * Terms of use:
- *
- * Free to use for commercial and non-commercial games provided you
- * own Yanfly Gab Windows plugin.
- * You are free to edit, chop, delete, copy, paste, destroy, burn, take
- * code from, or toss this plugin in the river as much as you please.
- * (Plugin not tested for buoyancy)
- * Feel free to credit me if you wish, this is optional but appreciated.
- *
- *
- */
- (function() {
- // Aliased functions to display gabs when needed.
- // Change State
- var alias_Game_Interpreter_command313 = Game_Interpreter.prototype.command313;
- Game_Interpreter.prototype.command313 = function() {
- this.iterateActorEx(this._params[0], this._params[1], function(actor) {
- var alreadyDead = actor.isDead();
- if (this._params[2] === 0) {
- if ($dataStates[this._params[3]].meta.addGab) {
- this.addStateGab(this._params[3], actor);
- this.showGab();
- }
- } else {
- if ($dataStates[this._params[3]].meta.removeGab) {
- this.removeStateGab(this._params[3], actor);
- this.showGab();
- }
- }
- }.bind(this));
- return alias_Game_Interpreter_command313.call(this);
- };
- // show added states on steps, not sure how this works but added it anyway?
- var alias_Game_Actor_showAddedStates = Game_Actor.prototype.showAddedStates;
- Game_Actor.prototype.showAddedStates = function() {
- this.result().addedStateObjects().forEach(function(state) {
- if ($dataStates[state.id].meta.addGab) {
- Game_Interpreter.prototype.addStateGab(state.id, this);
- Game_Interpreter.prototype.showGab();
- } else {
- alias_Game_Actor_showAddedStates.call(this);
- }
- }, this);
- };
- // show removed states on steps
- var alias_Game_actor_showRemovedStates = Game_Actor.prototype.showRemovedStates;
- Game_Actor.prototype.showRemovedStates = function() {
- this.result().removedStateObjects().forEach(function(state) {
- if ($dataStates[state.id].meta.removeGab) {
- Game_Interpreter.prototype.removeStateGab(state.id, this);
- Game_Interpreter.prototype.showGab();
- } else {
- alias_Game_Actor_showRemovedStates.call(this);
- }
- }, this);
- };
- // Functions for handling gabs.
- // create gab text for added state
- Game_Interpreter.prototype.addStateGab = function(state, actor) {
- text = this.gabMeta(state, 1);
- if (text.contains("actor")) text = text.replace("actor", actor._name);
- this._gabText = text;
- };
- // create gab text for removed state
- Game_Interpreter.prototype.removeStateGab = function(state, actor) {
- text = this.gabMeta(state, 0);
- if (text.contains("actor")) text = text.replace("actor", actor._name);
- this._gabText = text;
- };
- // get state meta data
- Game_Interpreter.prototype.gabMeta = function(state, value) {
- if (value == 1) return $dataStates[state].meta.addGab;
- if (value == 0) return $dataStates[state].meta.removeGab;
- };
- })();
Add Comment
Please, Sign In to add comment