本帖最后由 芯☆淡茹水 于 2017-11-20 20:34 编辑
下面估摸着写的,需要测试下。
显示以变量值为物品ID的图标,就在对话框写:\IV[变量ID]
Window_Base.prototype.obtainItemParam = function(textState) { var data = textState.text.slice(textState.index).match(/^\[(\d+)]/); if (!data || !$gameVariables.value(+RegExp.$1) || !$dataItems[$gameVariables.value(+RegExp.$1)]) return ''; textState.index += data[0].length; return $dataItems[$gameVariables.value(+RegExp.$1)].iconIndex; }; var XrDate_WBprocessEscapeCharacter = Window_Base.prototype.processEscapeCharacter; Window_Base.prototype.processEscapeCharacter = function(code, textState) { XrDate_WBprocessEscapeCharacter.call(this,code,textState); if (code === 'IV') this.processDrawIcon(this.obtainItemParam(textState), textState); };
Window_Base.prototype.obtainItemParam = function(textState) {
var data = textState.text.slice(textState.index).match(/^\[(\d+)]/);
if (!data || !$gameVariables.value(+RegExp.$1) || !$dataItems[$gameVariables.value(+RegExp.$1)]) return '';
textState.index += data[0].length;
return $dataItems[$gameVariables.value(+RegExp.$1)].iconIndex;
};
var XrDate_WBprocessEscapeCharacter = Window_Base.prototype.processEscapeCharacter;
Window_Base.prototype.processEscapeCharacter = function(code, textState) {
XrDate_WBprocessEscapeCharacter.call(this,code,textState);
if (code === 'IV') this.processDrawIcon(this.obtainItemParam(textState), textState);
};
|