[Solved]Change CharacterImage via script?

Hi, i am trying to change the Character-Image of an Actor with a script call, which i think should look like this:
 


$gameActors.actor(1).setCharacterImage('People1', 2);




so, in this example, it should change the Character Image of Actor 1 to the second one in "People1.png", atleast i think so.


My problem with this is, that it doesn't change anything and does not give me an error message or similar in the console...


have been missing "$gamePlayer.refresh()"

Spoiler
By the way, it does not help to change 'People1' to 'People1.png', tried it too.



For anyone trying to help:
Thanks in advance :3
Code:
// Change Actor Images
Game_Interpreter.prototype.command322 = function() {
    var actor = $gameActors.actor(this._params[0]);
    if (actor) {
        actor.setCharacterImage(this._params[1], this._params[2]);
        actor.setFaceImage(this._params[3], this._params[4]);
        actor.setBattlerImage(this._params[5]);
    }
    $gamePlayer.refresh();
    return true;
};



It may just be that you need the $gamePlayer.refresh() call in order to update the image on the map, if that's what you mean.  Without it, it might update the image when you go to a menu and return to the map, transfer to a different map (or maybe somewhere else on the same map), or start and end a battle, but otherwise, it won't be an immediate change.


Though why are you using a script call to do it?  There's a Change Actor Images event command under System Settings on tab 3.
Thank you very much! that is what I've been missing!


and as to "why" i want to use a script call for it is, that i want "customizeable" party members depending on choices the player does


i think it will be easier to do that with the possibility to change with the actor id instead of making an event for every actor-id possible to have it.


as an simple example:


21 Actors


1 Actor is the player himself


20 are customizeable (class) and when "hiring" one, the actor you hire then changes to the wanted class (and changes to the expected image)


Again thank you very much! :3

Original thread: https://forums.rpgmakerweb.com/threads/solved-change-characterimage-via-script.56964/