New account registration is temporarily disabled.

SHININGRIVER'S PROFILE

I do freelance photoshop and writing in my free time. I'm also a computer programmer.

Search

Filter

[RMMV] Adding a Choice Window

Hi,

This is an extension of my previous script, which works on fusing two party members. At the moment, the calculation processes are done... the only thing left is the windows, which I'm having trouble with. I need help with the following:

• Preventing input from invalid entries (not proceeding to the status screen for invalid entries)
• Displaying a choice for the user to select whether to proceed to fusion or not

Here's my code for reference... thanks!


//=============================================================================
//
// EdoTenseiFusion_Final.js
// [url]https://kinoar.github.io/rmmv-doc-web/index.html[/url]
//=============================================================================



/*:
 * @plugindesc Starts the fusion process, just like in SMT
 * @author Sai Hikawa
 *
 * @param none
 * @desc none
 * @default false
 *
 * @help
 *
 * Plugin Command:
 *
 * fusion - initiates the fusion thinggy
 *
 */


 //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 // Global Variables
 // Fusion result array and selected demons
 //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

 var resultArray = [32];
	// 2 - Avatar
	resultArray[0] = [0,20,29,23,0,25,23,0,16,7,7,23,0,0,20,23,0,6,25,31,23,20,16,6,2,20,33,24,0,6,6,0,7];
	// 3 - Avian
	resultArray[1] = [20,0,13,23,25,29,16,0,0,27,29,5,0,0,23,25,0,25,24,0,23,24,0,6,3,13,25,23,0,0,23,0,27];
	// 4 - Beast
	resultArray[2] = [29,13,9,13,2,20,29,4,20,7,27,15,27,33,2,11,33,0,2,3,34,20,29,0,4,11,33,5,27,15,20,22,12];
	// 5 - Brute
	resultArray[3] = [23,23,13,9,23,34,27,5,16,27,0,4,18,33,0,7,15,0,3,23,0,0,0,0,5,23,16,0,18,18,0,11,13];
	// 6 - Deity
	resultArray[4] = [0,25,2,23,0,25,0,6,25,27,16,24,0,8,0,25,0,10,25,12,5,16,0,0,6,31,30,23,0,0,23,3,25];
	// 7 - Divine
	resultArray[5] = [25,29,20,34,25,9,25,7,25,0,31,4,31,11,0,25,22,25,0,0,27,0,0,0,7,29,15,11,31,12,20,12,29];
	// 8 - Dragon
	resultArray[6] = [23,16,29,27,0,25,0,0,24,29,29,27,0,29,0,20,0,20,30,29,23,16,28,0,8,13,0,24,0,29,24,3,2];
	// 9 - Element
	resultArray[7] = [0,0,4,5,6,7,0,26,0,11,12,13,0,15,16,0,18,0,20,0,22,23,24,25,9,27,0,29,30,31,0,33,34];
	// 10 - Entity
	resultArray[8] = [16,0,20,16,25,25,24,0,0,25,23,24,0,5,24,16,0,6,23,27,16,16,16,6,10,5,31,16,0,0,16,5,25];
	// 11 - Fairy
	resultArray[9] = [7,27,7,27,27,0,29,11,25,9,34,18,27,18,5,0,27,20,25,18,34,5,34,12,11,29,18,34,28,27,0,34,20];
	// 12 - Fallen
	resultArray[10] = [7,29,27,22,16,31,29,12,23,34,9,33,16,31,31,0,27,24,4,31,5,27,16,7,12,18,15,4,16,5,24,27,22];
	// 13 - Femme
	resultArray[11] = [23,5,15,0,24,4,27,13,24,18,33,9,24,33,24,27,15,0,24,0,33,24,23,11,13,22,15,23,24,5,8,12,5];
	// 14 - Fiend
	resultArray[12] = [0,0,27,4,0,31,0,0,0,27,16,24,0,0,6,34,0,10,21,0,33,0,8,0,14,24,0,5,0,0,0,0,27];
	// 15 - Foul
	resultArray[13] = [0,0,33,18,8,11,29,15,5,18,31,33,0,0,0,0,0,12,0,18,13,0,31,0,15,5,31,12,18,18,0,4,29];
	// 16 - Fury
	resultArray[14] = [20,23,2,24,0,6,0,16,24,5,31,24,6,0,0,24,0,31,23,23,13,24,31,6,16,24,30,23,6,30,6,0,20];
	// 17 - Genma
	resultArray[15] = [23,25,11,0,25,25,20,0,16,0,0,27,34,0,24,0,0,25,34,16,24,25,13,7,17,20,24,13,34,34,20,34,0];
	// 18 - Haunt
	resultArray[16] = [0,0,33,7,0,22,0,18,0,27,27,15,0,0,0,0,0,0,0,33,31,0,31,0,18,34,0,0,15,15,0,22,22];
	// 19 - Herald
	resultArray[17] = [6,25,0,15,10,25,20,0,6,20,24,0,10,12,31,25,0,9,7,12,0,7,6,6,19,12,0,8,12,7,23,0,25];
	// 20 - Holy
	resultArray[18] = [25,24,2,3,25,11,30,20,23,25,4,24,21,0,23,34,0,7,9,5,4,24,2,7,20,11,33,23,0,0,23,0,7];
	// 21 - Jaki
	resultArray[19] = [31,0,3,23,12,0,29,0,27,18,31,0,0,18,23,16,33,12,5,0,33,4,13,0,21,15,4,0,12,0,17,0,32];
	// 22 - Jirae
	resultArray[20] = [23,23,34,11,5,27,23,22,16,34,5,33,33,13,13,24,31,0,4,33,9,29,4,24,22,15,15,12,33,18,23,21,4];
	// 23 - Kishin
	resultArray[21] = [20,24,20,29,16,31,16,23,16,5,27,24,0,0,24,25,0,7,24,4,29,0,16,24,23,13,30,13,0,0,16,0,13];
	// 24 - Lady
	resultArray[22] = [16,0,29,16,0,25,28,24,16,34,16,23,8,31,31,13,31,6,2,13,4,16,0,0,24,23,23,13,0,0,23,18,27];
	// 25 - Megami
	resultArray[23] = [6,6,0,13,0,20,0,25,6,12,7,11,0,0,6,7,0,6,7,0,24,24,16,0,25,12,30,11,0,16,6,31,23];
	// 26 - Mitama
	resultArray[24] = [2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,0,27,28,29,30,31,32,33,34];
	// 27 - Night
	resultArray[25] = [20,13,11,0,31,29,13,27,5,29,18,22,24,5,24,20,34,12,11,15,15,13,23,12,27,9,31,0,24,24,0,4,7];
	// 28 - Raptor
	resultArray[26] = [33,25,33,23,30,15,0,0,31,18,15,15,0,31,30,24,0,0,33,4,15,30,23,30,28,31,0,15,16,16,0,31,18];
	// 29 - Snake
	resultArray[27] = [24,23,5,4,23,11,24,29,16,34,4,23,5,12,23,13,0,8,23,0,12,13,13,11,29,0,15,9,5,28,23,0,27];
	// 30 - Tyrant
	resultArray[28] = [0,0,27,0,0,31,0,30,0,28,16,24,0,18,6,34,15,12,0,12,33,0,0,0,30,24,16,5,0,16,0,27,27];
	// 31 - Vile
	resultArray[29] = [6,0,15,18,0,12,29,31,0,27,5,5,0,18,30,34,15,7,0,0,18,0,0,16,31,24,16,28,16,0,23,15,22];
	// 32 - Wargod
	resultArray[30] = [6,23,20,18,23,20,24,0,16,0,24,8,0,0,6,20,0,23,23,17,23,16,23,6,32,0,0,23,0,23,0,0,0];
	// 33 - Wilder
	resultArray[31] = [0,0,22,0,3,12,3,33,5,34,27,12,0,4,0,34,22,0,0,0,21,0,18,31,33,4,31,0,0,15,0,9,4];
	// 34 - Yoma
	resultArray[32] = [7,27,12,13,25,29,2,34,25,20,22,5,27,29,20,0,22,25,7,32,4,13,27,23,34,7,18,27,27,22,0,4,9];

// There should be another array for cursed fusions:


// Another array for elemental fusions:


// Temporary global variables for referencing selected items
var firstDemonClass = 8;
var secondDemonClass = 8;
var selectedDemon = 0;
var actor1Selected;


(function() {
	var _Scene_Map_createallwindows = Scene_Map.prototype.createAllWindows;
	var _Game_Message_isBusy = Game_Message.prototype.isBusy;
	var _Actor_List = Window_Selectable.prototype.start; //addition
	var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;

	// adds the 'fusion' plugin command
	Game_Interpreter.prototype.pluginCommand = function(command, args) {
		_Game_Interpreter_pluginCommand.call(this, command, args);
		if (command === 'fusion') {
			// As long as you're not in battle
			if (!$gameParty.inBattle()) {
				SceneManager._scene._myWindow.refresh();
				SceneManager._scene._myWindow.show();
				SceneManager._scene._myWindow.open();
				SceneManager._scene._myWindow.activate();
				SceneManager._scene._myWindow.select(1);
				SceneManager._scene._fusionHelpWindow.refresh();
				SceneManager._scene._fusionHelpWindow.show();
				SceneManager._scene._fusionHelpWindow.open();
			};
		}
	};

	Game_Message.prototype.isBusy = function() {
		if (SceneManager._scene._myWindow && SceneManager._scene._myWindow.isOpen()) {
			return true;
		}
		return _Game_Message_isBusy.call(this);
	};

	// Creates all window for the fusion
	Scene_Map.prototype.createAllWindows = function() {
		_Scene_Map_createallwindows.call(this);
		
		// This is the fusion window, which displays all party members
		// and possible results
		this._myWindow = new Fusion_Window(0, 0);
		this.addWindow(this._myWindow);
		this._myWindow.close();

		// This is the fusion window's help window
		this._fusionHelpWindow = new Fusion_Window_Help();
		this.addWindow(this._fusionHelpWindow);
		this._fusionHelpWindow.close();

		// This is the result window
		this._fusionResultWindow = new Result_Window_Status();
		this.addWindow(this._fusionResultWindow);
		this._fusionResultWindow.close();

		// This is the choice window displayed alongside the result window
		
		this._fusionChoiceWindow = new Fusion_Choice_Window();
		this.addWindow(this._fusionChoiceWindow);
		this._fusionChoiceWindow.close();
		
		// Declaring pseudo-parent-child relationships
		this._myWindow._fusionHelpWindow = this._fusionHelpWindow;
		this._myWindow._fusionResultWindow = this._fusionResultWindow;
		//this._myWindow._fusionChoiceWindow = this._fusionChoiceWindow;
	};

	
 //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 // Fusion Window
 // Define the Fusion window class
 //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

	function Fusion_Window() {
		this.initialize.apply(this, arguments);
	}

	Fusion_Window.prototype = Object.create(Window_Selectable.prototype);
	Fusion_Window.prototype.constructor = Fusion_Window;
	
	Fusion_Window.prototype.windowWidth = function() {
		return 816;
	};

	Fusion_Window.prototype.standardFontSize = function() {
	    return 20;
	};
	
	Fusion_Window.prototype.maxItems = function() {
		return $gameParty.size();

	};

	Fusion_Window.prototype.numVisibleRows = function() {
		return Math.min(10,this.maxItems());
	};

	// This part draws the content
	// Also sets the help window.
	Fusion_Window.prototype.drawItem = function(index) {
		if (index == 0) {
			this.drawHeader();
		return;
		}
		this.setHelpWindow(this._fusionHelpWindow);
		
		var actor = $gameParty.members()[index];
		var rect = this.itemRectForText(index);
		var segmentWidth1 = rect.width/2;
		var segmentWidth2 = segmentWidth1/10;
		var segmentWidth3 = segmentWidth1/10;
		var actorClass = $gameParty.members()[index]._classId;

		// If there's already a selected demon
		if ( actor && actor1Selected ) {
			this.drawText(index, rect.x, rect.y, segmentWidth2);
			this.drawActorClass(actor, rect.x+segmentWidth2, rect.y, segmentWidth2*4);
			this.drawActorName(actor, rect.x+(segmentWidth2*4), rect.y, segmentWidth2*4);
			this.drawActorLevel(actor, rect.x+(segmentWidth2*8), rect.y, segmentWidth2*8);

			//This part shows whether they're fuseable or not
			//refers to the resultsArray above

			//Checks wether they are the same party member.
			if ( actor1Selected._actorId == actor._actorId){
				this.changeTextColor(this.deathColor());
				this.drawText( '----------', rect.x + segmentWidth3*10, rect.y, segmentWidth3*10);
				this.resetTextColor();
			}
			//If element
			else if ( resultArray[actor1Selected._classId - 2][ actor._classId - 2] == 9 ){
				this.changeTextColor(this.hpGaugeColor1());
				this.drawText( 'Element', rect.x + segmentWidth3*10, rect.y, segmentWidth3*10);
				this.resetTextColor();
			}
			//If not same party member, process the results
			else{
				// If the result is valid, after cross-checking the results array
				if( resultArray[actor1Selected._classId - 2][ actor._classId - 2] != 0 ){
					result = this.calculateFusionResult(actor, actor1Selected);
					// If player level is lower than resulting demon, cannot proceed to fusion
					if ($gameParty.members()[0].level <= result.initialLevel){
						this.changeTextColor(this.deathColor());
					}
					// else, it's fine.
					else{
						this.changeTextColor(this.crisisColor());
					}
					this.drawText( $dataClasses[result.classId].name + '   ' + result.name + '   ' + result.initialLevel, rect.x + segmentWidth3*10, rect.y, segmentWidth3*10);
					this.resetTextColor();
				}
				// If the result is invalid, after cross-checking the results array
				else{
					this.changeTextColor(this.deathColor());
					this.drawText( 'X', rect.x + segmentWidth3*10, rect.y, segmentWidth3*10);	
					this.resetTextColor();
				}
			}
		}
		// This should be the default screen, where no demon has been selected yet
		else {
			this.drawText(index, rect.x, rect.y, segmentWidth2);
			this.drawActorClass(actor, rect.x+segmentWidth2, rect.y, segmentWidth2*4);
			this.drawActorName(actor, rect.x+(segmentWidth2*4), rect.y, segmentWidth2*4);
			this.drawActorLevel(actor, rect.x+(segmentWidth2*8), rect.y, segmentWidth2*8);

			//This part shows whether they're fuseable or not
			//refers to the resultsArray above
			for (i = 0; i < this.maxItems()-1; i++){
				//Checks wether they are the same party member.
				if ( $gameParty.members()[i+1]._actorId == $gameParty.members()[index]._actorId){
					this.changeTextColor(this.deathColor());
					this.drawText( '-', rect.x+segmentWidth1+(segmentWidth3*i), rect.y, segmentWidth3);
					this.resetTextColor();
				}
				//If element
				else if ( resultArray[actorClass - 2][ $gameParty.members()[i+1]._classId - 2] == 9 ){
					this.changeTextColor(this.hpGaugeColor1());
					this.drawText( 'E', rect.x+segmentWidth1+(segmentWidth3*i), rect.y, segmentWidth3);
					this.resetTextColor();
				}
				//If not same party member, process the results
				else{
					if( resultArray[actorClass - 2][ $gameParty.members()[i+1]._classId - 2] != 0 ){
						this.changeTextColor(this.crisisColor());
						this.drawText( 'O', rect.x+segmentWidth1+(segmentWidth3*i), rect.y, segmentWidth3);
						this.resetTextColor();
					}
					
					else{
						this.changeTextColor(this.deathColor());
						this.drawText( 'X', rect.x+segmentWidth1+(segmentWidth3*i), rect.y, segmentWidth3);	
						this.resetTextColor();
					}
				}
			}
		}
	};

	// refresh the window, including moving it into position, which is at the very bottom of the page
	Fusion_Window.prototype.refresh = function() {
		this.move(0, Graphics.boxHeight - this.fittingHeight(this.numVisibleRows()),this.windowWidth(),this.fittingHeight(this.numVisibleRows()));
		this.contents.clear();
		this._fusionHelpWindow.contents.clear();
		this.createContents();
		this.drawAllItems();
	};

	//No need to display the term 'lvl'
	Fusion_Window.prototype.drawActorLevel = function(actor, x, y) {
	    this.drawText(actor.level, x, y, 36, 'left');
	};


	// draw the header text for each column
	Fusion_Window.prototype.drawHeader = function() {
		var rect = this.itemRectForText(0);
		//divide between the selection and the result
		var segmentWidth1 = rect.width/2;
		//partition of the selection part
		var segmentWidth2 = segmentWidth1/10;
		var segmentWidth3 = segmentWidth1/10;
		this.changeTextColor(this.systemColor());
		this.drawText('#', rect.x, rect.y, segmentWidth2);
		this.drawText('Class', rect.x+segmentWidth2, rect.y, segmentWidth2*4);
		this.drawText('Name', rect.x+(segmentWidth2*4), rect.y, segmentWidth2*4);
		this.drawText('LV', rect.x+(segmentWidth2*8), rect.y, segmentWidth2*8);

		// This part runs only if there's nothing selected yet.
		if ( actor1Selected ) {
		// This part runs only if there's already a selected demon
			this.drawText('Result', rect.x + segmentWidth1 + segmentWidth3*3, rect.y, segmentWidth3*10);
		}
		else{
			for (i = 0; i < this.maxItems()-1; i++){
				this.drawText( (i+1), rect.x+segmentWidth1+(segmentWidth3*i), rect.y, segmentWidth3);
			}	
		}
		this.resetTextColor();
	};

	// the header text is on line 0, which is selectable but shouldn't be.
	// Modifying the cursor code means the cursor can't stop on it
	Fusion_Window.prototype.cursorDown = function(wrap) {
		Window_Selectable.prototype.cursorDown.call(this,wrap);
		if (this.index() == 0) {
			Window_Selectable.prototype.cursorDown.call(this,wrap);
		}
	};
	Fusion_Window.prototype.cursorUp = function(wrap) {
		Window_Selectable.prototype.cursorUp.call(this,wrap);
		if (this.index() == 0) {
			Window_Selectable.prototype.cursorUp.call(this,wrap);
		}
	};
	Fusion_Window.prototype.isOkEnabled = function() {
		return true;
	};
	Fusion_Window.prototype.isCancelEnabled = function() {
		return true;
	};
	Fusion_Window.prototype.callCancelHandler = function() {
		this.callHandler('cancel');
	};
	Fusion_Window.prototype.processCancel = function() {
		SoundManager.playCancel();
		this.updateInputData();
		this.deactivate();
		this.close();
		SceneManager._scene._fusionHelpWindow.close();
		SceneManager._scene._fusionResultWindow.close();
		console.log('Cancel triggered');
		actor1Selected = null;
		this.callCancelHandler();
	};
	Fusion_Window.prototype.close = function() {
		if (!this.isClosed()) {
			this._closing = true;
		}
		this._opening = false;
	};
	Fusion_Window.prototype.isOkTriggered = function() {
		return Input.isRepeated('ok');
	};
	Fusion_Window.prototype.isCancelTriggered = function() {
		return Input.isRepeated('cancel');
	};

	// This part handles all functions related to pressing the 'ok' button
	Fusion_Window.prototype.processOk = function() {
		if (this.isCurrentItemEnabled()) {
			this.playOkSound();
			
			// If there's already an actor selected, we should go to the status screen
			// of the resulting demon
			if ( actor1Selected ){
				SceneManager._scene._fusionHelpWindow.refresh();
				this.close();
				var actor = $gameParty.members()[this.index()];
				var res = this.calculateFusionResult(actor, actor1Selected);
				
				//temporarily add the actor to the current party list so the game doesn't crash
				$gameParty.addActor(res.id);

				// Display the status of the actor... runs into an error.
				this._fusionResultWindow.setActor( $gameParty.members()[ $gameParty.size() - 1 ]);
				SceneManager._scene._fusionHelpWindow.close();
				SceneManager._scene._myWindow.close();
				SceneManager._scene._fusionResultWindow.refresh();
				SceneManager._scene._fusionResultWindow.open();
				SceneManager._scene._fusionChoiceWindow.refresh();
				SceneManager._scene._fusionChoiceWindow.open();

				//remove the temporary member from the party
				$gameParty.removeActor(res.id);
				this.callOkHandler();
				actor1Selected = null;
			}
			// else, it's the assumption that there's nothing selected yet.
			else{
				SceneManager._scene._fusionHelpWindow.refresh();
				
				// Sets the selected actor
				actor1Selected = $gameParty.members()[this.index()];
				console.log('****----actor selected:' + actor1Selected);
				
				this._fusionHelpWindow.actorSelected = $gameParty.members()[this.index()];
				SceneManager._scene._myWindow.contents.clear();
				SceneManager._scene._myWindow.refresh();
				SceneManager._scene._fusionResultWindow.close();
				this.callOkHandler();
			}
		}
		else {
			this.playBuzzerSound();
			actor1Selected = null;
		};
	};

 //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 // Fusion Help Window
 // Defines the help window class
 // Should display the selected demon on screen 2
 //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

	Fusion_Window.prototype.createHelpWindow = function() {
	    this._fusionHelpWindow = new Fusion_Window_Help();
	    this.addWindow(this._fusionHelpWindow);
	};

	function Fusion_Window_Help() {
	    this.initialize.apply(this, arguments);
	}

	Fusion_Window_Help.prototype = Object.create(Window_Base.prototype);
	Fusion_Window_Help.prototype.constructor = Fusion_Window_Help;

	Fusion_Window_Help.prototype.initialize = function(numLines) {
	    var width = Graphics.boxWidth;
	    var height = this.contentsHeight()*2;
	    Window_Base.prototype.initialize.call(this, 0, 0, width, height);
	};

	Fusion_Window_Help.prototype.contentsHeight = function() {
	    return this.lineHeight();
	};

	Fusion_Window_Help.prototype.setText = function(text) {
	    if (this._text !== text) {
	        this._text = text;
	        this.refresh();
	    }
	};

	Fusion_Window_Help.prototype.clear = function() {
	    this.setText('');
	};

	Fusion_Window_Help.prototype.setItem = function(item) {
	    this.setText(item ? item.name : '');
	};

	Fusion_Window_Help.prototype.refresh = function() {
	    this.contents.clear();
	    var actorSelected;
	    this.setText('Select the 1st demon');
	    
	    if(actorSelected){
	    	this.setText('Select the second Demon \n    Currently Selected: ' + $dataClasses[actorSelected._classId].name + '   ' + actorSelected._name + '   ' + actorSelected.level);
	    	console.log ('From Help window, actor1Selected is : ' + actorSelected._name);
	    }
	    else{
			this.setText('Select the 1st demon');
	    };
	    this.drawTextEx(this._text, this.textPadding(), 0);
	};

	Fusion_Window_Help.prototype.standardFontSize = function() {
	    return 20;
	};
	Fusion_Window_Help.prototype.lineHeight = function() {
	    return 36;
	};
	Fusion_Window_Help.prototype.standardPadding = function() {
	    return 18;
	};
	Fusion_Window_Help.prototype.textPadding = function() {
	    return 3;
	};

 //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 // Fusion Result Status Window
 // Defines the result window class
 // Should display the resulting demon's stats and skills
 // this._fusionResultWindow = new Result_Window_Status();
 //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

	function Result_Window_Status() {
		this.initialize.apply(this, arguments);
	}

	Result_Window_Status.prototype = Object.create(Window_Status.prototype);
	Result_Window_Status.prototype.constructor = Result_Window_Status;

	Result_Window_Status.prototype.initialize = function() {
	    var width = Graphics.boxWidth;
	    var height = Graphics.boxHeight-60;
	    Window_Selectable.prototype.initialize.call(this, 0, 60, width, height);
	    this.refresh();
	    this.activate();
	    this.contents.fontSize = 20;
	};

	Result_Window_Status.prototype.refresh = function() {
	    this.contents.clear();
	    if (this._actor) {
	        //var lineHeight = this.lineHeight();
	        console.log(' Actor to be displayed: ' + this._actor._name);
	        var lineHeight = this.lineHeight()/2;
	        this.drawBlock2(lineHeight * 2);
	        this.drawBlock1(lineHeight * 0);
	        this.drawHorzLine(lineHeight * 1);
	        this.drawHorzLine(lineHeight * 6);
	        this.drawBlock3(lineHeight * 7);
	        this.drawHorzLine(lineHeight * 15);
	        this.drawBlock4(lineHeight * 16);
	    }
	};

	Result_Window_Status.prototype.setActor = function(actor) {
	    if (this._actor !== actor) {
	        this._actor = actor;
	        this.refresh();
	    }
	};

	// Contents
	Result_Window_Status.prototype.drawBlock1 = function(y) {
	    this.drawActorClass(this._actor, 6, y);
	    this.drawActorName(this._actor, 100, y);
	    this.drawText(this._actor.desc, 6, y*2);
	};

	Result_Window_Status.prototype.drawBlock2 = function(y) {
	    this.drawActorFace(this._actor, Graphics.boxWidth - 350, 0, 300, this.contentsHeight());
	    this.drawBasicInfo(6, y);
	    this.drawExpInfo(180, y);
	};

	Result_Window_Status.prototype.drawBlock3 = function(y) {
	    this.drawParameters(6, y);
	};

	Result_Window_Status.prototype.drawBlock4 = function(y) {
	    this.drawSkills(6,y);
	};

	Result_Window_Status.prototype.drawSkills = function(x, y) {
		var args = this._actor.skills();
		var lineHeight = (this.lineHeight()/7)*5;
	    var y2;
		this.changeTextColor(this.systemColor());
		this.drawText('Skills:', x, y);
		this.resetTextColor();
		var segmentWidth1 = (Graphics.boxWidth - 200 )/(args.length/4);
		console.log(args.length);
		console.log(args[0]);
		
		var rect = this.itemRect(y);
	    rect.width = segmentWidth1*4;
	    rect.height = lineHeight*5;
	    rect.x = x;
	    rect.y = lineHeight;
	    rect.lineHeight = lineHeight;
	    
	    // Maximum number of listed skills in a column.
	    var maxCols = 8;
	    
	    var len = args.length;
	    // Determine how many columns are needed by dividing the length by 5 then
	    // round the number up

	    var cols = Math.ceil(len/maxCols);

	    if ( args != null){
		//First case, if skills are less than or equal to 5, requiring one column
		    if (len <= maxCols){
				for (i = 0; i < len-1; i++){
					y2 = y + lineHeight * i;
					console.log(args[i]);
					this.drawText(args[i].name, rect.x, rect.y + y2, segmentWidth1);
				}
			}
		    else{
		    	for (i = 0; i < maxCols; i++){
		    		for( j = 0; j < cols; j++){
		    			y2 = y + lineHeight * i;
		    			//just making sure that it isn't empty for this iteration.
		    			if (args[ i+(j*maxCols) ]){
		    				this.drawText(args[ i+(j*maxCols) ].name, rect.x + (150*j), rect.y + y2, segmentWidth1);		
		    			}
		    		}
		    	}
		    }
	    }
	};

	Result_Window_Status.prototype.maxCols = function() {
	    return 2;
	};

	Result_Window_Status.prototype.drawHorzLine = function(y) {
	    var lineY = y + this.lineHeight() / 2 - 1;
	    this.contents.paintOpacity = 48;
	    this.contents.fillRect(0, lineY, this.contentsWidth(), 2, this.lineColor());
	    this.contents.paintOpacity = 255;
	};

	Result_Window_Status.prototype.drawBasicInfo = function(x, y) {
	    //var lineHeight = this.lineHeight()/1.5;
	    var lineHeight = this.lineHeight();
	    this.drawActorLevel(this._actor, x, y + lineHeight * 0);
	    this.drawActorHp(this._actor, x, y + lineHeight * 1);
	    this.drawActorMp(this._actor, x+180, y + lineHeight * 1);
	};

	Result_Window_Status.prototype.drawActorLevel = function(actor, x, y) {
	    this.changeTextColor(this.systemColor());
	    this.drawText(TextManager.levelA, x, y, 48);
	    this.resetTextColor();
	    this.drawText(actor.level, x + 50, y, 36, 'right');
	};

	Result_Window_Status.prototype.drawExpInfo = function(x, y) {
	    var lineHeight = this.lineHeight()/1.5;
	    var expTotal = TextManager.expTotal.format(TextManager.exp);
	    var expNext = TextManager.expNext.format(TextManager.level);
	    var value1 = this._actor.currentExp();
	    var value2 = this._actor.nextRequiredExp();
	    if (this._actor.isMaxLevel()) {
	        value1 = '-------';
	        value2 = '-------';
	    }
	    this.changeTextColor(this.systemColor());
	    //this.drawText(expTotal, x, y + lineHeight * 0, 270);
	    //this.drawText(expNext, x, y + lineHeight * 2, 270);
	    this.drawText('Next', x, y + lineHeight*0, 270);
	    this.resetTextColor();
	    //this.drawText(value1, x, y + lineHeight * 1, 270, 'right');
	    //this.drawText(value2, x, y + lineHeight * 3, 270, 'right');
	    this.drawText(value2, x+80, y + lineHeight*0, 100, 'right');
	};

	Result_Window_Status.prototype.drawParameters = function(x, y) {
	    var lineHeight = this.lineHeight()/1.4;
	    for (var i = 0; i < 6; i++) {
	        var paramId = i + 2;
	        var y2 = y + lineHeight * i;
	        this.changeTextColor(this.systemColor());
	        this.drawText(TextManager.param(paramId), x, y2, 160);
	        this.resetTextColor();
	        this.drawText(this._actor.param(paramId), x + 120, y2, 60, 'right');
	    }
	};

	Result_Window_Status.prototype.drawProfile = function(x, y) {
		this.drawTextEx(this._actor.profile(), x, y);
		//this.drawText(this._actor.profile(), x, y);
	};

	Result_Window_Status.prototype.drawTextEx = function(text, x, y) {
	    if (text) {
	        var textState = { index: 0, x: x, y: y, left: x };
	        textState.text = this.convertEscapeCharacters(text);
	        textState.height = this.calcTextHeight(textState, false);
	        textState.width = this.contentsWidth();
	        //this.resetFontSettings();
	        while (textState.index < textState.text.length) {
	            this.processCharacter(textState);
	        }
	        return textState.x - x;
	    }
	    else {
	        return 0;
	    }
	};

	Result_Window_Status.prototype.drawActorFace = function(actor, x, y, width, height) {
		//this.drawFace(actor.faceName(), actor.faceIndex(), x, y, Math.floor((this.width - (this.standardPadding() * 2)) / this.maxCols()), height);
	    var bustName = actor.name();
		//var bitmap = ImageManager.loadPicture(bustName);
	    var bitmap = ImageManager.loadPicture(bustName + '_Status');
	    //this.drawFace(actor.faceName(), actor.faceIndex(), x, y, width, height);
		var ox = 0;
		var oy = 0;
	    var dx = x - 1;
	    var dy = y ;
	    var sx = bitmap.width / 2 - width / 2 - ox;
	    var sy = oy;
	    var sh = height;
	    if (bitmap != null){
	        this.contents.unlimitedBlt(bitmap, sx, sy, width, sh, dx, dy);
	    };
	};

	Bitmap.prototype.unlimitedBlt = function(source, sx, sy, sw, sh, dx, dy, dw, dh) {
	    dw = dw || sw;
	    dh = dh || sh;
	        this._context.globalCompositeOperation = 'source-over';
	        this._context.drawImage(source._canvas, sx, sy, sw, sh, dx, dy, dw, dh);
	        this._setDirty();
	};

	Result_Window_Status.prototype.drawActorCharacter = function(actor, x, y) {
	    this.drawCharacter(actor.characterName(), actor.characterIndex(), x, y);
	};

	Result_Window_Status.prototype.drawActorName = function(actor, x, y, width) {
	    width = width || 168;
	    this.changeTextColor(this.hpColor(actor));
	    this.drawText(actor.name(), x, y, width);
	};

	Result_Window_Status.prototype.drawActorClass = function(actor, x, y, width) {
	    width = width || 168;
	    this.resetTextColor();
	    this.drawText(actor.currentClass().name, x, y, width);
	};

	Result_Window_Status.prototype.drawActorNickname = function(actor, x, y, width) {
	    width = width || 270;
	    this.resetTextColor();
	    this.drawText(actor.nickname(), x, y, width);
	};

	Result_Window_Status.prototype.drawActorLevel = function(actor, x, y) {
	    this.changeTextColor(this.systemColor());
	    this.drawText(TextManager.levelA, x, y, 48);
	    this.resetTextColor();
	    this.drawText(actor.level, x + 84, y, 36, 'right');
	};

	Result_Window_Status.prototype.drawActorIcons = function(actor, x, y, width) {
	    width = width || 144;
	    var icons = actor.allIcons().slice(0, Math.floor(width / Result_Window_Status._iconWidth));
	    for (var i = 0; i < icons.length; i++) {
	        this.drawIcon(icons[i], x + Result_Window_Status._iconWidth * i, y + 2);
	    }
	};

	Result_Window_Status.prototype.drawCurrentAndMax = function(current, max, x, y,
	                                                   width, color1, color2) {
	    var labelWidth = this.textWidth('HP');
	    var valueWidth = this.textWidth('0000');
	    var slashWidth = this.textWidth('/');
	    var x1 = x + width - valueWidth;
	    var x2 = x1 - slashWidth;
	    var x3 = x2 - valueWidth;
	    if (x3 >= x + labelWidth) {
	        this.changeTextColor(color1);
	        this.drawText(current, x3, y, valueWidth, 'right');
	        this.changeTextColor(color2);
	        this.drawText('/', x2, y, slashWidth, 'right');
	        this.drawText(max, x1, y, valueWidth, 'right');
	    } else {
	        this.changeTextColor(color1);
	        this.drawText(current, x1, y, valueWidth, 'right');
	    }
	};

	Result_Window_Status.prototype.drawActorHp = function(actor, x, y, width) {
	    width = width || 186;
	    var color1 = this.hpGaugeColor1();
	    var color2 = this.hpGaugeColor2();
	    this.drawGauge(x, y, width, actor.hpRate(), color1, color2);
	    this.changeTextColor(this.systemColor());
	    this.drawText(TextManager.hpA, x, y, 44);
	    this.drawCurrentAndMax(actor.hp, actor.mhp, x, y, width,
	                           this.hpColor(actor), this.normalColor());
	};

	Result_Window_Status.prototype.drawActorMp = function(actor, x, y, width) {
	    width = width || 186;
	    var color1 = this.mpGaugeColor1();
	    var color2 = this.mpGaugeColor2();
	    this.drawGauge(x, y, width, actor.mpRate(), color1, color2);
	    this.changeTextColor(this.systemColor());
	    this.drawText(TextManager.mpA, x, y, 44);
	    this.drawCurrentAndMax(actor.mp, actor.mmp, x, y, width,
	                           this.mpColor(actor), this.normalColor());
	};

	Result_Window_Status.prototype.drawActorTp = function(actor, x, y, width) {
	    width = width || 96;
	    var color1 = this.tpGaugeColor1();
	    var color2 = this.tpGaugeColor2();
	    this.drawGauge(x, y, width, actor.tpRate(), color1, color2);
	    this.changeTextColor(this.systemColor());
	    this.drawText(TextManager.tpA, x, y, 44);
	    this.changeTextColor(this.tpColor(actor));
	    this.drawText(actor.tp, x + width - 64, y, 64, 'right');
	};

	Result_Window_Status.prototype.drawActorSimpleStatus = function(actor, x, y, width) {
	    var lineHeight = this.lineHeight();
	    var x2 = x + 180;
	    var width2 = Math.min(200, width - 180 - this.textPadding());
	    this.drawActorName(actor, x, y);
	    this.drawActorLevel(actor, x, y + lineHeight * 1);
	    this.drawActorIcons(actor, x, y + lineHeight * 2);
	    this.drawActorClass(actor, x2, y);
	    this.drawActorHp(actor, x2, y + lineHeight * 1, width2);
	    this.drawActorMp(actor, x2, y + lineHeight * 2, width2);
	};

 //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 // Fusion Choice Window
 // Let's the user decide wether to proceed to fusion or not
 //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

	function Fusion_Choice_Window() {
	    this.initialize.apply(this, arguments);
	};

	Fusion_Choice_Window.prototype = Object.create(Window_Command.prototype);
	Fusion_Choice_Window.prototype.constructor = Fusion_Choice_Window;

	Fusion_Choice_Window.prototype.initialize = function(x, y) {
	    Window_Command.prototype.initialize.call(this, x, y);
	    this.addCommand("Yes", "yes");
	    this.addCommand("No", "no");
	};

	Fusion_Choice_Window.prototype.numVisibleRows = function() {
	    return 1;
	};

	Fusion_Choice_Window.prototype.maxCols = function() {
	    return 2;
	};

	Fusion_Choice_Window.prototype.itemTextAlign = function() {
	    return 'center';
	};


 //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 // Fusion Process
 // Defines processes and calculation related to fusion
 // This part calculates the result of the fusion based on the class
 // of the ingredients. Should not allow fusion above main character's
 // level. 
 //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

	Fusion_Window.prototype.calculateFusionResult = function(item1, item2){
		var fusionResultClass = resultArray[item1._classId - 2][item2._classId - 2];
		var fusionResultArray = [];
		var fusionResultLevel = 0;
		var fusionResult = null;
		
		//create an array for all results
		for ( i = 1; i < $dataActors.length; i++){

			// Adds all actors with the same class to the array
			// For future: Needs to skip those with special tags, like
			// special fusion or evolution only
			// if has boss tag, needs to defeat boss first
			if ( $dataActors[i].classId == fusionResultClass ){
				fusionResultArray.push($dataActors[i]);
				console.log(' Added to the fusionResultArray: ' + $dataActors[i].classId + '  ' + $dataActors[i].name + '  ' + $dataActors[i].initialLevel);
			}
		}
		
		// If Element:
		if ( item2._actorId == item1._actorId){
			// Calculate which element to be the result of
			console.log('calculateFusionResult: Element: item11Selected.name is :' + item2._name);
			console.log('calculateFusionResult: Element: item1.name is :' + item1._name);
		}
		// If not element but valid:
		else if( resultArray[item2._classId - 2][ item1._classId - 2] != 0 ){
			
			var lvlOfDemon1 = $dataActors[item2._actorId].initialLevel;
			var lvlOfDemon2 = $dataActors[item1._actorId].initialLevel;
			fusionResultLevel = Math.floor( ( ( lvlOfDemon2 + lvlOfDemon1 ) / 2 ) + 1);
			
			//find a demon from the result array whose level is less than or equal to
			for ( j = 0; j < fusionResultArray.length; j++){
				if( fusionResultLevel >= fusionResultArray[j].initialLevel ){
					fusionResult = fusionResultArray[j];
				}
			}
		};
		return fusionResult;
	};





})();

[RMMV] How to Pass information to various windows

Hi,
I am at loss as to how to do this. Basically, what I want to accomplish is to have the second window display the item chosen from the first window. Aside from that, enable the user to go back to the first window if he press cancelled on the second window.
What's happening here is that the second help window is not displaying the item selected from the first window.

Here's my code for reference (sorry for the amount of console logs and comments)
I uploaded it as a text file due to the number of lines involved...
Code is here


[SCRIPTING] [RMMV] Selectable windows and databases

I'm working on a similar implementation on this one, although this one would call on several windows. I'm stuck on the first phase, which is trying to get the player to select the first ingredient to fuse.
I do not know how to add a 'help' window on the top that prompts the user to select the first party member, nor go to a second window where the 'help' window would display the party member selected from the first window.

Here's the code that I have...

/*:
 * @plugindesc Display a list of actors for fusion
 *
 * @param none
 * @desc none
 * @default false
 *
 * @help
 *
 * Plugin Command:
 *
 * fusion - initiates the fusion thinggy
 *
 */


 //--------------------------------------------------------------------
 //
 // Global Variables
 //
 // Fusion result array and selected demons
 // 
 //--------------------------------------------------------------------

var resultArray = [32];
	// 2 - Avatar
	resultArray[0] = [0,20,29,23,0,25,23,0,16,7,7,23,0,0,20,23,0,6,25,31,23,20,16,6,2,20,33,24,0,6,6,0,7];
	// 3 - Avian
	resultArray[1] = [20,0,13,23,25,29,16,0,0,27,29,5,0,0,23,25,0,25,24,0,23,24,0,6,3,13,25,23,0,0,23,0,27];
	// 4 - Beast
	resultArray[2] = [29,13,9,13,2,20,29,4,20,7,27,15,27,33,2,11,33,0,2,3,34,20,29,0,4,11,33,5,27,15,20,22,12];
	// 5 - Brute
	resultArray[3] = [23,23,13,9,23,34,27,5,16,27,0,4,18,33,0,7,15,0,3,23,0,0,0,0,5,23,16,0,18,18,0,11,13];
	// 6 - Deity
	resultArray[4] = [0,25,2,23,0,25,0,6,25,27,16,24,0,8,0,25,0,10,25,12,5,16,0,0,6,31,30,23,0,0,23,3,25];
	// 7 - Divine
	resultArray[5] = [25,29,20,34,25,9,25,7,25,0,31,4,31,11,0,25,22,25,0,0,27,0,0,0,7,29,15,11,31,12,20,12,29];
	// 8 - Dragon
	resultArray[6] = [23,16,29,27,0,25,0,0,24,29,29,27,0,29,0,20,0,20,30,29,23,16,28,0,8,13,0,24,0,29,24,3,2];
	// 9 - Element
	resultArray[7] = [0,0,4,5,6,7,0,26,0,11,12,13,0,15,16,0,18,0,20,0,22,23,24,25,9,27,0,29,30,31,0,33,34];
	// 10 - Entity
	resultArray[8] = [16,0,20,16,25,25,24,0,0,25,23,24,0,5,24,16,0,6,23,27,16,16,16,6,10,5,31,16,0,0,16,5,25];
	// 11 - Fairy
	resultArray[9] = [7,27,7,27,27,0,29,11,25,9,34,18,27,18,5,0,27,20,25,18,34,5,34,12,11,29,18,34,28,27,0,34,20];
	// 12 - Fallen
	resultArray[10] = [7,29,27,22,16,31,29,12,23,34,9,33,16,31,31,0,27,24,4,31,5,27,16,7,12,18,15,4,16,5,24,27,22];
	// 13 - Femme
	resultArray[11] = [23,5,15,0,24,4,27,13,24,18,33,9,24,33,24,27,15,0,24,0,33,24,23,11,13,22,15,23,24,5,8,12,5];
	// 14 - Fiend
	resultArray[12] = [0,0,27,4,0,31,0,0,0,27,16,24,0,0,6,34,0,10,21,0,33,0,8,0,14,24,0,5,0,0,0,0,27];
	// 15 - Foul
	resultArray[13] = [0,0,33,18,8,11,29,15,5,18,31,33,0,0,0,0,0,12,0,18,13,0,31,0,15,5,31,12,18,18,0,4,29];
	// 16 - Fury
	resultArray[14] = [20,23,2,24,0,6,0,16,24,5,31,24,6,0,0,24,0,31,23,23,13,24,31,6,16,24,30,23,6,30,6,0,20];
	// 17 - Genma
	resultArray[15] = [23,25,11,0,25,25,20,0,16,0,0,27,34,0,24,0,0,25,34,16,24,25,13,7,17,20,24,13,34,34,20,34,0];
	// 18 - Haunt
	resultArray[16] = [0,0,33,7,0,22,0,18,0,27,27,15,0,0,0,0,0,0,0,33,31,0,31,0,18,34,0,0,15,15,0,22,22];
	// 19 - Herald
	resultArray[17] = [6,25,0,15,10,25,20,0,6,20,24,0,10,12,31,25,0,9,7,12,0,7,6,6,19,12,0,8,12,7,23,0,25];
	// 20 - Holy
	resultArray[18] = [25,24,2,3,25,11,30,20,23,25,4,24,21,0,23,34,0,7,9,5,4,24,2,7,20,11,33,23,0,0,23,0,7];
	// 21 - Jaki
	resultArray[19] = [31,0,3,23,12,0,29,0,27,18,31,0,0,18,23,16,33,12,5,0,33,4,13,0,21,15,4,0,12,0,17,0,32];
	// 22 - Jirae
	resultArray[20] = [23,23,34,11,5,27,23,22,16,34,5,33,33,13,13,24,31,0,4,33,9,29,4,24,22,15,15,12,33,18,23,21,4];
	// 23 - Kishin
	resultArray[21] = [20,24,20,29,16,31,16,23,16,5,27,24,0,0,24,25,0,7,24,4,29,0,16,24,23,13,30,13,0,0,16,0,13];
	// 24 - Lady
	resultArray[22] = [16,0,29,16,0,25,28,24,16,34,16,23,8,31,31,13,31,6,2,13,4,16,0,0,24,23,23,13,0,0,23,18,27];
	// 25 - Megami
	resultArray[23] = [6,6,0,13,0,20,0,25,6,12,7,11,0,0,6,7,0,6,7,0,24,24,16,0,25,12,30,11,0,16,6,31,23];
	// 26 - Mitama
	resultArray[24] = [2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,0,27,28,29,30,31,32,33,34];
	// 27 - Night
	resultArray[25] = [20,13,11,0,31,29,13,27,5,29,18,22,24,5,24,20,34,12,11,15,15,13,23,12,27,9,31,0,24,24,0,4,7];
	// 28 - Raptor
	resultArray[26] = [33,25,33,23,30,15,0,0,31,18,15,15,0,31,30,24,0,0,33,4,15,30,23,30,28,31,0,15,16,16,0,31,18];
	// 29 - Snake
	resultArray[27] = [24,23,5,4,23,11,24,29,16,34,4,23,5,12,23,13,0,8,23,0,12,13,13,11,29,0,15,9,5,28,23,0,27];
	// 30 - Tyrant
	resultArray[28] = [0,0,27,0,0,31,0,30,0,28,16,24,0,18,6,34,15,12,0,12,33,0,0,0,30,24,16,5,0,16,0,27,27];
	// 31 - Vile
	resultArray[29] = [6,0,15,18,0,12,29,31,0,27,5,5,0,18,30,34,15,7,0,0,18,0,0,16,31,24,16,28,16,0,23,15,22];
	// 32 - Wargod
	resultArray[30] = [6,23,20,18,23,20,24,0,16,0,24,8,0,0,6,20,0,23,23,17,23,16,23,6,32,0,0,23,0,23,0,0,0];
	// 33 - Wilder
	resultArray[31] = [0,0,22,0,3,12,3,33,5,34,27,12,0,4,0,34,22,0,0,0,21,0,18,31,33,4,31,0,0,15,0,9,4];
	// 34 - Yoma
	resultArray[32] = [7,27,12,13,25,29,2,34,25,20,22,5,27,29,20,0,22,25,7,32,4,13,27,23,34,7,18,27,27,22,0,4,9];

var firstDemonClass = 2;
var secondDemonClass = 8;


 //--------------------------------------------------------------------
 //
 // Select the 1st party member
 //
 // This must show all part members and determine whether they are fusable 
 // or not based on their classes.
 // 
 //--------------------------------------------------------------------


(function() {
	var _Scene_Map_createallwindows = Scene_Map.prototype.createAllWindows;
	var _Game_Message_isBusy = Game_Message.prototype.isBusy;
	var _Actor_List = Window_Selectable.prototype.start; //addition
	var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;

	// adds the 'actorlist' plugin command
	Game_Interpreter.prototype.pluginCommand = function(command, args) {
		_Game_Interpreter_pluginCommand.call(this, command, args);
		if (command === 'fusion') {
			console.log(firstDemonClass);
			console.log(secondDemonClass);
			//console.log(resultArray[firstDemonClass - 2][secondDemonClass - 2]);
			console.log('First Demon Class is ' + $dataClasses[firstDemonClass].name);
			console.log('Second Demon Class is ' + $dataClasses[secondDemonClass].name);
			console.log('Resulting Demon Class is ' + $dataClasses[resultArray[firstDemonClass - 2][secondDemonClass - 2]].name);
			if (!$gameParty.inBattle()) {
				SceneManager._scene._myWindow.refresh();
				SceneManager._scene._myWindow.show();
				SceneManager._scene._myWindow.open();
				SceneManager._scene._myWindow.activate();
				SceneManager._scene._myWindow.select(1);
				SceneManager._scene._myWindow.setHelpWindow(this._helpWindow);
			};
		}
	};


	Game_Message.prototype.isBusy = function() {
		if (SceneManager._scene._myWindow && SceneManager._scene._myWindow.isOpen()) {
			return true;
		}
		return _Game_Message_isBusy.call(this);
	};

	// create the compendium window while starting the map
	Scene_Map.prototype.createAllWindows = function() {
		_Scene_Map_createallwindows.call(this);
		this._myWindow = new Fusion1_Window(0, 0);
		this.addWindow(this._myWindow);
		this._myWindow.close();
	};

	// define the compendum window class
	function Fusion1_Window() {
		this.initialize.apply(this, arguments);
	}

	//Fusion1_Window.prototype = Object.create(Window_Command.prototype);
	Fusion1_Window.prototype = Object.create(Window_Selectable.prototype);
	Fusion1_Window.prototype.constructor = Fusion1_Window;
	
	// set the width of the window
	Fusion1_Window.prototype.windowWidth = function() {
		return 816;
	};


	Fusion1_Window.prototype.standardFontSize = function() {
	    return 18;
	};
	// set the number of items in the list. Could use different values here,
	// such as $gameParty.members() or $gameParty.battleMembers()
	Fusion1_Window.prototype.maxItems = function() {
		return $gameParty.size();
	//return Game_Party.size();

	};

	// the number of visible rows in the window. Without this the height of the
	// window could be too tall for the screen with large numbers of actors
	Fusion1_Window.prototype.numVisibleRows = function() {
		return Math.min(10,this.maxItems());
	};

	// draw each line of the window. Its width is evenly divided into three
	Fusion1_Window.prototype.drawItem = function(index) {
		if (index == 0) {
			this.drawHeader();
		return;
		}
		//var actor = $gameActors.actor(index);
		var actor = $gameParty.members()[index];
		console.log('actor: ' + actor.name);
		var rect = this.itemRectForText(index);
		//var segmentWidth = rect.width/3;
		var segmentWidth1 = rect.width/2;
		//partition of the selection part
		var segmentWidth2 = segmentWidth1/10;
		var segmentWidth3 = segmentWidth1/10;
		var actorClass = $gameParty.members()[index]._classId;
		if (actor) {
			this.drawText(index, rect.x, rect.y, segmentWidth2);
			this.drawActorClass(actor, rect.x+segmentWidth2, rect.y, segmentWidth2*4);
			this.drawActorName(actor, rect.x+(segmentWidth2*4), rect.y, segmentWidth2*4);
			this.drawActorLevel(actor, rect.x+(segmentWidth2*8), rect.y, segmentWidth2*8);

			//This part shows whether they're fuseable or not
			//refers to the resultsArray above
			for (i = 0; i < this.maxItems()-1; i++){
				//check case if not equal or not zero, then possible for fusion. Otherwise, not possible
				console.log('=-=-=-=-');
				
				console.log('actor Class: ' + actorClass);
				console.log('i: ' + i);
				console.log('Game Party Member for this line: '+ $gameParty.members()[i+1]._name);

				//Checks wether they are the same party member.
				if ( $gameParty.members()[i+1]._actorId == $gameParty.members()[index]._actorId){
					this.drawText( '-', rect.x+segmentWidth1+(segmentWidth3*i), rect.y, segmentWidth3);
				}
				//If element
				else if ( resultArray[actorClass - 2][ $gameParty.members()[i+1]._classId - 2] == 9 ){
					this.drawText( 'E', rect.x+segmentWidth1+(segmentWidth3*i), rect.y, segmentWidth3);
				}
				//If not same party member, process the results
				else{
					if( resultArray[actorClass - 2][ $gameParty.members()[i+1]._classId - 2] != 0 ){
						this.drawText( 'O', rect.x+segmentWidth1+(segmentWidth3*i), rect.y, segmentWidth3);
					}
					
					else{
						this.drawText( 'X', rect.x+segmentWidth1+(segmentWidth3*i), rect.y, segmentWidth3);	
					}
				}
			}
		}
	};

	// refresh the window, including moving it into position
	Fusion1_Window.prototype.refresh = function() {
		this.move(0,60,this.windowWidth(),this.fittingHeight(this.numVisibleRows()));
		this.createContents();
		this.drawAllItems();
	};

	//No need to display the term 'lvl'
	Fusion1_Window.prototype.drawActorLevel = function(actor, x, y) {
	    this.drawText(actor.level, x, y, 36, 'left');
	};

	// draw the header text for each column
	Fusion1_Window.prototype.drawHeader = function() {
		var rect = this.itemRectForText(0);
		//divide between the selection and the result
		var segmentWidth1 = rect.width/2;
		//partition of the selection part
		var segmentWidth2 = segmentWidth1/10;
		var segmentWidth3 = segmentWidth1/10;
		this.changeTextColor(this.systemColor());
		this.drawText('#', rect.x, rect.y, segmentWidth2);
		this.drawText('Class', rect.x+segmentWidth2, rect.y, segmentWidth2*4);
		this.drawText('Name', rect.x+(segmentWidth2*4), rect.y, segmentWidth2*4);
		this.drawText('LV', rect.x+(segmentWidth2*8), rect.y, segmentWidth2*8);
		for (i = 0; i < this.maxItems()-1; i++){
			this.drawText( (i+1), rect.x+segmentWidth1+(segmentWidth3*i), rect.y, segmentWidth3);
		}
		this.resetTextColor();
	};

	// the header text is on line 0, which is selectable but shouldn't be.
	// Modifying the cursor code means the cursor can't stop on it
	Fusion1_Window.prototype.cursorDown = function(wrap) {
		Window_Selectable.prototype.cursorDown.call(this,wrap);
		if (this.index() == 0) {
			Window_Selectable.prototype.cursorDown.call(this,wrap);
		}
	};

	Fusion1_Window.prototype.cursorUp = function(wrap) {
		Window_Selectable.prototype.cursorUp.call(this,wrap);
		if (this.index() == 0) {
			Window_Selectable.prototype.cursorUp.call(this,wrap);
		}
	};

	Fusion1_Window.prototype.isOkEnabled = function() {
		return true;
	};
	Fusion1_Window.prototype.isCancelEnabled = function() {
		return this.isHandled('cancel');
	};
	Fusion1_Window.prototype.callCancelHandler = function() {
	//this.callHandler('cancel');
		Fusion1_Window.close();
	}

	Fusion1_Window.prototype.processCancel = function() {
		SoundManager.playCancel();
		this.updateInputData();
		this.deactivate();
		//
		// same here
		//
		this.close();
		console.log('Cancel triggered');
		this.callCancelHandler();
	};

	Fusion1_Window.prototype.close = function() {
		if (!this.isClosed()) {
			this._closing = true;
		}
		this._opening = false;
		};
		Fusion1_Window.prototype.isOkTriggered = function() {
		return Input.isRepeated('ok');
	};

	Fusion1_Window.prototype.isCancelTriggered = function() {
		return Input.isRepeated('cancel');
	};

	Fusion1_Window.prototype.processOk = function() {
		if (this.isCurrentItemEnabled()) {
			this.playOkSound();
			this.updateInputData();
			this.deactivate();
			this.callOkHandler();

		}
		else {
			this.playBuzzerSound();
		}
	};



})();




 //--------------------------------------------------------------------
 //
 // Select the 2nd Demon
 //
 // The selected demon from the first screen must be shown on this
 // screen, along with the result of the fusion
 // Nothing here so far.
 //--------------------------------------------------------------------

[RMMV] Custom Equip Menu

I managed to have the player learn skills based on equipment and level, however the game crashes when I go inside the skills menu and select a skill... I am unsure why.

//**************************************************
// Scene Equip
// Makes it so that only the hero has this, not anyone else
//**************************************************

Scene_Equip.prototype.create = function() {
    Scene_MenuBase.prototype.create.call(this);
    this.createHelpWindow();
    this.createStatusWindow();
    this.createCommandWindow();
    this.createSlotWindow();
    this.createItemWindow();
    this.refreshActor();
};

Scene_Equip.prototype.createStatusWindow = function() {
    this._statusWindow = new Window_EquipStatus(0, 60);
    this.addWindow(this._statusWindow);
};

Scene_Equip.prototype.createCommandWindow = function() {
    var wx = this._statusWindow.width;
    //var wy = this._helpWindow.height;
    var wy = 60;
    var ww = Graphics.boxWidth - this._statusWindow.width;
    this._commandWindow = new Window_EquipCommand(wx, wy, ww);
    this._commandWindow.setHelpWindow(this._helpWindow);
    this._commandWindow.setHandler('equip',    this.commandEquip.bind(this));
    this._commandWindow.setHandler('optimize', this.commandOptimize.bind(this));
    this._commandWindow.setHandler('clear',    this.commandClear.bind(this));
    this._commandWindow.setHandler('cancel',   this.popScene.bind(this));
    this.addWindow(this._commandWindow);
};

Scene_Equip.prototype.createSlotWindow = function() {
    var wx = this._statusWindow.width;
    var wy = this._commandWindow.y + this._commandWindow.height;
    var ww = Graphics.boxWidth - this._statusWindow.width;
    var wh = this._statusWindow.height - this._commandWindow.height;
    this._slotWindow = new Window_EquipSlot(wx, wy, ww, wh);
    this._slotWindow.setHelpWindow(this._helpWindow);
    this._slotWindow.setStatusWindow(this._statusWindow);
    this._slotWindow.setHandler('ok',       this.onSlotOk.bind(this));
    this._slotWindow.setHandler('cancel',   this.onSlotCancel.bind(this));
    this.addWindow(this._slotWindow);
};

Scene_Equip.prototype.createItemWindow = function() {
    var wx = 0;
    var wy = this._statusWindow.y + this._statusWindow.height;
    var ww = Graphics.boxWidth/2;
    var wh = Graphics.boxHeight - wy;
    this._itemWindow = new Window_EquipItem(wx, wy, ww, wh);
    this._itemWindow.setHelpWindow(this._helpWindow);
    this._helpWindow.width = ww;
    this._helpWindow.height = wh;
    this._helpWindow.x = wx+ww;
    this._helpWindow.y = wy;
    this._helpWindow.contents.fontSize = 18;
    this._itemWindow.setStatusWindow(this._statusWindow);
    this._itemWindow.setHandler('ok',     this.onItemOk.bind(this));
    this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this));
    this._slotWindow.setItemWindow(this._itemWindow);
    this._itemWindow.maxCols();
    this.addWindow(this._itemWindow);
};


Window_ItemList.prototype.maxCols = function() {
    return 1;
};

Window_EquipCommand.prototype.makeCommandList = function() {
    this.addCommand(TextManager.equip2,   'equip');
    //this.addCommand(TextManager.optimize, 'optimize');
    //this.addCommand(TextManager.clear,    'clear');
};

//**************************************************
// Game Actor
// This part handles the level up function, including learning skills
//**************************************************

Game_Actor.prototype.levelUp = function() {
    this._level++;
    actorId = this._actorId;
    console.log('actor ID: '+actorId);
    //If it's the hero's that levels up
    if (actorId = 1){
    	var name = this._name;
    	console.log('Selected Party Member: '+ name);
    	var weapon = $gameParty.members()[0]._equips[0]._itemId;
    	console.log('equipped weapon: '+ $dataWeapons[weapon].name);
    	var wID = weapon ? weapon : 0;
	    console.log('weapon ID: '+wID);
	    var lvl = weapon ? $dataWeapons[wID].meta.level.split(/\s*,\s*/) : 0;
	    console.log('meta lvl: '+ lvl);
	    console.log('lvl a: '+ lvl[0]);
	    console.log('lvl b: '+ lvl[1]);
	    var skill = weapon ? $dataWeapons[wID].meta.skillID.split(/\s*,\s*/) : 0;
	    console.log('meta skill: '+ skill);
	    console.log('skill a: '+ skill[0]);
	    console.log('skill b: '+ skill[1]);
	    
	    // learn the skill based on the meta tag level and skill ID on the equipped Bunshin(weapon)
	    for (i = 0; i < 3; i++){
	    	if (lvl[i] <= this._level) {
	    		console.log('current level is: '+ lvl[i]);
	            this.learnSkill(skill[i]);
	            console.log('learned: '+skill[i]);
	        }
	    }
    }
    //Anyone else
    else{
    	this.currentClass().learnings.forEach(function(learning) {
	        if (learning.level === this._level) {
	            this.learnSkill(learning.skillId);
	        }
	    }, this);
    }
};

Game_Actor.prototype.skills = function() {
    var list = [];
    this._skills.concat(this.addedSkills()).forEach(function(id) {
        if (!list.contains($dataSkills[id])) {
            list.push($dataSkills[id]);
        }
    });
    return list;
};

Game_Actor.prototype.learnSkill = function(skillId) {
    if (!this.isLearnedSkill(skillId)) {
        this._skills.push(skillId);
        this._skills.sort(function(a, b) {
            return a - b;
        });
    }
};

Game_Actor.prototype.isLearnedSkill = function(skillId) {
    return this._skills.contains(skillId);
};


Game_Actor.prototype.equips = function() {
    return this._equips.map(function(item) {
        return item.object();
    });
};



//**************************************************
// Help Window
// Handles the display for the equipment's help window
// This part is DONE
//**************************************************

Scene_MenuBase.prototype.createHelpWindow = function() {
    this._helpWindow = new equipWindow_Help();
    this.addWindow(this._helpWindow);
};

function equipWindow_Help() {
    this.initialize.apply(this, arguments);
}

equipWindow_Help.prototype = Object.create(Window_Base.prototype);
equipWindow_Help.prototype.constructor = Window_Help;

equipWindow_Help.prototype.initialize = function(numLines) {
    var width = Graphics.boxWidth;
    //var height = this.fittingHeight(numLines || 1);
    var height = this.contentsHeight();
    Window_Base.prototype.initialize.call(this, 0, 0, width, height);
    this._text = '';
};
equipWindow_Help.prototype.contentsHeight = function() {
    //return this.height - this.standardPadding() * 2;
    return 200;
};

equipWindow_Help.prototype.setText = function(text) {
    if (this._text !== text) {
        this._text = text;
        this.refresh();
    }
};

equipWindow_Help.prototype.clear = function() {
    this.setText('');
};

equipWindow_Help.prototype.setItem = function(weapon) {
	this.contents.clear();
    this.drawText(weapon ? weapon.description : '', 0, 0);
    var wID1 = weapon ? weapon.id : 0;
    var lvl1 = weapon ? $dataWeapons[wID1].meta.level.split(/\s*,\s*/) : 0;
    var skill1 = weapon ? $dataWeapons[wID1].meta.skillID.split(/\s*,\s*/) : 0;
    //var skill2 = weapon ? $dataSkills[$dataWeapons[wID].meta.skillID.split(/\s*,\s*/)].name : 0;
    for (i = 0; i < 2; i++){
    	this.drawText(weapon ? 'LV: '+lvl1[i]+'  '+$dataSkills[skill1[i]].name: '', 0, 20*(i+1));
    }
};

equipWindow_Help.prototype.refresh = function() {
    this.contents.clear();
    this.drawTextEx(this._text, this.textPadding(), 0);
};

[RMMV] Custom Equip Menu

So I got started with the first steps on this one, which is working on displaying the levels and skills... sadly I'm not sure if I'm doing the reading correctly...
So I have these in the notes for weapons. They're formatted as level.skillID

EDIT: I reformatted them as <level:XX>, <skillID:XX>. I couldn't upload a new screenshot.
On the game, they're showing up like this:

(Sidenote, I'm also going to format them like a table of some sort)

I'm certain that a loop would be needed to display all notetags with the appropriate information... but the primary thing I'm stuck at is the actual reading of information from the notetags. Here's part of my code:

//**************************************************
// Help Window
// Handles the display for the equipment's help window
//**************************************************

Scene_MenuBase.prototype.createHelpWindow = function() {
    this._helpWindow = new equipWindow_Help();
    this.addWindow(this._helpWindow);
};

function equipWindow_Help() {
    this.initialize.apply(this, arguments);
}

equipWindow_Help.prototype = Object.create(Window_Base.prototype);
equipWindow_Help.prototype.constructor = Window_Help;

equipWindow_Help.prototype.initialize = function(numLines) {
    var width = Graphics.boxWidth;
    //var height = this.fittingHeight(numLines || 1);
    var height = this.contentsHeight();
    Window_Base.prototype.initialize.call(this, 0, 0, width, height);
    this._text = '';
};
equipWindow_Help.prototype.contentsHeight = function() {
    //return this.height - this.standardPadding() * 2;
    return 200;
};

equipWindow_Help.prototype.setText = function(text) {
    if (this._text !== text) {
        this._text = text;
        this.refresh();
    }
};

equipWindow_Help.prototype.clear = function() {
    this.setText('');
};

equipWindow_Help.prototype.setItem = function(weapon) {
    this.drawText(weapon ? weapon.description : '', 0, 0);
    var wID = weapon ? weapon.id : 0;
    var lvl = weapon ? $dataWeapons[wID].meta.level.split(/\s*,\s*/) : 0;
    var skill = weapon ? $dataWeapons[wID].meta.skillID.split(/\s*,\s*/) : 0;
    for (i = 0; i < 2; i++){
    	this.drawText(weapon ? 'LV: '+lvl[i]+'  '+$dataSkills[skill[i]].name: '', 0, 20*(i+1));
    }
};

equipWindow_Help.prototype.refresh = function() {
    this.contents.clear();
    this.drawTextEx(this._text, this.textPadding(), 0);
};


Edit:
I was able to have the skills listed on the equip menu. Now I'm going to attempt to have the character learn the actual skill upon level up.

[SCRIPTING] [RMMV] Selectable windows and databases

Ah, thanks for this. I haven't tested battling yet, so I haven't encountered such a scenario

At any case, I tried to change the code a bit from all actors to all members of the party. I simply changed $gameActors to $gameParty, and it crashed. XD

Whatchu Workin' On? Tell us!

I was working on a megaten nocturne in rpgmaker game, but I set the idea aside to work on my previous idea, which was a game that was inspired by nocturne (because, heck, I love the game so much).
At this point in time I'm trying to integrate the basic game mechanics (fusion, equipping magatama, the database, etc. It's a slow work in progress, seeing that I'm working full time and learning MV at the same time.

[RMMV] Custom Equip Menu

author=Traverse
author=shiningriver
Regarding the skills, so as long as the player is equal or more to the level required to learn that skill, he will learn it once he levels up when he has the bunshin equipped. For example, he's currently level 12, and has switched to a bunshin that has a skill you can learn at level 10. You need to level up once to learn that skill.
Yeah, like I said, it doesn't work that way with the default class system. If the actor is already at or above the level where you learn the skill when you switch classes, he won't learn it.

If you want to make it so that the skill is "learned at or above the level" you will have to modify how classes work, if you want to use classes for it. IMO it would probably be simpler just to attach the skills to the equipment (using notetags or something) and then modify the level up process to read the notetag on level-up and give the actor the corresponding skill. It's up to you, of course.

Yeah, I think it would be best to go with using notetags on equipment instead of modifying the classes. I think the complex part of this one would be actually checking the bunshin equipped, cross-checking it with the player's level, and actually including the skill after a level up (instead of upon equip). I'll try to figure this out in the weekend, when I have more time to experiment. Thanks!

author=Traverse
The rpg_xx.js files ARE JavaScript files. They're the ones that get loaded before any plugins in your game. They're the "default plugins" if that makes any sense, the other plugins are just supposed to modify or extend the code included in the rpg_xx.js files. "Scene_XX" or "Window_XX" are just names for the JavaScript objects in them.

By default, weapons/armor can be set in the database to give you skills, but it's independent of level. The actor just gets the skill upon equipping the gear and loses it on unequipping; having an equip with an "Add Skill" Trait equipped will merely change the Game_Actor's "addedSkills" property, which is just a list of Add Skill Traits. And Traits have absolutely nothing to do with level.

If you want to make it check for actor levels, you would be better off doing something with notetags and modifying the level-up (try looking at the function "Game_Actor.prototype.levelUp") to check for equipped weapon and read its notetags rather than messing around with Traits.

Or you could make a common event that runs after every battle and checks the actor level and what the equipped weapon is and then adds the appropriate skills. It would need to be running nearly all of the time depending on how random your battles are, but that could be done without coding.

And I suppose if all you're doing is checking for the actor's learned skills in order to determine the weapon's "level", you could feasibly code the menu separately from the actual skill learning system/modifications.


I was meant to say events, not scenes, sorry about that (i get them confused sometimes). I think I'll go with coding it instead of making a common event. For the equipment, there won't be 'levels' per se, but states (not mastered or mastered), so unless the player has learned all of its skills, it would stay not mastered.
I'll try to experiment this over the weekend when I have more time. Thanks so much for the help!

[RMMV] Custom Equip Menu

Ah, it doesn't affect the actual growth, but just adds something to the current player (so on the picture, the bunshin will add +10 strength to the current stat, not +10 at every level. This is a temporary bonus, which changes based on bunshin equipped).

Regarding the skills, so as long as the player is equal or more to the level required to learn that skill, he will learn it once he levels up when he has the bunshin equipped. For example, he's currently level 12, and has switched to a bunshin that has a skill you can learn at level 10. You need to level up once to learn that skill.
The main actor cannot be switched out, so he's always in the party. The rest of the party members, on the other hand, don't need to equip bunshins and can be swapped, dismissed, or whichever. :D
I'm not sure if I have to make the equipment level up. The bunshin will 'max out' once all skills have been learned... so I think it only needs to have a function that checks whether all skills have been learned by the player.

I think it might be simpler to modify the markup that I have (so I don't have to do that much calculations on the placement and all). I've experimented on the main menu and status menu screens, so I just have to modify the equipment screen at the moment.

Also, I'm thinking that it would be much simpler to do this as classes rather than equipment (so add them on the database as actors, but code them as if they're equipment), which I think has been done before...?

Edit:
I think I'll stick with the default layout of the equip menu, with minor adjustments maybe, so it would be simpler to code. Now the only thing I'm curious about is if it's possible to go with the skill learning thing I mentioned about using weapons? If so, how would I go about that (JavaScript or scenes?)

[RMMV] Custom Equip Menu

Good morning,

I'd like to have some help with this one. I'm trying to replace the equip menu screen with something else (see screenshot below. Don't mind the background, it's something I already worked out beforehand :D). The twist is that only the hero can access this screen (and that this doesn't prompt one to select a party member, just go directly to the screen).
Each equipment would have its own parameters (changing the player's resistance on skills, among others), and provides them skills as they level up. Once all skills for that equipment has been learnt, the equipment would change color.
So my questions are:
1) Would the skill learning as they level up work on equipment, or should I classify them as a class?
2) How do I go about customizing the equipment screen to look and function like the screen below...?

Bunshin screen. Bascially, the bunshins are blank. The player has to collect them as they go around the game world.


Bunsin screen complete. Basically, the ones in full blue are all completely learned. Green is equipped. The purple is the cursor selection. The one in the middle is a secret one that appears only after finishing a quest where all of the rest has been collected.


Let me know if this is doable or too complex to work out. I'm open to a different implementation. Thank you so much!