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,711
Reaction score
2,823
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,711
Reaction score
2,823
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,711
Reaction score
2,823
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
42,894
Reaction score
14,994
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 Posts

Latest Profile Posts

Run Script Calls & Play Unique Sound Effects With Each Skill & Item | RPG Maker News #113

Let's continue making our game in MZ! Touchfuzzy is... still eventing... though this time we may be working on eventing some tutorial stuff for our players!

I work late on the game so I sleep in then I wake up late so I have to work hard to make up for sleeping in meaning I work late again and sleep in again... what a nasty cycle.
I just had my first real fire. Dad made burgers for lunch and the grill caught fire. He tried to get water but I told him you should never put water on a grease fire. So I got him the fire extinguisher under the sink and we managed to put it out. I can still smell a little of the smoke coming from the patio, but at least it's clearing. It sure was scary though.
was rendering a video and window decided to bsod on me :D fun

Forum statistics

Threads
113,843
Messages
1,077,906
Members
147,920
Latest member
Gortax
Top