ページ 1 / 1
【解決済み】戦闘中にアイテムのヘルプにピクチャーを表示する方法
Posted: 2025年4月26日(土) 05:41
by nekojita
いつもお世話になっております。
戦闘中に表示されるアイテムのヘルプに、ピクチャーを表示する方法を探しています。
具体的には下記リンクにある、にゃたま様が制作した「NYA_SceneItemAddInfo」を、
戦闘中のアイテム画面で再現したいです。
アイテムのヘルプでピクチャーを表示 - NYA_SceneItemAddInfo.js
(https://plugin.fungamemake.com/archives/20000)
3枚目は編集した画像なのでチグハグで恐縮ですが、以下に参考画像を挙げておきます。
リクエストは今回が初めてで、上手く伝えられている自信がありません...。
投稿内容に失礼・不足がありましたら申し訳ありません。
情報だけでもとても助かります。どうか、よろしくお願いします。
Re: 戦闘中にアイテムのヘルプにピクチャーを表示する方法
Posted: 2025年4月27日(日) 06:20
by ecf5DTTzl6h6lJj02
こんにちは。
nekojita さんが書きました:いつもお世話になっております。
戦闘中に表示されるアイテムのヘルプに、ピクチャーを表示する方法を探しています。
具体的には下記リンクにある、にゃたま様が制作した「NYA_SceneItemAddInfo」を、
戦闘中のアイテム画面で再現したいです。
アイテムのヘルプでピクチャーを表示 - NYA_SceneItemAddInfo.js
(https://plugin.fungamemake.com/archives/20000)
3枚目は編集した画像なのでチグハグで恐縮ですが、以下に参考画像を挙げておきます。
リクエストは今回が初めてで、上手く伝えられている自信がありません...。
投稿内容に失礼・不足がありましたら申し訳ありません。
情報だけでもとても助かります。どうか、よろしくお願いします。
このプラグインは改変したものも含め、再配布は禁止されているので、
こちらで、改変したものを提供する形はとれず、
プラグインの編集はご自身でしていただくことになります。
プラグインのバックアップを取ってから、
JavaScript を編集可能なソフト(できれば VS Code などのプログラムの編集に特化したもの)で開き、
以下の編集を行ってください。
- 181 行目あたり(ファイルの最後にある })(); という部分の前の行)に、
以下のコードを挿入する。
コード: 全て選択
//----------------------------- Scene_Battle ----------------------------------------
var _Scene_Battle_createAllWindows = Scene_Battle.prototype.createAllWindows;
Scene_Battle.prototype.createAllWindows = function() {
_Scene_Battle_createAllWindows.apply(this, arguments);
if (this._helpWindow) {
this._helpWindow.hide();
}
this.createInfoWindow();
this.createActorWindow();
};
Scene_Battle.prototype.createItemWindow = function() {
this._itemWindow = new Window_BattleItem(WItem_X, WItem_Y, WItem_Width, WItem_Height);
this._itemWindow.setHelpWindow(this._helpWindow);
this._itemWindow.setHandler('ok', this.onItemOk.bind(this));
this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this));
this.addWindow(this._itemWindow);
};
Scene_Battle.prototype.createInfoWindow = function() {
this._infoWindow = new Window_Info();
this._infoWindow.visible = false;
this.addWindow(this._infoWindow);
};
var _Scene_Battle_commandItem = Scene_Battle.prototype.commandItem;
Scene_Battle.prototype.commandItem = function() {
_Scene_Battle_commandItem.apply(this, arguments);
this._infoWindow.refresh();
this._infoWindow.show();
};
var _Scene_Battle_onItemCancel = Scene_Battle.prototype.onItemCancel;
Scene_Battle.prototype.onItemCancel = function() {
_Scene_Battle_onItemCancel.apply(this, arguments);
this._infoWindow.setInfo(null, null);
this._infoWindow.refresh();
this._infoWindow.hide();
};
var _Scene_Battle_onSelectAction = Scene_Battle.prototype.onSelectAction;
Scene_Battle.prototype.onSelectAction = function() {
_Scene_Battle_onSelectAction.apply(this, arguments);
this._infoWindow.hide();
};
var _Scene_Battle_onActorCancel = Scene_Battle.prototype.onActorCancel;
Scene_Battle.prototype.onActorCancel = function() {
_Scene_Battle_onActorCancel.apply(this, arguments);
if (this._actorCommandWindow.currentSymbol() === 'item') {
this._infoWindow.refresh();
this._infoWindow.show();
}
};
var _Scene_Battle_update = Scene_Battle.prototype.update;
Scene_Battle.prototype.update = function() {
_Scene_Battle_update.apply(this, arguments);
if (this._itemWindow.active) {
this._infoWindow.setInfo(this._itemWindow.item().meta[tagHelp], this._itemWindow.item().meta[tagImg]);
}
};
//-----------------------------------------------------------------------------------
恐らく、これで戦闘中にもアイテムのヘルプにピクチャを表示できるようになると思います。
きちんとテストしていないので、不具合が出る可能性があります。
その時はご連絡ください。
ご確認ください。
Re: 戦闘中にアイテムのヘルプにピクチャーを表示する方法
Posted: 2025年4月27日(日) 20:43
by nekojita
返信が遅れてすみません。
コードまで書いて下さり、本当にありがとうございます。
早速確認させて頂きました。
プラグイン自体は問題なく動作したのですが、
座標を通常アイテム画面(先に挙げた1枚目の画像)と共有してしまい、
画像①のような表示になってしまいました。
アイテム一覧ウィンドウがステータスに被ってしまっている点は、
追加分の13行目「Window_BattleItem」を弄って通常時と分けて調整できたのですが、
ヘルプウィンドのY座標を通常時と戦闘時に分けることは可能でしょうか。
通常時は「WinfoItem_Y = WcItem_Height」で(初期設定:カテゴリ分、下がった位置)、
戦闘時は「WinfoItem_Y = 0」という風に分けられれば良いのですが...。
わざわざ時間を割いてコードまで書いてくださったのに、
追加の要望まで出してしまい申し訳ありません。
こちらに関しては、カテゴリを無しにして、どちらもY座標0にする。
というパターンも視野に入れているので、
対応は、もし可能であれば、で大丈夫です。
お陰様で理想の形にぐっと近付けることができました。
重ねて、本当にありがとうございました。
Re: 戦闘中にアイテムのヘルプにピクチャーを表示する方法
Posted: 2025年4月27日(日) 22:16
by ecf5DTTzl6h6lJj02
こんにちは。
nekojita さんが書きました:返信が遅れてすみません。
コードまで書いて下さり、本当にありがとうございます。
早速確認させて頂きました。
プラグイン自体は問題なく動作したのですが、
座標を通常アイテム画面(先に挙げた1枚目の画像)と共有してしまい、
画像①のような表示になってしまいました。
アイテム一覧ウィンドウがステータスに被ってしまっている点は、
追加分の13行目「Window_BattleItem」を弄って通常時と分けて調整できたのですが、
ヘルプウィンドのY座標を通常時と戦闘時に分けることは可能でしょうか。
通常時は「WinfoItem_Y = WcItem_Height」で(初期設定:カテゴリ分、下がった位置)、
戦闘時は「WinfoItem_Y = 0」という風に分けられれば良いのですが...。
わざわざ時間を割いてコードまで書いてくださったのに、
追加の要望まで出してしまい申し訳ありません。
こちらに関しては、カテゴリを無しにして、どちらもY座標0にする。
というパターンも視野に入れているので、
対応は、もし可能であれば、で大丈夫です。
お陰様で理想の形にぐっと近付けることができました。
重ねて、本当にありがとうございました。
ステータスウィンドウの分、アイテムウィンドウを縮めること、
カテゴリウィンドウを使用する場合のこと、
を考慮し忘れていました。
失礼いたしました。
ご自身で変更した部分は元に戻していただいて、
前回提示したコード部分を、以下に書き換えてください。
コード: 全て選択
//----------------------------- Scene_Battle ----------------------------------------
var _Scene_Battle_createAllWindows = Scene_Battle.prototype.createAllWindows;
Scene_Battle.prototype.createAllWindows = function() {
_Scene_Battle_createAllWindows.apply(this, arguments);
if (this._helpWindow) {
this._helpWindow.hide();
}
this.createInfoWindow();
this.createActorWindow();
};
Scene_Battle.prototype.createItemWindow = function() {
var x = WItem_X;
var y = WinfoItem_Height;
var width = WItem_Width;
var height = (WinfoItem_Y === WcItem_Height ? (WItem_Height + WcItem_Height) : WItem_Height) - this._statusWindow.height ;
this._itemWindow = new Window_BattleItem(x, y, width, height);
this._itemWindow.setHelpWindow(this._helpWindow);
this._itemWindow.setHandler('ok', this.onItemOk.bind(this));
this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this));
this.addWindow(this._itemWindow);
};
Scene_Battle.prototype.createInfoWindow = function() {
this._infoWindow = new Window_Info();
this._infoWindow.y = 0;
this._infoWindow.visible = false;
this.addWindow(this._infoWindow);
};
var _Scene_Battle_commandItem = Scene_Battle.prototype.commandItem;
Scene_Battle.prototype.commandItem = function() {
_Scene_Battle_commandItem.apply(this, arguments);
this._infoWindow.refresh();
this._infoWindow.show();
};
var _Scene_Battle_onItemCancel = Scene_Battle.prototype.onItemCancel;
Scene_Battle.prototype.onItemCancel = function() {
_Scene_Battle_onItemCancel.apply(this, arguments);
this._infoWindow.setInfo(null, null);
this._infoWindow.refresh();
this._infoWindow.hide();
};
var _Scene_Battle_onSelectAction = Scene_Battle.prototype.onSelectAction;
Scene_Battle.prototype.onSelectAction = function() {
_Scene_Battle_onSelectAction.apply(this, arguments);
this._infoWindow.hide();
};
var _Scene_Battle_onActorCancel = Scene_Battle.prototype.onActorCancel;
Scene_Battle.prototype.onActorCancel = function() {
_Scene_Battle_onActorCancel.apply(this, arguments);
if (this._actorCommandWindow.currentSymbol() === 'item') {
this._infoWindow.refresh();
this._infoWindow.show();
}
};
var _Scene_Battle_update = Scene_Battle.prototype.update;
Scene_Battle.prototype.update = function() {
_Scene_Battle_update.apply(this, arguments);
if (this._itemWindow.active && this._itemWindow.item()) {
this._infoWindow.setInfo(this._itemWindow.item().meta[tagHelp], this._itemWindow.item().meta[tagImg]);
}
};
//-----------------------------------------------------------------------------------
恐らく、これでご希望の挙動になるかと思います。
ご確認お願いします。
Re: 戦闘中にアイテムのヘルプにピクチャーを表示する方法
Posted: 2025年4月27日(日) 23:19
by nekojita
まさかこんなに早く対応して下さるとは思っておらず、急がせてしまったようで申し訳ありません。
確認したところ、カテゴリがある通常時、ステータスがある戦闘時共に、希望通りの挙動になりました!
拙いリクエストにここまで丁寧に、完璧な形で応えて下さり、ありがとうございます。
お陰様で理想の形を実現することができました。
このリクエストは解決済みとさせて頂きます。本当にありがとうございました。