"Libra/Tattle" skill?

Hello,

I'm working on a creating a Skill that allows the player to view information about an enemy. I googled the subject, but all I could find are instructions on how to create skills that allow the player to view an enemy's HP/weaknesses. I was hoping to show the player a text box with information about the enemy instead.

Is this doable without a plugin?

Thanks in advance.


That's actually what I saw before- it just shows how to reveal the enemy's HP. I'm trying to show the player a text box with information about the enemy instead.
That's actually what I saw before- it just shows how to reveal the enemy's HP. I'm trying to show the player a text box with information about the enemy instead.
Oh my bad.

You could try to make Yanfly's In Battle Status plugin work for enemies.
I see this thread here:
https://forums.rpgmakerweb.com/inde...ys-in-battle-status-plugin-for-enemies.91295/

Unfortunately, they solved it themselves and didn't post how ;_;
Oh my bad.

You could try to make Yanfly's In Battle Status plugin work for enemies.
I see this thread here:
https://forums.rpgmakerweb.com/inde...ys-in-battle-status-plugin-for-enemies.91295/

Unfortunately, they solved it themselves and didn't post how ;_;

I don't think even that would help- I don't want to show any statistical information about the enemy- just a text box.

Like, if you target a Bat with the Skill, a text box would pop up reading-

"BAT
A common monster roaming the forest."

Thank you for your help.
Without plugins, you could set the skill's damage formula to something like this:
Code:
v[1] = b.isEnemy() ? b.enemyId() : 0; 0
This says "set game variable 1 to the target's enemy ID if it's an enemy, or zero otherwise; then do zero damage". 🙂

[Edit: the damage formula will only be evaluated when the skill hits, so I strongly recommend making the skill certain-hit if you're using this approach!]

You can then use branches to check the value of that variable in your common event and show an appropriate message, e.g.
Spoiler: Event example
Code:
◆If:Target ID = 1
  ◆Text:None, Window, Bottom
  :    :Oh no, it's a bat!
  ◆
:Else
  ◆If:Target ID = 2
    ◆Text:None, Window, Bottom
    :    :It's just a slime.
    ◆
  :Else
    ◆Comment:etc
    ◆
  :End
  ◆
:End

Unfortunately setting the skill's damage type to anything other than None will cause a damage popup to appear. If your skill should do no damage and you want to avoid a "0" popup, I'd suggest a plugin like Yanfly's Skill Core; this gives you a notetag that you can put in the skill's notebox, rather than having to make use of the damage formula~
Code:
<Before Eval>
var nmeId = target.isEnemy() ? target.enemyId() : 0;
$gameVariables.setValue(1, nmeId);  // store in variable 1
</Before Eval>
You should then be able to use the common event as described above. 😮‍💨
Without plugins, you could set the skill's damage formula to something like this:
Code:
v[1] = b.isEnemy() ? b.enemyId() : 0; 0
This says "set game variable 1 to the target's enemy ID if it's an enemy, or zero otherwise; then do zero damage". 🙂

[Edit: the damage formula will only be evaluated when the skill hits, so I strongly recommend making the skill certain-hit if you're using this approach!]

You can then use branches to check the value of that variable in your common event and show an appropriate message, e.g.
Spoiler: Event example
Code:
◆If:Target ID = 1
  ◆Text:None, Window, Bottom
  :    :Oh no, it's a bat!
  ◆
:Else
  ◆If:Target ID = 2
    ◆Text:None, Window, Bottom
    :    :It's just a slime.
    ◆
  :Else
    ◆Comment:etc
    ◆
  :End
  ◆
:End

Unfortunately setting the skill's damage type to anything other than None will cause a damage popup to appear. If your skill should do no damage and you want to avoid a "0" popup, I'd suggest a plugin like Yanfly's Skill Core; this gives you a notetag that you can put in the skill's notebox, rather than having to make use of the damage formula~
Code:
<Before Eval>
var nmeId = target.isEnemy() ? target.enemyId() : 0;
$gameVariables.setValue(1, nmeId);  // store in variable 1
</Before Eval>
You should then be able to use the common event as described above. 😮‍💨

Absolutely phenomenal- it worked perfectly! Thank you so much @caethyril. Both you and @Silenity have been added to my game's credits for your help. 🙂
You know, you could always use note tags to store the descriptions on each enemy rather than a big long-ass common event with "if id == 1, do this, if id == 2, do this, etc"

Something like in the enemy note field:

<Info: This is a slimy green slime.>

And this in your damage formula:

Code:
c = b.isActor() ? b.actor() : b.enemy(); $gameMessage.add(c.meta.Info || "Little is known about this foe."); 0

As stated above, it'll show a 0 damage popup unless you use yanfly's skill core. If you use that, you can just do this in the skill's note box instead of the formula box:

Code:
<Before Eval>
var battler = target.isActor() ? target.actor() : target.enemy();
var defaultInfo = "Little is known about this foe.";
$gameMessage.add(String(battler.meta.Info || defaultInfo).trim());
</Before Eval>

Just be aware that the <Info: x> note tag is case sensitive (so Info, not info). Other than that, it should be pretty straightforward
You know, you could always use note tags to store the descriptions on each enemy rather than a big long-ass common event with "if id == 1, do this, if id == 2, do this, etc"

Something like in the enemy note field:

<Info: This is a slimy green slime.>

And this in your damage formula:

Code:
c = b.isActor() ? b.actor() : b.enemy(); $gameMessage.add(c.meta.Info || "Little is known about this foe."); 0

As stated above, it'll show a 0 damage popup unless you use yanfly's skill core. If you use that, you can just do this in the skill's note box instead of the formula box:

Code:
<Before Eval>
var battler = target.isActor() ? target.actor() : target.enemy();
var defaultInfo = "Little is known about this foe.";
$gameMessage.add(String(battler.meta.Info || defaultInfo).trim());
</Before Eval>

Just be aware that the <Info: x> note tag is case sensitive (so Info, not info). Other than that, it should be pretty straightforward

Unless I'm interpreting the code incorrectly, wouldn't this yield only a single text box?

This is actually what I'm looking to do- it's set up as @caethyril suggested right now:

Spoiler: Analyze Skill
analyzeskill.png

The skill.
analyzecommonevent.png

The common event.
analyze1.png

analyze2.png

The skill in action.

The code you posted seems far more convenient to use, but I wouldn't be able to do several text boxes like I can with the code I'm using, correct? I'd also have to test the game to see if the text fits in the box as well.

Thank you for your help- I seem to recall you helping me with another problem before- I at least remember your username. You have been added to the credits as well. 🙂
If you're using yanfly's message core, you can change $gameMessage.add to $gameMessage.addText and utilize word wrap. Also, any overflow text from the first messagebox would appear in a second messagebox.

And thanks, you don't have to add me to credits if you don't want to. It's a pretty simple snippet of code. 🙂
If you're using yanfly's message core, you can change $gameMessage.add to $gameMessage.addText and utilize word wrap. Also, any overflow text from the first messagebox would appear in a second messagebox.

And thanks, you don't have to add me to credits if you don't want to. It's a pretty simple snippet of code. 🙂

But I do- if someone helps me, I credit them. That's my philosophy. 🙂

I'm not currently using the Message Core, but I'll try to implement it. Just reading the instructions on Yanfly's website, though- if I used Word Wrap, my existing line breaks would have to be replaced with a command, right? That means I'll have to go through my whole script and add line breaks.

It's certainly easier to add a notetag than use a common event, though- I'll rework the code later when I have more time.

Thank you for your help. 🙂
Yeah yanfly's message core is really good--one of the few plugins that I honestly think is a must-use for just about any project. No word wrap by default is pretty horrible and useless. The other features aren't half bad, either.
Yeah yanfly's message core is really good--one of the few plugins that I honestly think is a must-use for just about any project. No word wrap by default is pretty horrible and useless. The other features aren't half bad, either.

Ok, I just tried it- I ran into a few issues.

-When I try to use the <line break> command within <Info:>, it reads as "text.... <line break"- I guess because it Message Core doesn't extend to notetags, and if I try to manually insert a line break with the ENTER key, it doesn't get detected at all.
-The window always shows on the bottom of the screen- I was hoping to show it on the top as I had it in the image I posted.
-Is there any way to show a face with the message box? I don't need this now but I definitely will in the future. (It makes more sense if a party member that knows about the enemy is the one to tell you about it, right?)

Again, thank you for all your help. 🙂
-When I try to use the <line break> command within <Info:>, it reads as "text.... <line break"- I guess because it Message Core doesn't extend to notetags, and if I try to manually insert a line break with the ENTER key, it doesn't get detected at all.
Oh right, that's because the closing tag for the line break is also closing the note tag because the parser doesn't know any better. Basically this is what's happening:

<Info: This is a slime.<br>It is green and larger than your average ooze or jelly.>

Unless you want to complicate things quite a bit by editing message core's code, you'll have to decide whether line break or word wrap is more important.

Honestly, I wish Yanfly hadn't done it that way, but that's what we have to work with.

-The window always shows on the bottom of the screen- I was hoping to show it on the top as I had it in the image I posted.
$gameMessage.setPositionType(n); // n = 0 top, 1 middle, 2 bottom

So setting "n" to 0 will cause it to be drawn on the top of the screen.

-Is there any way to show a face with the message box? I don't need this now but I definitely will in the future. (It makes more sense if a party member that knows about the enemy is the one to tell you about it, right?)
$gameMessage.setFaceImage(imageName, index);

Where imageName is the name of the image (ie, Actor1, Nature, Monster, etc) and index is which face to use on that index based on its position in the image:

Code:
0 1 2 3
4 5 6 7

Here's an example of a code-generated message box--the parameters used to position the window and show the face are shown in the message itself for clarity:

1ci8QER.png


Edit: Here's a sample of the code from before, edited to position on the top:

Code:
<Before Eval>
var battler = target.isActor() ? target.actor() : target.enemy();
var defaultInfo = "Little is known about this foe.";
$gameMessage.setFaceImage(user._characterName, user._characterIndex);
$gameMessage.setPositionType(0);
$gameMessage.addText(String(battler.meta.Info || defaultInfo).trim());
</Before Eval>

This will have the caster be the one to speak the message. I hope. I haven't actually tested this, but it should work.
Oh right, that's because the closing tag for the line break is also closing the note tag because the parser doesn't know any better. Basically this is what's happening:

<Info: This is a slime.<br>It is green and larger than your average ooze or jelly.>

Unless you want to complicate things quite a bit by editing message core's code, you'll have to decide whether line break or word wrap is more important.

Honestly, I wish Yanfly hadn't done it that way, but that's what we have to work with.


$gameMessage.setPositionType(n); // n = 0 top, 1 middle, 2 bottom

So setting "n" to 0 will cause it to be drawn on the top of the screen.


$gameMessage.setFaceImage(imageName, index);

Where imageName is the name of the image (ie, Actor1, Nature, Monster, etc) and index is which face to use on that index based on its position in the image:

Code:
0 1 2 3
4 5 6 7

Here's an example of a code-generated message box--the parameters used to position the window and show the face are shown in the message itself for clarity:

1ci8QER.png


Edit: Here's a sample of the code from before, edited to position on the top:

Code:
<Before Eval>
var battler = target.isActor() ? target.actor() : target.enemy();
var defaultInfo = "Little is known about this foe.";
$gameMessage.setFaceImage(user._characterName, user._characterIndex);
$gameMessage.setPositionType(0);
$gameMessage.addText(String(battler.meta.Info || defaultInfo).trim());
</Before Eval>

This will have the caster be the one to speak the message. I hope. I haven't actually tested this, but it should work.

Perfect! This works exactly as I needed it to, and it's very simple to use to boot.

Thank you so, so much- your help is much appreciated, and as I said, you have been added to the credits. 🙂
Oh right, that's because the closing tag for the line break is also closing the note tag because the parser doesn't know any better. Basically this is what's happening:

<Info: This is a slime.<br>It is green and larger than your average ooze or jelly.>

Unless you want to complicate things quite a bit by editing message core's code, you'll have to decide whether line break or word wrap is more important.

Honestly, I wish Yanfly hadn't done it that way, but that's what we have to work with.


$gameMessage.setPositionType(n); // n = 0 top, 1 middle, 2 bottom

So setting "n" to 0 will cause it to be drawn on the top of the screen.


$gameMessage.setFaceImage(imageName, index);

Where imageName is the name of the image (ie, Actor1, Nature, Monster, etc) and index is which face to use on that index based on its position in the image:

Code:
0 1 2 3
4 5 6 7

Here's an example of a code-generated message box--the parameters used to position the window and show the face are shown in the message itself for clarity:

1ci8QER.png


Edit: Here's a sample of the code from before, edited to position on the top:

Code:
<Before Eval>
var battler = target.isActor() ? target.actor() : target.enemy();
var defaultInfo = "Little is known about this foe.";
$gameMessage.setFaceImage(user._characterName, user._characterIndex);
$gameMessage.setPositionType(0);
$gameMessage.addText(String(battler.meta.Info || defaultInfo).trim());
</Before Eval>

This will have the caster be the one to speak the message. I hope. I haven't actually tested this, but it should work.


Sorry, but maybe you may help me too?..
I am trying to use this plugin and made default rows for 8, for example. Aaaand here I go - all my event textmessages(All of them is 1-2 rows\strings) come for one, the first - with first image. I don't really understand why. I may avoid it by adding new blank strings to all my event messages, but why is it taking text from another messages in the first place?.. Maybe I misunderstood something?..
New lines and new pages can be inserted directly into the message text as \n and \f respectively, e.g.
Code:
$gameMessage.add('One\nTwo\nThree!\fNew\nPage!');
New lines and new pages can be inserted directly into the message text as \n and \f respectively, e.g.
Code:
$gameMessage.add('One\nTwo\nThree!\fNew\nPage!');
Yes, but I only want my dialogue window to be tall and narrow, like a scroll. Always. And don't want to add keys to ALL messages.

Original thread: https://forums.rpgmakerweb.com/threads/libra-tattle-skill.110483/