[SOLVED] How do I add a second charset layer on top of default charset?

Hello fellow RPG Comrades,

I want to change the Player's appearance when, let's say, he puts a new helmet on.
But, instead of changing the entire charset, I want to add another charset layer on top of the player.
The second charset layer would only show the helmet in various positions.

That way, I would save myself the hassle of creating an entire new charset for every single item combination.
I searched for plugins and posts, but so far have not found anything. Sorry if I missed something and this is a redundant post.

In rpg_sprites, line 2329 I found the method for loading the charset of $gamePlayer.

JavaScript:
Spriteset_Map.prototype.createCharacters = function() {
    this._characterSprites = [];
    $gameMap.events().forEach(function(event) {
        this._characterSprites.push(new Sprite_Character(event));
    }, this);
    $gameMap.vehicles().forEach(function(vehicle) {
        this._characterSprites.push(new Sprite_Character(vehicle));
    }, this);
    $gamePlayer.followers().reverseEach(function(follower) {
        this._characterSprites.push(new Sprite_Character(follower));
    }, this);
    this._characterSprites.push(new Sprite_Character($gamePlayer));
    for (var i = 0; i < this._characterSprites.length; i++) {
        this._tilemap.addChild(this._characterSprites[i]);
    }
};

I tried adding a new charset Sprite to SceneManager._scene._spriteset._characterSprites and set the x, y coordinates to the player. However, the charset keeps returning to it's original map position. So I couldn't even attempt to make the charset move along with the player, while being on top.

I'm sure there is a plugin for this I haven't found yet.
Either way as always I'm thankful for any help.

Kind regards,

Lanzy
It's called paper doll.
Which lead me to this thread:
Which answered with a link to this plugin:
http://sumrndm.site/dynamic-actors/
Create a subfolder in your project's img folder called "equipment". Put your helmet png in it.

Create a plugin file and place this code in it:
Sprite_Equipment.png


Pull up the console and type these commands:
JavaScript:
let helmet = new Sprite_Equipment($gamePlayer, `helmet`);
// replace `helmet` with the filename of your helmet png (without the extension)
and
JavaScript:
SceneManager._scene.children[0]._tilemap.addChild(helmet);

You might have to adjust the x and y coordinates of where your helmet will be placed in conjunction to your player sprite, which you can do by rewriting the first console command-

let helmet = new Sprite_Equipment($gamePlayer, filename, x, y);

Enjoy!
Create a subfolder in your project's img folder called "equipment". Put your helmet png in it.

Create a plugin file and place this code in it:
View attachment 149777

Pull up the console and type these commands:
JavaScript:
let helmet = new Sprite_Equipment($gamePlayer, `helmet`);
// replace `helmet` with the filename of your helmet png (without the extension)
and
JavaScript:
SceneManager._scene.children[0]._tilemap.addChild(helmet);

You might have to adjust the x and y coordinates of where your helmet will be placed in conjunction to your player sprite, which you can do by rewriting the first console command-

let helmet = new Sprite_Equipment($gamePlayer, filename, x, y);

Enjoy!


Thank you for this extensive workaround. Unfortunately, after some testing, it didn't work. The helmet nor the armor charset appears anywhere. I tested on a small map and adjusted the coordinates. Still to no avail I'm afraid. Even after adjusting the coordinates. It does not show up on the screen.

Maybe the screenshots help you understand the problem. Thanks for you time!
And what about the plugin that does this exact thing that was suggested earlier? Did you try it?
And what about the plugin that does this exact thing that was suggested earlier? Did you try it?

I first tried aporokizzu's suggestion, because I prefer it to using plugins. I try to avoid as many plugins as possible, because I have my own plugins for my game, which can go more or less deep into the core script. So I try to avoid any conflicts.

I will try out the dynamic actors plugin now however.
@Lanzy - weird it's working on my end:



I looked through you screenshots and everything seems kosher... so I'm sorry it didn't work for you. Maybe it's a conflict with other plugins?
@Lanzy - weird it's working on my end:



I looked through you screenshots and everything seems kosher... so I'm sorry it didn't work for you. Maybe it's a conflict with other plugins?


Hmm, I'll open a new project and see if that works. Thanks for trying it out. I'll let you know if it worked.
It worked! Problem was, it was so far out of the map, I didn't even see it. Only when I loaded a huge image and walked to the map corner I could see it then. Yipeee, thanks everonye 🙂

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-how-do-i-add-a-second-charset-layer-on-top-of-default-charset.123526/