Yanfly Gab Windows State Status Alert Extension
Created by Ritter
Introduction
This extension to Yanfly's Gab Windows plugin allows for the use of gab windows upon adding/removing a state outside of battle. Simply use note tags in your state database for each state to display a gab window!
This plugin requires you to own Yanfly Gab Windows, without that plugin this extension will not function at all.
This plugin only calls to and does not modify Yanfly Gab Windows plugin in any way.
Idea from this thread
Here
Download plugin:
Click Here
Features
- Display gab windows when evented 'Change State' is used.
- Display gab window when state is removed from walking distance.
How to Use
Download the plugin and place it in your projects js/plugins folder, add the plugin to the plugin manager. Place the following note tags in each state you want to display a gab window for.
<addGab:text>
<removeGab:text>
Example usage:
<addGab:Suffering from Poison!>
<removeGab:No longer suffering from Poison!>
This would show a gab window when an actor gets the poison state and when the poison state is removed.
You can also use the word actor to display the actors name in the gab window.
Example usage:
<addGab:actor is suffering from Poison!>
<removeGab:actor is no longer Poisoned!>
This would pop up a gab window with the following messages when state is added or removed.
Harold is suffering from Poison!
Harold is no longer Poisoned!
Script
Spoiler: Plugin code
JavaScript: - /*:
- *
- * @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.
- *
- * 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;
- };
- })();
复制代码
Credit and Thanks
- Extension plugin created by Ritter.
- Gab Windows plugin created by Yanfly.
FAQ
Q: Why isn't (this) feature included?
A: If you need a feature added make a request and if its reasonable I'll see about doing it!~
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.
本贴来自国际rpgmaker官方论坛作者:Ritter处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/yanfly-gab-windows-state-status-alert-extension.123021/