MV Allowing some, but not all actors to follow the player

Hello fellow game-makers,
I want to have different systems in my game, including pets. I would like for the pets to follow the player, but not the party members. Any idea as to how to do this? Eventing is preferred, but I'd use a plug-in, too.
Thanks in advance!
You could event it with turn 0 troop events that add actors to the party and autorun map events that take them back out so they don't appear as followers.

This would mess with the functionality in the menu for equipping/skills/etc.

Have you Googled for any kind of plugin to define the followers?

You can save this as a .js file and add it as a plugin. It should cause you to only have followers if you give that actor a <pet> notetag.
Code:
Game_Followers.prototype.initialize = function() {
    this._visible = $dataSystem.optFollowers;
    this._gathering = false;
    this._data = [];
    for (var i = 1; i < $gameParty.maxBattleMembers(); i++) {
        if ($dataActors[$gameParty.battleMembers()[i].actorId()].meta["pet"])
            this._data.push(new Game_Follower(i));
    }
};
You could event it with turn 0 troop events that add actors to the party and autorun map events that take them back out so they don't appear as followers.

This would mess with the functionality in the menu for equipping/skills/etc.

Have you Googled for any kind of plugin to define the followers?

You can save this as a .js file and add it as a plugin. It should cause you to only have followers if you give that actor a <pet> notetag.
Code:
Game_Followers.prototype.initialize = function() {
    this._visible = $dataSystem.optFollowers;
    this._gathering = false;
    this._data = [];
    for (var i = 1; i < $gameParty.maxBattleMembers(); i++) {
        if ($dataActors[$gameParty.battleMembers()[i].actorId()].meta["pet"])
            this._data.push(new Game_Follower(i));
    }
};
Wow! This looks amazing! I'll test it out and see how it goes! Thank you =]

Edit: so, here's the errors I got when I tried this with the current plugins I have:
Spoiler
1659041826507.png
I put your plugin all the way at the bottom of the list, and it gave me the same error. So, I then put it in a new save, and it give me this error:
Spoiler
1659042171890.png
Edit: so, here's the errors I got when I tried this with the current plugins I have:
That's...an odd error. I don't see how that could be referencing an undefined actor without there being other bugs in your game.

But it should be an easy fix, just change the line that starts with if:

Code:
if ($gameParty.battleMembers()[i] && $dataActors[$gameParty.battleMembers()[i].actorId()].meta["pet"])
That's...an odd error. I don't see how that could be referencing an undefined actor without there being other bugs in your game.

But it should be an easy fix, just change the line that starts with if:

Code:
if ($gameParty.battleMembers()[i] && $dataActors[$gameParty.battleMembers()[i].actorId()].meta["pet"])
So, now it runs... but nothing is shown following me.
Spoiler: Screenshots
1659068576583.png

1659068599435.png
1659068619795.png
Sorry. I must be doing something wrong with my code, but I don't see what. Have you searched to see if there are existing plugins to help?
I have been looking around, and while there are some pretty cool Follower plugins, I don't see any that allow you to pick and choose which actors follow you visually. It's super unfortunate.

Edit: is it possible (I don't know, so I'm genuinely asking) that the issue could be the "battlemembers" portion in the code, as I JUST want the pets to follow, and not engage in combat at all?

Original thread: https://forums.rpgmakerweb.com/threads/allowing-some-but-not-all-actors-to-follow-the-player.149884/