$gameParty issue

I'm trying to modify Game_Followers.prototype.initialize. For the modifications I want to make, I need to reference $gameParty.

If I use console.log($gameParty), it displays all its data including the actors, which I need:

correct.png

But if I use $gameParty._actors, I get an empty array:

empty array.png

That means that while I can print $gameParty to the console I cannot actually use its information.

I assume this has something to do with loading, but why then am I able to print out $gameParty but not actually use its information?

I've also tried $gameParty.members(), $gameParty.allMembers(), $gameParty.battleMembers() but I get empty arrays again.

Any help would be greatly appreciated.
When exactly are you trying to access the Game_Party object? Also "$gameParty._actors" is a private member (hence the _) you shouldn't really be accessing it outside of the Game_Party class that way. If you could be a bit more specific with what you are trying to do, it would help us greatly in determining a way for you to get the information you need.
When exactly are you trying to access the Game_Party object? Also "$gameParty._actors" is a private member (hence the _) you shouldn't really be accessing it outside of the Game_Party class that way. If you could be a bit more specific with what you are trying to do, it would help us greatly in determining a way for you to get the information you need.
In the method Game_Followers.prototype.initialize. I did try $gameParty.members(), $gameParty.allMembers(), $gameParty.battleMembers() which return ._actors in some way or another, but those all printed out empty arrays.

Basically what I'm trying to do is use $gameParty to get the actor IDs of the members in the party, then use that to look into $dataActors and check if they have a certain notetag. If they do, they aren't added to the followers.
The way Game_Followers and Game_Follower work seems to be the array, and follower objects are initialized just as the Game_Player object is initialized. This is after the Game_Party object is initialized but not before the party is filled it seems. If you just need to see if the party members aren't added, an alternative way would be to just modify the "Game_Follower.prototype.isVisible" function. You can use the actor method of that function to get the actor object of that follower, and then use that actor object to get the database object of the actor to check for the notetag, and if it has the note tag then return false. You will need to check if the actor object of the game follower isn't undefined, as it seems it isn't set on game start right away. Doing it this way will still create the follower objects, but the follower wouldn't be visible.
You should be able to use $gameParty.members


However, it doesn't work like you think it does. That simply creates 4 followers, and says they are going to be linked to the first, second, third and fourth party members. It's the Game_Follower class that determines which actor is represented in that slot. As your party members change around the followers change automatically. If you do it the way you seem to be planning, you would have to monitor for when the party is adjusted in any way - formation changed, members added, members removed, and then figure out how you're going to change your followers.


I suggest you create a new Game_Party method that gives you a 'followers' list. It should do a select on allMembers() to only include those who don't have the note tag. Then in Game_Follower, change the actor method to look at the new 'followers' list in Game_Party, rather than battleMembers().
Brilliant. Thanks you two! I was able to do it with this code:

Spoiler
Code:
    Game_Party.prototype.allFollowers = function () {        return this.allMembers().filter(function (actor) {            return !$dataActors[actor.actorId()].meta.no_follow;        });    };    Game_Follower.prototype.actor = function () {        return $gameParty.allFollowers()[this._memberIndex];    };
So this lets you add party members who will not be in battle? Nice! It gives me an idea for something else as well ...

Original thread: https://forums.rpgmakerweb.com/threads/gameparty-issue.54488/