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 Profile Posts

So yesterday Dad took me to Volcano Bay, and it was almost ruined by a thunderstorm... then it passed by and the lightning warning got lifted, leading to an awesome time sliding and swimming. Hopefully we get to go to the arcade tonight. The one we're planning on has a restaurant built in with AWESOME food. Not to mention how big the arcade itself is!

Maybe I'll actually try making a retro pack. Already have the shark fin made so why not xD
Hey everyone, for everybody following along with my RPG Maker MZ streams: There will unfortunately not be a stream tonight. There is a big exciting event that will go live next week that has been taking all my time, so look forward to that!
Took a small break by playing VR. Latest update of these glasses unfortunately caused a little of trouble but it can be fixed with a manual operation.

Until You Fall is freaking awesome.
I am SO HYPED to share this trailer with everyone when its done. I almost want to tear up i had no idea how far i came along with Fallen Feather in these last 3 years.

Forum statistics

Latest member