MV Making a Scan skill work

So I've decided to get myself into trouble and dabble with plug ins and such. I'm not particularly smart with these things and this will be my first experience with them. Please be gentle

Anyhoo, I was looking at the plug ins for RPG Maker MV and saw the EnemyBook plug in. I thought about trying to test out how to properly use it and so far I've gotten a basic idea. It works as I thought, but not what I intend for it.

I wanna make a scan feature in the game similar to that of Epic Battle Fantasy 4. You use the scan ability, it adds the stats and such to the bestiary, but only if you scan them. So far the way the plug in is set up, it'll add the monster even if you don't use the scan ability. But that's not what I want it to do. I want it to add to the book only if Scan was used.

The closest I can think to make it work is to use conditional branches in the fight to check if scan was used. if yes, do nothing. If not, use the plug in command to remove the monster from the book when the battle ends (also adding a switch to turn off this conditional branch so it doesn't happen every encounter).

However that feels really clunky and if I might add, a bit unnecesarry (I think). If there is an easier way to make this work I'd appreciate the help. If I already have the right idea and just gotta bust out event commands, then that information would also be of good help. Any other questions or information needed I will be happy to answer/provide to help out.
Code:
var _Game_Troop_setup = Game_Troop.prototype.setup;
    Game_Troop.prototype.setup = function(troopId) {
        _Game_Troop_setup.call(this, troopId);
        this.members().forEach(function(enemy) {
            if (enemy.isAppeared()) {
                $gameSystem.addToEnemyBook(enemy.enemyId());
            }
        }, this);
    };

    var _Game_Enemy_appear = Game_Enemy.prototype.appear;
    Game_Enemy.prototype.appear = function() {
        _Game_Enemy_appear.call(this);
        $gameSystem.addToEnemyBook(this._enemyId);
    };

    var _Game_Enemy_transform = Game_Enemy.prototype.transform;
    Game_Enemy.prototype.transform = function(enemyId) {
        _Game_Enemy_transform.call(this, enemyId);
        $gameSystem.addToEnemyBook(enemyId);
    };

Comment these three functions out of the plugin, and just use the plugin command to add them when you want to. For your purposes, have the Scan skill call a common event which just has the addition to the book for each enemy. You can do that with script too:

Code:
$gameTroop.members().forEach(function(enemy) {
    if (enemy.isAppeared()) {
        $gameSystem.addToEnemyBook(enemy.enemyId());
    }
});
Hey, is it working for you now ? Or still not ?
Code:
var _Game_Troop_setup = Game_Troop.prototype.setup;
    Game_Troop.prototype.setup = function(troopId) {
        _Game_Troop_setup.call(this, troopId);
        this.members().forEach(function(enemy) {
            if (enemy.isAppeared()) {
                $gameSystem.addToEnemyBook(enemy.enemyId());
            }
        }, this);
    };

    var _Game_Enemy_appear = Game_Enemy.prototype.appear;
    Game_Enemy.prototype.appear = function() {
        _Game_Enemy_appear.call(this);
        $gameSystem.addToEnemyBook(this._enemyId);
    };

    var _Game_Enemy_transform = Game_Enemy.prototype.transform;
    Game_Enemy.prototype.transform = function(enemyId) {
        _Game_Enemy_transform.call(this, enemyId);
        $gameSystem.addToEnemyBook(enemyId);
    };

Comment these three functions out of the plugin, and just use the plugin command to add them when you want to. For your purposes, have the Scan skill call a common event which just has the addition to the book for each enemy. You can do that with script too:

Code:
$gameTroop.members().forEach(function(enemy) {
    if (enemy.isAppeared()) {
        $gameSystem.addToEnemyBook(enemy.enemyId());
    }
});

This worked out as I intended! Once I modified the common event it began to put the troop in. It should work on all monsters since the scope of the skill was set to all, but if it turns out that doesn't work I can just revisit this.

The only thing I would wanna do now is have it so that you can view the stats of the monster during the fight, without using a turn.
This worked out as I intended! Once I modified the common event it began to put the troop in. It should work on all monsters since the scope of the skill was set to all, but if it turns out that doesn't work I can just revisit this.

The only thing I would wanna do now is have it so that you can view the stats of the monster during the fight, without using a turn.
That's a little trickier as it requires creating new windows in Scene_Battle to display that information and coding in a trigger to show/hide it. Not too difficult but you do need a fair bit of Javascript knowledge.
That's a little trickier as it requires creating new windows in Scene_Battle to display that information and coding in a trigger to show/hide it. Not too difficult but you do need a fair bit of Javascript knowledge.

Ah boo.....That's a bit more scary for me at the moment. Now a new question I have is, how do I add a command to the pause menu to look open the enemy book (labeled Bestiary)
For that you'd want to hook in to makeCommandList in Window_MenuCommand.
I'm sorry, I don't mean to be trouble but I'm having difficulty figuring out where to find that. Is that a separate plug in I need to manually add to my game, or is there a spot in the program (files or in the program itself) I modify to do this?
Moved to: Plugin Support
Terribly sorry about that. I will do a better job making sure I post in the right forum next time.
If anyone is still here anyone know if theres a way to make the Scouter option? freezing everything to be able to scan?

Original thread: https://forums.rpgmakerweb.com/threads/making-a-scan-skill-work.137420/