RPGM Little script to automatically change event images to actor images (tested in RPG Maker Mz)

ThatsAll

Newbie
Sep 22, 2017
58
79
I started developing an adult game in RPG Maker MZ. As I'm just starting with development I'm not quite sure how I want the characters to look like, but I still want to place them on the map and replace their event images later in the development. Doing this with every event seemed to me like maintenance hell. So I asked around in the rpg forum and with its finally came up with the following script:
JavaScript:
$gameMap.events().forEach(function(ev) {
    for(var i =1; i < $dataActors.length; i++){
        if($dataActors[i].name != "" && ev.event().name.startsWith($dataActors[i].name)){
            ev.setImage($gameActors.actor(i).characterName(),$gameActors.actor(i).characterIndex());
        }
    }
});
Put this script into a common event and call this event everytime you enter a new map (I do it via autorunning an init event. You can of course also just put this script in your init event).
You don't have permission to view the spoiler content. Log in or register now.
You don't have permission to view the spoiler content. Log in or register now.
This helped me a lot and took me a greater amount of time than I would have expected for such a small thing to figure out and get to this finished script. I hope this can help some people.
 
Last edited:
  • Like
Reactions: HaluPrime