Question regarding Yanfly's Libra Tips and Tricks

Klammsi

Veteran
Veteran
Joined
Nov 19, 2016
Messages
57
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,602
Reaction score
1,932
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
57
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

:( ... sigh, having trouble knowing where to draw highlights. Novice pixel artist issues.
Hey there folks. I've got this game I've been working on story & design for over a few years. Trying out MZ to prototype it.

Forum statistics

Threads
102,971
Messages
996,408
Members
134,438
Latest member
darklurker
Top