[Request] Scan/Libra ability.

Good Morning.


I've looked around and had no such luck, I've also attempted this through events and failed. I am in need of an ability that reveals a single targeted enemy's HP and MP during battle. I'd imagine it look like so:


Monster Name:


HP: 400/700


MP: 20/20


I don't mind if it's done through the regular message box during battle. Any additional info through the ability is welcomed: Status resistance, Weaknesses, etc


Thank you for hearing me out,


Have an awesome day.
Try this, Yanfly figured something out awhile back http://yanfly.moe/2015/12/02/tips-tricks-libra/
Good Morning.


I've looked around and had no such luck, I've also attempted this through events and failed. I am in need of an ability that reveals a single targeted enemy's HP and MP during battle. I'd imagine it look like so:


Monster Name:


HP: 400/700


MP: 20/20


I don't mind if it's done through the regular message box during battle. Any additional info through the ability is welcomed: Status resistance, Weaknesses, etc



This sounded like an easy enough script, and it was.


I really love the new engine and plugin environment.  I also love simple scripts and making the most of the default game designer.  So to those ends, here is a little plugin which will facilitate the creation of a "scan" skill.


The plugin help contains instructions but the basic idea is that once installed, this plugin will allow slash commands in a text message window to display information about the last enemy affected by a scan-skill.  All you have to do is put the <scan_skill> tag in the skill's note box and then create a common event to show the scan info.  You also will want to create an empty state to apply for the turn to avoid the "skill had no effect" message during battle.  This script makes all of the enemy's direct properties available via a slash command so you can show any primary parameter value you want.  States and other extended values would take some additional code and thought as to how to access them via the slash command structure.


Anyway, give this a go and see if it suits your needs.  If all goes well I'll add this to my collection of simple scripts.

Spoiler
Code:
//=============================================================================
// ScanEnemy.js
//=============================================================================

/*:
 * @plugindesc (v1.0.0) Allows the creation of "scan/libra" skills with simple note tags and text messages.
 * @author Reedo
 * @version 0.1.0 (beta)
 * @license MIT
 *
 * @help
 *
 * This plugin does not use commands or parameters.
 * 
 * Place the tag <scan_skill> in an skill's note box to enable enemy scanning for the skill.
 *
 * You can then create text message event commands which use the \scan[param] slash command
 * to insert enemy parameter values into the message text.  Param can be one of:
 *  name
 *  hp
 *  mhp
 *  mp
 *  mmp
 *  atk
 *  def
 * ...etc.  Basically any property on the enemy.
 *
 * To create the Scan skill, first create a new Common Event to display the scan info.
 * The text message in this common event might look like:
 *    Enemy: \scan[name]
 *    HP: \scan[hp]/\scan[mhp]   ATK: \scan[atk]
 *    MP: \scan[mp]/\scan[mmp]   DEF: \scan[def]
 * This would show the enemy name along with HP, MP and attack and defense values.
 * Next, create an empty State called "Scanned" which expires after 1 action. The purpose
 * of this is to apply some effect to the enemy to avoid the "...had no effect" message during combat.
 * Now create your skill, add the Common Event effect and the Scanned effect and you're ready to go!
 */

//Main Script
(function() {
	var scanTarget;
	var scanTargetName;

	var _Game_Action_Apply = Game_Action.prototype.apply;
	Game_Action.prototype.apply = function(target) {
		_Game_Action_Apply.call(this, target);
		if (this._item.object().meta.scan_skill) {
			scanTarget = target;
			scanTargetName = target.name();
		}
	};

	var _Window_Base_ConvertEscapeCharacters = Window_Base.prototype.convertEscapeCharacters;
    Window_Base.prototype.convertEscapeCharacters = function (text) {
        text = _Window_Base_ConvertEscapeCharacters.call(this, text);
		if (scanTarget) {
			text = text.replace(/\x1bscan\[([A-Za-z0-9]+)\]/gi, function () {
				var argString = String(arguments[1]);
				if (argString === 'name') { return scanTargetName; }
				var itemName = scanTarget[argString];
				return (itemName) ? itemName : "<invalid>";
			}.bind(this));
		}
        return text;
    };
})();
Absolutely AWESOME. Works great! For the state, I just have the common event remove that state from all enemies after the scan message.


Thank you so very much.
Glad its working for you.  Does it suit your needs?  Or should we do something about states?  I'm still not sure how best to show state information since it could affect many different things, but if you wanted to discuss trying to add it I'd be open to that.
Everything is perfectly fine, thank you!
Wow, this is just what I've been looking for!


Is it also possible to have special attacks, elemental rates etc. revealed?


Could the reveal also be gradual, so you need several Scan-uses to get all the information? 


Could the Scan be specifically resisted (e.g. by bosses)? 


And is there a way to let the game remember which enemy was already "analyzed", so that you won't have to use this skill on the same enemy twice?


Maybe using the MonsterBook plugin?


I have no experience in scripting, so I don't know if my questions are ridiculous ^^"


Anyway, thank you for your answer and have a great day! : )

Original thread: https://forums.rpgmakerweb.com/threads/request-scan-libra-ability.59395/