MV Weapons over actors

So, I found this code for placing weapon animations over actors sprites. I'm a noob and still getting the hang of all this. Is there a simple way to make it is so only certain weapons are placed over actors and others aren't? If someone already did this can someone link me to that? It would be very appreciated.

Sprite_Actor.prototype.initMembers = function() {
Sprite_Battler.prototype.initMembers.call(this);
this._battlerName = '';
this._motion = null;
this._motionCount = 0;
this._pattern = 0;
this.createShadowSprite();
this.createWeaponSprite();
this.createMainSprite();
this.createStateSprite();
};
Isn't that just the normal unedited function from base code?

I think you can do it by making 2 weapon sprites, one before the main sprite and one after. Like copy paste the method and name it createWeaponSprite2 and make it add a property _weaponSprite2

Then in the following method
Sprite_Actor.prototype.setupWeaponAnimation = function() {
if (this._actor.isWeaponAnimationRequested()) {
this._weaponSprite.setup(this._actor.weaponImageId());
this._actor.clearWeaponAnimation();
}
};
check what the weaponImageId is and choose based on that whether you use the setup method on this._weaponSprite or this._weaponSprite2

But yeah, didn't test it or anything, just throwing ideas LOL

EDIT: Maybe you can also just go with the 1 weapon sprite and rearrange the children depending on the weapon


If you have MZ, you can use this as a reference.

Original thread: https://forums.rpgmakerweb.com/threads/weapons-over-actors.182620/