RMMZ Get Picture Id when clicking / Add variables as Picture ID on Picture Common Events


May 4, 2021
Reaction score
First Language
Primarily Uses
I have two issues related to a function I am making for my project, so I decided to put them together to not make two topics.

I am trying to make a movie gallery, and well, it is done, even the unlocking work perfectly thanks to Global variables, and making only those unlcoked show is easy with events, so no problem there. The issue is how dirty it is done. It can't be further from how I want it to be, in optimization I mean, so I am trying to optimize it.

I am using Picture Common Events from Visustella to make that when clicking the images (thought to be an image taken from the start of the movie displayes static until clicking it), a movie is played though a common event.

The issue is that it can only be hardcoded. If I have X number of movies (right now using dummies to test not the ones that will go in game because i haven't made them yet) I need to set up the X Picture IDs that trigger X different common events each playing the corresponding movie to the image clicked.

While this work, and I can even set up additional one to avoid having to modify it at each change since the extra ones would be hidden due to the global variable not letting them appear, it is too wasteful.

If I could just tell the movie call script on the common event which Picture ID has been clicked I could put all on the same common event, which already optimizes it quite a bit.

if (X == $gameMap.mapId()) { Video.play("movies/" + "Mov_1" + ".webm"); }

This is the common event right now. X is the place for the ID of my Movie Gallery Map (yes, it is a map, an empty one with transparent character, and it is accessed only from title menu) since I don't want this common event to start triggering by mistake anywere else for any reason.

The solution is quite simple, but I don't know how to get the PictureID on the Variable, or just put the PictureID directly.

if (X == $gameMap.mapId()) {

Video.play("movies/" + "Mov_" + "$gameVariables.value(X)" + ".webm");


X should be the variable number. This works code-wise if I test it by modyfyng the variable by hand, the issue is assigning the PictureID to the variable so it works perfectly for all PictureIDs that call this Common Event.

This is the first issue.

Now the second one.

When assigning PictureIDs to Common Events, I need to assign those PictureIDs by hand. I have a loop that checks the unlocking global variables and adds images to the screen based on that, so it will work adding the same value as Picture ID for the Common Event inside the loop instead of setting it by hands based on how many I know I have, which also adds some that are useless if not unlocked.

The issue is that I have no idea of how to add a variable to the plugin parameters in this case. I have tried to call by script, but I should be doing something wrong, and the code is obfuscated, so no way to try to check it to understand it more.

I used everything I can think of like the three following examples.
PluginManager.callCommand(this, "VisuMZ_4_PictureCmnEvts", "System: Change Picture Common Event", { PictureIDs: [1], CommonEventId: 2, Custom: "", UseGlobal: true, OpaqueOnly: true, OpaqueErrorMargin: 3, ChangeTone: true, HoverTone: [128, 128, 128, 0], BlendMode: 0 }); PluginManager.callCommand(this, "VisuMZ_4_PictureCmnEvts", "System: Change Picture Common Event", { [argumentshere] });

PluginManager.callCommand = function(self, pluginName, commandName, args) { const key = "VisuMZ_4_PictureCmnEvts" + ":" + "System: Change Picture Common Event"; const func = this._commands[key]; if (typeof func === "function") { func.bind(this)([[1], 2, '', true, true, 3, true, [128, 128, 128, 0], 0]); } };

var myInterpreter = new Game_Interpreter() myInterpreter.pluginCommand("VisuMZ_4_PictureCmnEvts:System: Change Picture Common Event", [[1], 2, '', true, true, 3, true, [128, 128, 128, 0], 0]);

Of course neither of them wroked, although identical values work if used with the Plugin Command, but impossible to use variables there.. I have been trying only with static values to keep it simple until it worked, and then I will already change arguments for variables, but I can't manage to make it work with this method.

At worse, I will just keep it dirty unoptimized if there is no way to optimize it with variables.

Latest Threads

Latest Posts

Latest Profile Posts

Working on a slightly experimental horror game. It will be finished in approximately 88888888888 years.
Y'all will enjoy it though, I put lots of effort into making it stand out.

It's called Red Light and it's inspired by another obscure RPG Maker horror game, but I don't want to give too much away just yet.
Ohh man, Weapon animations plugin feels so mandatory. Seeing that same image regardless of the icon of the weapon....ugh :p
Ok so......Maaaaybe I've taken a ''little'' bit of inspiration from FF9 when it comes to battle hud xD


Just maybe....
New version of my wife's art for Tundra's opening map. No new version of Katrina yet, but I think this looks awesome.1624062754755.png

Forum statistics

Latest member