How to render event image to the map after scene pop?

Hi. I'm really new to making plugins. I'm trying to make one wherein you interact with the event, the inventory scene pops up, and when you select an item from the inventory, the event's image is changed to the selected item's image. However, I'm stuck. I was able to store the selected item data but I have no idea how to render the image to the event on the map after selecting the item.

It would be great if someone could point out how to update the event and its sprite image after the inventory scene is popped.
it would be better if you place the plugin you make so its easier to point how, as well fix where is needed
so you have a better working plugin.
Thanks for the reply. Here's the code so far:

Spoiler: PluginCommand
const _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);​

const com = command.trim().toLowerCase();
const checkDur = function(i) {
return (args) ? eval(args) : 0;​
};​

if(com === "itemplacer") {
SceneManager.push(Scene_Inventory)​
}​
};

Spoiler: ItemIcons
Sprite_ItemIcons.prototype = Object.create(Sprite.prototype);
Sprite_ItemIcons.prototype.constructor = Sprite_ItemIcons;
Sprite_ItemIcons.prototype.initialize = function(item, eventId){
Sprite.prototype.initialize.call(this);​

this._item = item;
this._event = $gameMap.event(eventId)​

this.createIcon();
this.refreshIcon();​
}

Sprite_ItemIcons.prototype.createIcon = function(item) {
this._iconBitmap = ImageManager.loadSystem('IconSet');
this._icon = new Sprite(this._iconBitmap);​

this._item = item
// sample location; assumes that event is in (4,10)
this.x = 4 * 32;
this.y = 10 * 32
this.addChild(this._icon)​
}

Sprite_ItemIcons.prototype.refreshIcon = function() {
var w = Window_Base._iconWidth;
var h = Window_Base._iconHeight;
var iconindex = this._item.iconIndex;
var sx = iconindex % 16 * w;
var sy = Math.floor(iconindex / 16) * h;
this._icon.setFrame(sx,sy,w,h);​
}

Spoiler: Scene_Inventory
Scene_Inventory.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Inventory.prototype.constructor = Scene_ItemPlacer;

Scene_Inventory.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this, 0, 0, 500, 300);​
}

Scene_Inventory.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createHelpWindow(); // omitted
this.createCategoryWindow(); // omitted
this.createItemWindow();​
};

Scene_Inventory.prototype.createItemWindow = function() {
var wy = this._categoryWindow.y + this._categoryWindow.height;
var wx = Graphics.boxWidth / 2;
var wh = Graphics.boxHeight - wy;
var ww = Graphics.boxWidth / 2;

this._itemWindow = new Window_ItemList(wx, wy, ww, wh);
this._itemWindow.maxCols = function(){ return 1 };

this._itemWindow.setHelpWindow(this._helpWindow);
this._itemWindow.setHandler('ok', this.onItemOk.bind(this));
this._itemWindow.setHandler('cancel', this.popScene.bind(this));
this.addWindow(this._itemWindow);

this._categoryWindow.setItemWindow(this._itemWindow);​
};

Scene_Inventory.prototype.onItemOk = function() {
this._item = this.item();
var itemIcon = new Sprite_ItemIcons(this._item, 6 ) // eventId is just an example

// How to load image to event on the map after popping the inventory scene?

this.popScene();​
};

========== Edit==========
Hold that thought. I may have figured it out. 😛
========== Edit==========
Never mind I was wrong...
So I finally figured it out. I'm not sure if it's the most efficient way to code it but what I did is I used Scene_Base.updateChildren and created the icon when the current scene is Map_Scene. I've also added a flag to indicate whether the item is being placed or not.

It needs a little bit more tweaking but it will have to do for now.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-render-event-image-to-the-map-after-scene-pop.111886/