More SelfSwitches Plugin Bug fix please...

firestalker

Veteran
Veteran
Joined
Nov 18, 2015
Messages
399
Reaction score
50
First Language
English
Primarily Uses
RMMV
//=============================================================================
// More Self Switches
// Author gameus
// Version 1.0
//-----------------------------------------------------------------------------
// Intro:
// Allows you to use infinite self switches in any event.
//
// Instructions:
// Place in your plugins folder and save as 'MoreSelfSwitches.js'
//
// To create a custom self switch, you must first check the self switch box
// on any page. Then add a comment at the top of the page and follow the format
//
// switch:custom_switch_name
//
// After that, use the Plugin Command and call
//
// SelfSwitch custom_switch_name true/false
//
// Thus allowing as many self switches as you want, with whatever name!
//
// Credits:
// gameus ~ For creating it.
//=============================================================================

/*:
* @plugindesc Allows for infinite self switches in events.
* @author gameus
*
* @help
* Instructions:
* Place in your plugins folder and save as 'MoreSelfSwitches.js'
*
* To create a custom self switch, you must first check the self switch box
* on any page. Then add a comment at the top of the page and follow the format
*
* switch:custom_switch_name
*
* After that, use the Plugin Command and call
*
* SelfSwitch custom_switch_name true/false
*
* Thus allowing as many self switches as you want, with whatever name!
*/

var GameusScripts = GameusScripts || {};
GameusScripts['MoreSelfSwitches'] = 1.0;

(function() {

var gameus_SelfSwitch_initialize = Game_Event.prototype.initialize;
var gameus_SelfSwitch_plugin_command = Game_Interpreter.prototype.pluginCommand;

Game_Interpreter.prototype.pluginCommand = function(command, args) {
gameus_SelfSwitch_plugin_command.call(this, command, args);
if (command.toLowerCase() == "selfswitch") {
var _switch = args[0];
var _state = Boolean(args[1]);
var _key = [this._mapId, this._eventId, _switch];
$gameSelfSwitches.setValue(_key, _state);
}
};

Game_Event.prototype.initialize = function(mapId, eventId) {
gameus_SelfSwitch_initialize.call(this, mapId, eventId);
var pages = this.event().pages;
for (i = 0; i < pages.length; i += 1) {
var page = pages;
for (j = 0; j < page.list.length; j += 1) {
var command = page.list[j];
if (command.code === 408 || command.code === 108)
this.checkCustomSwitch(page, command.parameters[0]);
}
}
};

Game_Event.prototype.checkCustomSwitch = function(page, code) {
var args = code.split(":");
if (args[0] !== null && args[0].toLowerCase() == "switch" && args[1] !== null) {
page.conditions.selfSwitchCh = args[1];
page.conditions.selfSwitchValid = true;
}
};

})();






I'm not sure what the protocol is for this sort of thing, but since the original creator has be inactive for months I was wondering if someone else can fix this plugin.


This is the MoreSelfSwitches plugin by gameus...  For the most part it works exactly they way it's supposed to.  Perfectly.  But there is one instance that it doesn't.  When the player enter the menu the selfswitches reset themselves and all the work is erased.


Can someone make it so it doesn't do that?
 

Latest Threads

Latest Posts

Latest Profile Posts

I have no idea why some of the program "loading screen" always on top. E.g, RMMZ loading screen stuck on the top blocking anything I want to do until it fully loaded. What is even the purpose?
One of the secret places in the game.
Had a dream last night that I died -- what a way to start the weekend! :'D
For some reasons, my signature was replaced by god-knows-what, written in French. Had to re-replace it with my signature Nazeem-ish quote; not gonna remake my signature any time soon.
2021? I still wonder if people still doing MV than MZ more

Forum statistics

Threads
107,634
Messages
1,031,044
Members
139,754
Latest member
vituvitu
Top