# Question regarding Yanfly's Libra Tips and Tricks

#### Klammsi

##### Veteran Hello guys,

Hope everybody is well and healthy!
Quick question, I am using Yanfly's Libra tips and tricks to scan the enemy for strength and weaknesses.
I was wondering if there is a way to show an enemy's resistance to a state and their skills as well?
Sadly my JavaScript knowledge is very limited so I thought I try and pick your brains.

Here is the link to the tips and trick btw:

cheers

#### Trihan

##### Speedy Scripter You can do this using the same sort of structure as the element rates section uses.

Code:
``````var weakness = '';
var resist = '';
var immune = '';
var absorb = '';
var states = \$dataStates;
for (var i = 1; i < states.length; ++i) {
var name = states[i].name;
var rate = target.stateRate(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 = 'None';
if (resist === '') resist = 'None';
if (immune === '') immune = 'None';
if (absorb === '') absorb = 'None';
weakness = '\\cWeakness:\\c ' + weakness + '\n';
resist = '\\cResist:\\c ' + resist + '\n';
immune = '\\cImmune:\\c ' + immune + '\n';
absorb = '\\cAbsorb:\\c ' + absorb;
text = weakness + resist + immune + absorb;

#### Klammsi

##### Veteran You can do this using the same sort of structure as the element rates section uses.

Code:
``````var weakness = '';
var resist = '';
var immune = '';
var absorb = '';
var states = \$dataStates;
for (var i = 1; i < states.length; ++i) {
var name = states[i].name;
var rate = target.stateRate(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 = 'None';
if (resist === '') resist = 'None';
if (immune === '') immune = 'None';
if (absorb === '') absorb = 'None';
weakness = '\\cWeakness:\\c ' + weakness + '\n';
resist = '\\cResist:\\c ' + resist + '\n';
immune = '\\cImmune:\\c ' + immune + '\n';
absorb = '\\cAbsorb:\\c ' + absorb;
text = weakness + resist + immune + absorb;
Wow thanks so much for this mate! Ill give it a shot!

### Latest Profile Posts We'll be doing another giveaway of MZ on the stream tomorrow! Thank you SykoGaming for contributing a copy for the community! Sorry guys! Been away for long this time. Got attacked by my anxieties again. At least no more bedbugs. Got logged out of here and layout seems strange now a bit.
My old project is now a sitcom
How to do implementation the social politcal mechanics in rpg maker? Thank you for quick spark of ideas. Fear of going to the thread lol.