Jump to content
Rpg²S Forum

Più Self_Switches


Lomax_Iced
 Share

Recommended Posts

Olà gente dunque mi sono imbattuto in un tale che ha generato questo simpatico script per RMMV
E' un Add-On :

 

In sostanza lo script permette di utilizzare infiniti self switches in qualsiasi evento.

Ma troverete maggiori delucidazioni all'interno dello script.

 

Script:


//=============================================================================
// 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[i];
			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;
		}
	};
	
})();

 


Se ho capito bene:

1) create un evento chesso di 6 pagine

in queste sei pagine inserite (esempio) sei testi diversi dall'opzione di default textbox... tipo:
2) Pag1: Lo sai che

Pag2: Lomax
Pag3: è un
Pag4: gran

Pag5: figo
Pag6: pazzesco!!

3)

benissimo appena sotto i testi inserite i vari Plugin Command:
inserendo questa dicitura::

4) Pag1
Text: "Lo sai che"
Plugin Command: SelfSwitch 1 true

Pag2

Text: "Lomax"
Plugin Command: SelfSwitch 2 true

Pag3

Text: "è un"
Plugin Command: SelfSwitch 3 true

Pag4

Text: "gran"
Plugin Command: SelfSwitch 4 true

Pag5

Text: "figo"
Plugin Command: SelfSwitch 5 true

Pag6

Text: "pazzesco"

5)

una cosa importantissima dalla Pag2 fino a (in questo caso) Pag6
settate in condizioni (appena sotto il nome dell'evento) l'opzione selfswitch

ad esempio il primo A


Spero di essere stato comprensibile e di aver reso felice qualcuno condividendo tal cosa.
Lasciate perdere il testo di esempio (è megalomania..) vabbe, un saluto e creditate no me,

ma Gameaus



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...