MikaTeapot

Veteran
Veteran
Joined
Mar 25, 2019
Messages
37
Reaction score
13
First Language
English
Primarily Uses
RMMV
Hello, I wonder if anyone can help me with upgrading Yanflys Libra. At present I have this;
JavaScript:
<Before Eval>

if (target.isEnemy()) {

  var id = target._enemyId;

  var evatot = target.eva * 100

  var critot = target.cri * 100

  var hittot = target.hit * 100

  var text = target.name() + '\n';

  text += '\\px[100]\\c[4]M.Hp:\\c[0] ' + target.hp;

  text += '/' + target.mhp;

  text += '\\px[400]\\c[4]M.Mp:\\c[0] ' + target.mp;

  text += '/' + target.mmp;

  text += '\\px[700]\\c[4]TP:\\c[0] ' + target.tp;

  text += '\n';

  text += '\\px[100]\\c[4]Atk:\\c[0] ' + target.atk;

  text += '\\px[400]\\c[4]M.Atk:\\c[0] ' + target.mat;

  text += '\\px[700]\\c[4]Agi:\\c[0] ' + target.agi;

  text += '\n';

  text += '\\px[100]\\c[4]Def:\\c[0] ' + target.def;

  text += '\\px[400]\\c[4]M.Def:\\c[0] ' + target.mdf;

  text += '\\px[700]\\c[4]Luk:\\c[0] ' + target.luk;

  text += '\n';

  text += '\\px[100]\\c[4]Eva:\\c[0] ' + evatot.toFixed(2) + '%';

  text += '\\px[400]\\c[4]Crit:\\c[0] ' + critot.toFixed(2) + '%';

  text += '\\px[700]\\c[4]Hit:\\c[0] ' + hittot.toFixed(2) + '%';

  $gameSystem._messageRows = 5;

  $gameMessage.setBackground(1);

  $gameMessage.setPositionType(1);

  $gameMessage.add(text);



  var weakness = '';

  var resist = '';

  var immune = '';

  var absorb = '';

  var elements = $dataSystem.elements;

  for (var i = 1; i < elements.length; ++i) {

    var name = elements;

    var rate = target.elementRate(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);

}

</Before Eval>

<After Eval>

  $gameSystem._messageRows = 4;

</After Eval>

I have 2 questions;
1 - I want the messageRows to be 5 for the skill (so it all fits nicely) and back to 4 after (so the rest of my games messages look right) but my method above (setting to 4 in after eval) doesn't work (and if I set it to 5 and leave it, the rest of the game has 5 rows), what should I do?

2. I'd love to extend the elemental resistances section to also include state resistances, and % chances/resistances for elements/ states, how can I go about doing that?
 

MikaTeapot

Veteran
Veteran
Joined
Mar 25, 2019
Messages
37
Reaction score
13
First Language
English
Primarily Uses
RMMV
Is bumping allowed >.>
 

MikaTeapot

Veteran
Veteran
Joined
Mar 25, 2019
Messages
37
Reaction score
13
First Language
English
Primarily Uses
RMMV
Still haven't managed to figure this out! :(
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,172
Reaction score
3,435
First Language
English
Primarily Uses
RMMZ
The problem is that After Eval effects process before the message displays, so it's setting _messageRows back to 4.

As I said to you on Discord, the best solution I can think of is a passive state on an actor that has a Custom Action End Effect which sets $gameSystem._messageRows back to 4.

Also here's how you'd do it with the state rates (it puts them on a new page so you don't end up with the first line joined up to the element rates)

Code:
<Before Eval>
if (target.isEnemy()) {
  var id = target._enemyId;
  var evatot = target.eva * 100
  var critot = target.cri * 100
  var hittot = target.hit * 100
  var text = target.name() + '\n';
  text += '\\px[100]\\c[4]M.Hp:\\c[0] ' + target.hp;
  text += '/' + target.mhp;
  text += '\\px[400]\\c[4]M.Mp:\\c[0] ' + target.mp;
  text += '/' + target.mmp;
  text += '\\px[700]\\c[4]TP:\\c[0] ' + target.tp;
  text += '\n';
  text += '\\px[100]\\c[4]Atk:\\c[0] ' + target.atk;
  text += '\\px[400]\\c[4]M.Atk:\\c[0] ' + target.mat;
  text += '\\px[700]\\c[4]Agi:\\c[0] ' + target.agi;
  text += '\n';
  text += '\\px[100]\\c[4]Def:\\c[0] ' + target.def;
  text += '\\px[400]\\c[4]M.Def:\\c[0] ' + target.mdf;
  text += '\\px[700]\\c[4]Luk:\\c[0] ' + target.luk;
  text += '\n';
  text += '\\px[100]\\c[4]Eva:\\c[0] ' + evatot.toFixed(2) + '%';
  text += '\\px[400]\\c[4]Crit:\\c[0] ' + critot.toFixed(2) + '%';
  text += '\\px[700]\\c[4]Hit:\\c[0] ' + hittot.toFixed(2) + '%';
  $gameSystem._messageRows = 5;
  $gameMessage.setBackground(1);
  $gameMessage.setPositionType(1);
  $gameMessage.add(text);
  var weakness = '';
  var resist = '';
  var immune = '';
  var absorb = '';
  var elements = $dataSystem.elements;
  for (var i = 1; i < elements.length; ++i) {
    var name = elements[i];
    var rate = target.elementRate(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);
  weakness = '';
  resist = '';
  immune = '';
  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) {
      immune += name + ' ';
    } else if (rate < 1) {
      resist += name + ' ';
    }
  }
  if (weakness === '') weakness = 'None';
  if (resist === '') resist = 'None';
  if (immune === '') immune = 'None';
  weakness = '\\c[4]State Weakness:\\c[0] ' + weakness + '\n';
  resist = '\\c[4]State Resist:\\c[0] ' + resist + '\n';
  immune = '\\c[4]State Immune:\\c[0] ' + immune + '\n';
  text = weakness + resist + immune;
  $gameMessage.newPage();
  $gameMessage.add(text);
}
</Before Eval>
 
Last edited:

Latest Threads

Latest Profile Posts

Well, I'm quickly recovering from Covid, but I'm still broke and injured lol. I miss working on my game! I think I've figured out a lore-friendly way to do a tutorial section separate from the main gameplay, but it'll take some scripting know-how. Which I don't have. And can't afford. :p
I think Kipling said it best.

If you can make one heap of all your winnings
And risk it on one turn of pitch-and-toss,
And lose, and start again at your beginnings
⁠And never breathe a word about your loss,
(...)
Yours is the Earth and everything that's in it,
⁠And—which is more—you'll be a Man, my son!


Do you feel like your modern cities are too clean? I made some dumpsters and trash variations. Visit my MZ resource thread (link in signature).

Forum statistics

Threads
118,579
Messages
1,117,116
Members
155,647
Latest member
beatdsystem
Top