Divinity 2-based armor defences?

Hello, It's me, Mogneto!

So, I'm making a game a bit inspired in DOS2, and in Divinity there is an armor system that players can't receive damage until their armors (physical for p damage and magical for m damage) reaches zero.
Until then, their armors receives the damage value for them, and by doing so, the armors values decreases equal to the damage received.

I want to know if there's a plugin or a way to do a javascript code that changes the game DEF to one like this.
This would open space for new battle mechanics and piercing armor skills.

Thanks for the help.
One way to do it using a third party plugin is Yanfly Barrier plugin. It provides a Barrier gauge which has to be killed before HP damage is done - you can rename Barrier to Armor and it should fit your system. You may have other challenges to figure out but hopefully that gets you started in the right direction. I think it has the capability for some attacks which can pierce through the barrier.
Thanks for the help! I'll dowload the plugin and see what I can do with it.
Hopefully there's a way to make equipments define the barrier value.
So, I tried the plugin and it fits almost perfectly. I want to remove the DEF and MDEF stats from the game, implying that the barrier is the only defense attribute the equips give to the player.
The only problem is that I don't know how to remove those stats and create a new one for the barrier, so it can show the player how much barrier points the equipment gives.

My wish is to create an specific stat where this happens, and remove the DEF and MDEF stats from de game.
Just rename DEF and MDF to your Barrier stats, then make the barrier's initial value equal to the DEF/MDF of the equipment.

And dont use them on your damage formulas so that they dont do anything other than being a visual indicator for your barrier system.

This way, the system will be handling the visual aspect of your barrier values using the default way..

Original thread: https://forums.rpgmakerweb.com/threads/divinity-2-based-armor-defences.113365/