Improving Yanfly Skill "Libra"

Hi guys, while developing my game i noticed that yanfly's libra skill works great, but doesn't shows to the player the status resistences from enemies. I would like to fix that. But i can't.

I've been searching through the code to find the way to check enemies status resiscences, and i found this method: target.stateResistSet();

This returns an array with all id's an enemie can resist.

Now, i need to change that id to text and just show it, but here is where i cant continue.

Ive used $dataStates on the debug console and ive saw its content, which is an Object array that contains all status in the game.

Using on console $dataStates[id].name, the console returns the name of that status, but when I use it on the skill, the game crashes.

Can some1 to help me on this?
ok, on the discord server some1 resolved this, so im gonna post that code with some corrections to be used by any1:

Code:
<Before Eval>
if (target.isEnemy()) {
var id = target._enemyId;
$gameSystem.addHpGaugeEnemy(id);
var centinela1 = true;
var centinela2 = true;

var text = target.name() + '\n';
text += '\\px[100]\\c[4]HP:\\c[0] ' + target.hp;
text += '/' + target.mhp;
text += '\\px[400]\\c[4]MP:\\c[0] ' + target.mp;
text += '/' + target.mmp;
text += '\\px[700]\\c[4]TP:\\c[0] ' + target.tp;
text += '\n';
text += '\\px[100]\\c[4]ATK:\\c[0] ' + target.atk;
text += '\\px[400]\\c[4]MAT:\\c[0] ' + target.mat;
text += '\\px[700]\\c[4]AGI:\\c[0] ' + target.agi;
text += '\n';
text += '\\px[100]\\c[4]DEF:\\c[0] ' + target.def;
text += '\\px[400]\\c[4]MDF:\\c[0] ' + target.mdf;
text += '\\px[700]\\c[4]LUK:\\c[0] ' + target.luk;

$gameMessage.add(text);

var weakness = '';
var resist = '';
var immune = '';
var absorb = '';
var elements = $dataSystem.elements;

for (var i = 1; i < elements.length; ++i) {
var name = elements[i];
var rate = target.elementRate(i);

if (rate > 1) {
weakness += name + ' ';
} else if (rate < 0) {
absorb += name + ' ';
} else if (rate === 0) {
immune += name + ' ';
} else if (rate < 1) {
resist += name + ' ';
}
}

if (weakness === '') weakness = 'Ninguna';
if (resist === '') resist = 'Ninguna';
if (immune === '') immune = 'Nada';
if (absorb === '') absorb = 'Nada';

weakness = '\\c[4]Debilidades:\\c[0] ' + weakness + '\n';
resist = '\\c[4]Resistencias:\\c[0] ' + resist + '\n';
immune = '\\c[4]Immune a:\\c[0] ' + immune + '\n';
absorb = '\\c[4]Absorbe:\\c[0] ' + absorb;
text = weakness + resist + immune + absorb;

$gameMessage.add(text);

// show state resistances
text = '\\c[4]Inmune a:\\c[0]';
var stateResist = target.stateResistSet().map(function(stateId) { return $dataStates[stateId]; });
stateResist.forEach(function (state) {
text += "\t\t" + state.name + ",";

// Adds line jump if text is too long
if (text.length > 100 && centinela1 ){
text += "\n";
centinela1 = false;
}
});

$gameMessage.add(text);

// show passives
var passives = target.passiveStates().filter(function (state) {
return !state.meta.hiddenpassive;
});
var text = "\\c[4]Estados Pasivos:\\c[0]";
if (passives.length > 0) {
passives.forEach(function (state) {
text += "\t\t" + state.description + "\n";

// Adds line jump if text is too long
if (text.length > 100 && centinela2 ){
text += "\n";
centinela2 = false;
}
});
} else {
text += " Ninguno";
}
$gameMessage.add(text);
}
</Before Eval>
I tried using this but it was not compatible with my games.
I tried only copying the state part but it will only display: "c[4]Inmune a:"

Can you maybe show me the code without your changes? Maybe that remedies the problem.
You can find information about the original Yanfly Libra skill here.
The link to Yanfly´s Libra skill does not help me.
I was looking to make the Libra skill display state resistances as well as state weaknesses.
These were however not included in Yanfly´s original Libra skill.
Yeah, I noticed later, I am gonna update the code.

It doesn't work with GALV's Message Styles plugin, but I am working on fixing it

Original thread: https://forums.rpgmakerweb.com/threads/improving-yanfly-skill-libra.104723/