Set Event graphic script call MV

Hi, hopefully this is an easy one, but I've spent the last hour googling and I can't find it. I need to change an event graphic through a script (to avoid a ridiculous amount of conditional branches, if you must know 😛) and I have something I believe is for an earlier version of the software, but I can't find out what the MV equivalent is. I gathered it's "$gameMap.events" but I don't have the second bit. If there's a resource for this (it's not on this I don't think) I'd love to know what it is so I don't have to bother you guys again.


"$game_map.events[id].set_graphic("character_name", character_index)"


is what I was trying to use and it's been failing.


Thanks!
I've moved this thread to Learning JavaScript. Please be sure to post your threads in the correct forum next time. Thank you.



MV doesn't use scripts, they use plug-ins. I assume you meant plug-in call instead? As it is, I put your thread under the learning javascript thread so someone in the know about the command can tell you the JavaScript command that you need.
It won't be a plugin call - it'll be a script call.


Whenever you have something that you can do via event commands, and you want to do it with a script call instead, head to the rpg_objects.js file and search for the event command exactly as it appears on the button in the event editor.


The reason what you've tried won't work is that you're using RGSS code with Ace classes and functions, and MV uses Javascript and its classes and functions are named differently, so your code isn't going to work.
Basically I wanted to pull in two game variables, one for the event ID and another for which character index I needed for the event (they all use the same character sheet). I got that part sorted, but you're saying there's no call available to set event graphics? Is there another way I'm just overlooking or is this something a plugin would need to be written to do?


And thanks for your help.
Who are you talking to?  I told you to search through rpg_objects.js for the text that's on the event graphic change command, and to see how that does it.  I couldn't tell you what the event text was (so what to search for), or how to do it, because I wasn't at my computer.  But I thought my instructions were pretty simple.
"$game_map.events[id].set_graphic("character_name", character_index)"


is what I was trying to use and it's been failing.



What happens when you try to do this? And what is the exact script call you're using?
Ok, so in the rpg_objects.js file this is the relevant portion.


Game_Character.prototype.processMoveCommand = function(command) {
var gc = Game_Character;
var params = command.parameters;
switch (command.code) {

case gc.ROUTE_CHANGE_IMAGE:
this.setImage(params[0], params[1]);
break;




Still not sure what the the call I need is. I tried something like this,


$gameMap.events[ID].setImage ("characterName", characterIndex)


but still no dice.
Does your characterName and characterIndex exist?
Does your characterName and characterIndex exist?



As far as I know yes, I've been setting my characterName to the file name in the character folder, and from what I can tell index is just where at on the character sheet (0-7)
For anyone else that came here looking for the same thing...

JavaScript:
$gameMap._events[IdOfEventGoesHere].setImage('Actor2', 4);

You were missing the underscore. Next time, console.log out your object so you can see what you are doing.

apologies for the necro, but this is what comes up in google when searching.
Hope this helps someone else.

Original thread: https://forums.rpgmakerweb.com/threads/set-event-graphic-script-call-mv.74335/