YEP_X_ExtMesPack1 Choice Window Position

I use the \msgevent[x] and \msgactor[x] text codes to display the message window above the actor/event who is currently talking. Does the choice window not adjust its position when I use the Message Positon Text Codes?


Maybe it's just some compatability issue but I am quite sure I tested it. Or I am missing something. 


thanks!
I use this in my game.. but I put /autoevent[0] 0 means the player.. you just change it to the event number you wish the message to display above the event I'm pretty sure it also done the choice window  .. hope this answerd your question 🙂
I don't use \autoevent[x] becuase I have Word Wrapping enabled.


And no it seems, the \autoevent[x] does not adjust the position of the Choice Window.
Oh I see , sorry I couldn't help chap  >_>  hope you manage to find a way to do it   🤘
@2FaSt No problem, thanks for trying though 🙂
I just edited the updatePlacement method of the choicelist window, now it adjusts its position based on the message window position.


This can be closed.
I'm so sorry for pushing up this old thread, but I have the same problem and can't find a solution...

I also use \msgevent[0] (message box above the hero).
And want to have the choice box just below it.

How exactly did you edited the script?

I think it must be somewhere here:

Spoiler
//=============================================================================
// Window_ChoiceList
//=============================================================================

Yanfly.EMP1.Window_ChoiceList_numVisibleRows =
Window_ChoiceList.prototype.numVisibleRows;
Window_ChoiceList.prototype.numVisibleRows = function() {
var messageY = this._messageWindow.y;
var messageHeight = this._messageWindow.height;
var centerY = Graphics.boxHeight / 2;
// var choices = $gameMessage.choices();
// var numLines = choices.length;
this.makeCommandList();
var numLines = this._maxChoices;
var maxLines = $gameSystem.getMessageChoiceRows();
if (messageY < centerY && messageY + messageHeight > centerY) {
maxLines = 4;
}
if (numLines > maxLines) {
numLines = maxLines;
}
return Math.max(1, numLines);
};

Window_ChoiceList.prototype.makeCommandList = function() {
this._maxChoices = 0;
this._cancelAllowed = true;
var choices = $gameMessage.choices();
for (var i = 0; i < choices.length; i++) {
if (!$gameSystem.isChoiceShown(i)) {
if ($gameMessage.choiceCancelType() === i) this._cancelAllowed = false;
continue;
}
this._maxChoices += 1;
var enabled = $gameSystem.isChoiceEnabled(i);
this.addCommand(choices, 'choice', enabled, i);
if (!enabled) {
if ($gameMessage.choiceCancelType() === i) this._cancelAllowed = false;
}
}
};

Yanfly.EMP1.Window_ChoiceList_drawItem = Window_ChoiceList.prototype.drawItem;
Window_ChoiceList.prototype.drawItem = function(index) {
var enabled = this.isCommandEnabled(index);
this.changePaintOpacity(enabled);
Yanfly.EMP1.Window_ChoiceList_drawItem.call(this, index);
};

Window_ChoiceList.prototype.callOkHandler = function() {
$gameMessage.onChoice(this.currentExt());
this._messageWindow.terminateMessage();
this.close();
};

Yanfly.EMP1.Window_ChoiceList_isCancelEnabled =
Window_ChoiceList.prototype.isCancelEnabled;
Window_ChoiceList.prototype.isCancelEnabled = function() {
if (!this._cancelAllowed) return false;
return Yanfly.EMP1.Window_ChoiceList_isCancelEnabled.call(this);
};

or here:

Spoiler
//-----------------------------------------------------------------------------
// Window_ChoiceList
//
// The window used for the event command [Show Choices].

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

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

Window_ChoiceList.prototype.initialize = function(messageWindow) {
this._messageWindow = messageWindow;
Window_Command.prototype.initialize.call(this, 0, 0);
this.openness = 0;
this.deactivate();
this._background = 0;
};

Window_ChoiceList.prototype.start = function() {
this.updatePlacement();
this.updateBackground();
this.refresh();
this.selectDefault();
this.open();
this.activate();
};

Window_ChoiceList.prototype.selectDefault = function() {
this.select($gameMessage.choiceDefaultType());
};

Window_ChoiceList.prototype.updatePlacement = function() {
var positionType = $gameMessage.choicePositionType();
var messageY = this._messageWindow.y;
this.width = this.windowWidth();
this.height = this.windowHeight();
switch (positionType) {
case 0:
this.x = 0;
break;
case 1:
this.x = (Graphics.boxWidth - this.width) / 2;
break;
case 2:
this.x = Graphics.boxWidth - this.width;
break;
}
if (messageY >= Graphics.boxHeight / 2) {
this.y = messageY - this.height;
} else {
this.y = messageY + this._messageWindow.height;
}
};

Window_ChoiceList.prototype.updateBackground = function() {
this._background = $gameMessage.choiceBackground();
this.setBackgroundType(this._background);
};

Window_ChoiceList.prototype.windowWidth = function() {
var width = this.maxChoiceWidth() + this.padding * 2;
return Math.min(width, Graphics.boxWidth);
};

Window_ChoiceList.prototype.numVisibleRows = function() {
var messageY = this._messageWindow.y;
var messageHeight = this._messageWindow.height;
var centerY = Graphics.boxHeight / 2;
var choices = $gameMessage.choices();
var numLines = choices.length;
var maxLines = 8;
if (messageY < centerY && messageY + messageHeight > centerY) {
maxLines = 4;
}
if (numLines > maxLines) {
numLines = maxLines;
}
return numLines;
};

Window_ChoiceList.prototype.maxChoiceWidth = function() {
var maxWidth = 96;
var choices = $gameMessage.choices();
for (var i = 0; i < choices.length; i++) {
var choiceWidth = this.textWidthEx(choices) + this.textPadding() * 2;
if (maxWidth < choiceWidth) {
maxWidth = choiceWidth;
}
}
return maxWidth;
};

Window_ChoiceList.prototype.textWidthEx = function(text) {
return this.drawTextEx(text, 0, this.contents.height);
};

Window_ChoiceList.prototype.contentsHeight = function() {
return this.maxItems() * this.itemHeight();
};

Window_ChoiceList.prototype.makeCommandList = function() {
var choices = $gameMessage.choices();
for (var i = 0; i < choices.length; i++) {
this.addCommand(choices, 'choice');
}
};

Window_ChoiceList.prototype.drawItem = function(index) {
var rect = this.itemRectForText(index);
this.drawTextEx(this.commandName(index), rect.x, rect.y);
};

Window_ChoiceList.prototype.isCancelEnabled = function() {
return $gameMessage.choiceCancelType() !== -1;
};

Window_ChoiceList.prototype.isOkTriggered = function() {
return Input.isTriggered('ok');
};

Window_ChoiceList.prototype.callOkHandler = function() {
$gameMessage.onChoice(this.index());
this._messageWindow.terminateMessage();
this.close();
};

Window_ChoiceList.prototype.callCancelHandler = function() {
$gameMessage.onChoice($gameMessage.choiceCancelType());
this._messageWindow.terminateMessage();
this.close();
};


Can someone help me please? My scripting skills are not that great... 🙁
I just edited the updatePlacement method of the choicelist window, now it adjusts its position based on the message window position.


This can be closed.

Can you please explain how you did this?
@drumblepie
I don't have that plugin anymore and its been a while so I don't know how exactly I did this off the top of my head.
Try saving this as a .js file and importing it like a plugin~
Spoiler
Code:
/*:
 * @plugindesc Aligns the choice window to the message window.
 * @help Load this plugin after Yanfly's Message plugins (Core and Ext Pack 1).
 */

(function() {

'use strict';

	let _Window_ChoiceList_updatePlacement = Window_ChoiceList.prototype.updatePlacement;
	Window_ChoiceList.prototype.updatePlacement = function() {
		_Window_ChoiceList_updatePlacement.call(this);
		let wMsg = this._messageWindow;
		switch ($gameMessage.choicePositionType()) {
			case 0:
				this.x = wMsg.x;
				break;
			case 1:
				this.x = wMsg.x + (wMsg.width - this.width) / 2;
				break;
			case 2:
				this.x = wMsg.x + wMsg.width - this.width;
				break;
		}
	};

})();

Original thread: https://forums.rpgmakerweb.com/threads/yep_x_extmespack1-choice-window-position.71912/