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,933
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 Posts

Latest Profile Posts

Ok i got the model New and I will develop a little more, I think my SV is not beautiful yet.
"I, Giorno Giovanna, have a dream". In all seriousness, spatial BGM feature is now complete for my audio plugin.
Stream will be live shortly with some game development followed by the return of the Interactive Text Adventure after a short hiatus! Feel free to drop by!
Lately, I've taken to smashing random nouns/verbs together as insults. It's sort of amusing how many people don't really know how to respond to that. You bottle shaker!
Would be nice to pick color code that is not exclusively for message event

Forum statistics

Threads
103,243
Messages
998,317
Members
134,734
Latest member
Avaross
Top