Question regarding Yanfly's Libra Tips and Tricks

Klammsi

Veteran
Veteran
Joined
Nov 19, 2016
Messages
56
Reaction score
9
First Language
English
Primarily Uses
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
Veteran
Joined
Apr 12, 2012
Messages
2,355
Reaction score
1,510
First Language
English
Primarily Uses
RMMV
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;
  $gameMessage.add(text);
 

Klammsi

Veteran
Veteran
Joined
Nov 19, 2016
Messages
56
Reaction score
9
First Language
English
Primarily Uses
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;
  $gameMessage.add(text);
Wow thanks so much for this mate! Ill give it a shot!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Got inspired and started writing a simple tower defence battle system last night :o
Good news! I have located an amazing 3D website called SketchFab that has rotatable renderings of famous statues!
Picked up a physical copy of Megadimension Neptunia VII for the PS4 today. It's pretty good. I'm having a lot of fun with it.
The only upside of this remote semester was the plenty of funny photoshop material those facecams provided. Not that I would do that. Ever.

Forum statistics

Threads
100,516
Messages
976,707
Members
132,080
Latest member
nwr
Top