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?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Dunno but maybe I'll make an art raffle soon. Anyone interested in it?
Give me some feedbacks please. x) Link: ♫ Let Us Play ♫ (Take note it's the first music I made, that even I find the music kinda off).
Who would think putting a power button on a side of a laptop is a good thing? You want to move the laptop and you suddenly press the button.
The second draft of my script is almost done, and I don't think I'm going to write a third draft. I'll make changes to dialogue here and there, but I'm happy with the series of events the way they are.

Forum statistics

Threads
107,531
Messages
1,030,309
Members
139,657
Latest member
Mary_bhk
Top