# 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 = '\\c[4]Weakness:\\c[0] ' + weakness + '\n';
resist = '\\c[4]Resist:\\c[0] ' + resist + '\n';
immune = '\\c[4]Immune:\\c[0] ' + immune + '\n';
absorb = '\\c[4]Absorb:\\c[0] ' + 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 = '\\c[4]Weakness:\\c[0] ' + weakness + '\n';
resist = '\\c[4]Resist:\\c[0] ' + resist + '\n';
immune = '\\c[4]Immune:\\c[0] ' + immune + '\n';
absorb = '\\c[4]Absorb:\\c[0] ' + absorb;
text = weakness + resist + immune + absorb;
Wow thanks so much for this mate! Ill give it a shot!

#### Klammsi

##### Veteran
@Trihan
Hello mate,
Hope you are well. Thank you very much with your help regarding this. It is already working very well.
I was just wondering if there is a way to call the icon of the state as well?

With the Elements the icons are called via the text code \I[n] next to the elements in the Database...
This method doesnt work for the sates...

### Latest Profile Posts

Almost to the finish line!... or the starting... since it's just the demo.

Having problems with enemy/monster designs.
While we prepare the official trailer, enjoy this kind-of-second teaser! ^^
-Ele

Episode 5 - Surprise Party!
Episode 6 - Killer Gin
Episode 7 - Gaia's Melody: Echoed Melodies
(Coming soon!)

Episode 8 - Clarent Saga: Tactics
(Coming soon!)

Episode 9 - Star Shift
(Coming soon!)
When the Map Generator throws in the assets in the most dumbest way possible - your path is blocked