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 Profile Posts

JRPG TextBox HTML - Part 2:
So I'm resuming work on the Shadowstar Trilogy. I've decided that it will take place between the end of G4 and the start of G5, and two of the Lost Rulers will be Twilight Sparkle and Sunset Shimmer (who is the moon princess in my AU).
Been working on some sprites, My favorite out of all of them is this guy, his name is Moss:
anyone else 'round here gonna be doing the retro game jam that's starting in a few days on itch.io?

Forum statistics

Threads
108,951
Messages
1,040,834
Members
141,412
Latest member
Ryachika78
Top