This here is the plugin I'm working on, I'm trying to make a plugin that will activate a common event along with a Variable Id and a variable value when the mouse is touching/over a picture. When I run the plugin I don't get any errors but for some reason it's still not working so I'm asking for any help. Also I will make this plugin free for anyone to use once it gets working properly. This is for RPG Maker MZ by the way.
(() => {
const pluginName = "HoverPicture";
PluginManager.registerCommand(pluginName, "set", args => {
const pictureId = Number(args.pictureId);
const commonEventId = Number(args.commonEventId);
const variableId = Number(args.VariableId);
const variableValue = args.VariableValue;
const picture = $gameScreen.picture(pictureId);
if (picture) {
picture.mzkp_commonEventId = commonEventId;
picture.mzkp_variableId = variableId;
picture.mzkp_variableValue = variableValue;}
});
Sprite_Picture.prototype.isHoveredEnabled = function() {
const picture = this.picture();
return picture && picture.mzkp_commonEventId && picture.mzkp_variableId && picture.mzkp_variableValue && !$gameMessage.isBusy();
};
Sprite_Picture.prototype.onHover = function() {
const picture = this.picture();
if (picture && picture.mzkp_commonEventId && picture.mzkp_variableId && picture.mzkp_variableValue) {
$gameTemp.reserveCommonEvent(picture.mzkp_commonEventId);
$gameVariables.setValue(picture.mzkp_variableId, picture.mzkp_variableValue);
}
};
Spriteset_Base.prototype.mzkp_isAnyPictureHovered = function() {
return this._pictureContainer.children.some(sprite =>
sprite.isHovered()
);
};
const _Scene_Map_isAnyButtonHovered =
Scene_Map.prototype._Scene_Map_isAnyButtonHovered;
Scene_Map.prototype._Scene_Map_isAnyButtonHovered = function() {
return (
_Scene_Map_isAnyButtonHovered.apply(this, arguments) ||
this._spriteset.mzkp_isAnyPictureHovered()
);
};
})();
Thanks in advance for any help and for your time.