Hey everyone, I've been using MV for a while now and decided to add a new window in the equip menu with preview pictures for the weapons you find. I found some code made by user caethyrll but it only appears for the item menu, while i want it to appear on the equip menu:
Here's said code:
/*:
* @plugindesc Shows item pictures when browsing your inventory!
* @Author
* @plugindesc Put a <name:text> icon on items to assign them a picture.
* Replace "text" with the picture's name, e.g. "item1" for "item1.png".
* All pictures are loaded from img/pictures.
*
* @noteParam name
* @noteRequire 1
* @noteDir img/pictures/
* @noteType file
* @noteData items
*/
// ^ See Help > Documentation > [Exclude unused files] Plugin Configuration //
(function() {
'use strict';
// ===== (NEW) Window_ItemPictures ===== //
/** @constructor */
window.Window_ItemPictures = function() { this.initialize.apply(this, arguments); };
Window_ItemPictures.prototype = Object.create(Window_Base.prototype);
Window_ItemPictures.prototype.constructor = Window_ItemPictures;
// Called on construction
Window_ItemPictures.prototype.initialize = function(x, y) {
var w = 100, h = 100;
Window_Base.prototype.initialize.call(this, x, y, w, h);
this._image = new Sprite();
this.addChild(this._image);
};
// Update image bitmap appropriately
Window_ItemPictures.prototype.refresh = function() {
let bmp = new Bitmap();
if (this._imageName) bmp = ImageManager.loadPicture(this._imageName);
this._image.bitmap = bmp;
};
// Returns the value of the specified item's "name" notetag
Window_ItemPictures.prototype.readTag = function(item) {
if (item) {
let tag = item.meta.name;
if (tag && tag !== true) return tag.trim();
}
return '';
};
// Update image name
Window_ItemPictures.prototype.setItem = function(item) {
this._imageName = this.readTag(item);
this.refresh();
};
// ===== (ADD) Extensions for existing scenes and windows ===== //
// Add new window to item scene (inventory)
(function(alias) {
Scene_Item.prototype.create = function() {
alias.call(this);
this._itemPicsWindow = new Window_ItemPictures();
this.addWindow(this._itemPicsWindow);
this._itemWindow._itemPicsWindow = this._itemPicsWindow;
};
})(Scene_Item.prototype.create);
// Refresh item picture window when selected item changes
(function(alias) {
Window_ItemList.prototype.select = function(index) {
alias.apply(this, arguments);
this.refreshWindowItemPics(this.item());
};
})(Window_ItemList.prototype.select);
// New method: update the associated item picture window
Window_ItemList.prototype.refreshWindowItemPics = function(item) {
if (this._itemPicsWindow) this._itemPicsWindow.setItem(item);
};
})();
I was wondering if i can just change some values to make it work, i tried changing all the instances of the word "item" to "weapon" but no luck. Any help would he very appreciated, thank you.
Here's said code:
/*:
* @plugindesc Shows item pictures when browsing your inventory!
* @Author
* @plugindesc Put a <name:text> icon on items to assign them a picture.
* Replace "text" with the picture's name, e.g. "item1" for "item1.png".
* All pictures are loaded from img/pictures.
*
* @noteParam name
* @noteRequire 1
* @noteDir img/pictures/
* @noteType file
* @noteData items
*/
// ^ See Help > Documentation > [Exclude unused files] Plugin Configuration //
(function() {
'use strict';
// ===== (NEW) Window_ItemPictures ===== //
/** @constructor */
window.Window_ItemPictures = function() { this.initialize.apply(this, arguments); };
Window_ItemPictures.prototype = Object.create(Window_Base.prototype);
Window_ItemPictures.prototype.constructor = Window_ItemPictures;
// Called on construction
Window_ItemPictures.prototype.initialize = function(x, y) {
var w = 100, h = 100;
Window_Base.prototype.initialize.call(this, x, y, w, h);
this._image = new Sprite();
this.addChild(this._image);
};
// Update image bitmap appropriately
Window_ItemPictures.prototype.refresh = function() {
let bmp = new Bitmap();
if (this._imageName) bmp = ImageManager.loadPicture(this._imageName);
this._image.bitmap = bmp;
};
// Returns the value of the specified item's "name" notetag
Window_ItemPictures.prototype.readTag = function(item) {
if (item) {
let tag = item.meta.name;
if (tag && tag !== true) return tag.trim();
}
return '';
};
// Update image name
Window_ItemPictures.prototype.setItem = function(item) {
this._imageName = this.readTag(item);
this.refresh();
};
// ===== (ADD) Extensions for existing scenes and windows ===== //
// Add new window to item scene (inventory)
(function(alias) {
Scene_Item.prototype.create = function() {
alias.call(this);
this._itemPicsWindow = new Window_ItemPictures();
this.addWindow(this._itemPicsWindow);
this._itemWindow._itemPicsWindow = this._itemPicsWindow;
};
})(Scene_Item.prototype.create);
// Refresh item picture window when selected item changes
(function(alias) {
Window_ItemList.prototype.select = function(index) {
alias.apply(this, arguments);
this.refreshWindowItemPics(this.item());
};
})(Window_ItemList.prototype.select);
// New method: update the associated item picture window
Window_ItemList.prototype.refreshWindowItemPics = function(item) {
if (this._itemPicsWindow) this._itemPicsWindow.setItem(item);
};
})();
I was wondering if i can just change some values to make it work, i tried changing all the instances of the word "item" to "weapon" but no luck. Any help would he very appreciated, thank you.