UmbrotheUmbreon

Legendary Umbreon
Member
Joined
Jan 25, 2015
Messages
25
Reaction score
2
First Language
English
Primarily Uses
RMVX
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.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,755
Reaction score
2,848
First Language
English
Primarily Uses
RMMZ
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());
    }
});
 

UmbrotheUmbreon

Legendary Umbreon
Member
Joined
Jan 25, 2015
Messages
25
Reaction score
2
First Language
English
Primarily Uses
RMVX
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.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,755
Reaction score
2,848
First Language
English
Primarily Uses
RMMZ
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.
 

UmbrotheUmbreon

Legendary Umbreon
Member
Joined
Jan 25, 2015
Messages
25
Reaction score
2
First Language
English
Primarily Uses
RMVX
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)
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,755
Reaction score
2,848
First Language
English
Primarily Uses
RMMZ
For that you'd want to hook in to makeCommandList in Window_MenuCommand.
 

UmbrotheUmbreon

Legendary Umbreon
Member
Joined
Jan 25, 2015
Messages
25
Reaction score
2
First Language
English
Primarily Uses
RMVX
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?
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,391
Reaction score
15,204
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Support. Thank you.

 

UmbrotheUmbreon

Legendary Umbreon
Member
Joined
Jan 25, 2015
Messages
25
Reaction score
2
First Language
English
Primarily Uses
RMVX
Terribly sorry about that. I will do a better job making sure I post in the right forum next time.
 

Latest Threads

Latest Profile Posts

Is it weird that i feel overwhelmed from reading codes that i wrote few months ago? Lol.

I dont even know where to continue!:hsad:
Ami
Gosh,I want to Play this Game Again one more again!

Seeing my Own Character & Kannono Once Again!
Tales_of_the_World_Radiant_Mythology_3_JPN_PSP-Coverart.jpg
I've been a bit to depressed to get work done on the game lately. Don't worry, I'll be okay.
LunarFlareStudios wrote on Solar_Flare's profile.
Hey, my name is Lunar Flare Studios, and you're Solar Flare? That's so weird!

Forum statistics

Threads
115,300
Messages
1,088,737
Members
149,942
Latest member
PepazX
Top