Question regarding Yanfly's Libra Tips and Tricks

Klammsi

Veteran
Veteran
Joined
Nov 19, 2016
Messages
62
Reaction score
10
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,616
Reaction score
1,978
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
62
Reaction score
10
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!
 

Klammsi

Veteran
Veteran
Joined
Nov 19, 2016
Messages
62
Reaction score
10
First Language
English
Primarily Uses
@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...
 

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

Latest Threads

Latest Posts

Latest Profile Posts

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

Having problems with enemy/monster designs. :kaosigh:
While we prepare the official trailer, enjoy this kind-of-second teaser! ^^
-Ele
New Episodes of RPG Shenanigans Uploaded to Youtube!

Episode 5 - Surprise Party!
Youtube Link:
Episode 6 - Killer Gin
Youtube Link:
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 :D

Forum statistics

Threads
107,567
Messages
1,030,616
Members
139,671
Latest member
WDRS
Top