Hime party manager

Mkingdom

Veteran
Veteran
Joined
Nov 1, 2019
Messages
180
Reaction score
13
First Language
English
Primarily Uses
RMMV
I looked at the plugin and there isn't an easy to scroll between parties.
One way is this
Code:
var parties = $gameParties.parties();
var index = parties.indexOf($gameParty);
var newIndex = index + 1;
if (newIndex >= parties.length) {
   newIndex = 0;
}
var newPartyId = parties[newIndex].id;
Party.switch(newPartyId);
What this code does is first you grab all the parties in the game, which gives something like this

Code:
[Party1, Party2, Party3]
Then you figure out the position of the current party which is $gameParty.
Assuming we're currently Party 3, it will give you 2, because the index starts with 0 instead of 1

So now you have the index of the current party. You want to find the next party, which we'll assume is just index + 1

But because we're already the last party, we need to make sure we wrap around to the first in the list, which is what the condition check is for.

Finally, now you have the index of the party, you grab the party from the list, get the ID, and then call Party.switch as usual.

It's similar logic if you want to scroll backwards

Code:
var parties = $gameParties.parties();
var index = parties.indexOf($gameParty);
var newIndex = index - 1;
if (newIndex < 0) {
   newIndex = parties.length - 1;
}
var newPartyId = parties[newIndex].id;
Party.switch(newPartyId);
Now if you bind one to page up and the other to page down, now you should be able to scroll through all of your parties.
Yeah it works, the only problem is that it works too well. lol. It switches between parties too fast which doesn't allow the player to easily control which party they want to switch to. They'll get the party they want by luck. Secondly there is a party I don't want them to switch to. Maybe what would solve the problem is a 30 or 60 frame wait time between switch. Let me see if that works.

Report: Yeah it works great with a 60 frame wait time between switches.
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

I'm back from my visit to my family. Was really great to see them again after a year even if I had to get tested for covid for the visit.
Sometimes... I do absolutely genius things... But then I counteract that by spending all day trying to figure out what's wrong with my event creator... Only to learn I commented out some lines in MV... Not even in my plugin. This must be why villains "true heroes" don't win in the end. :kaoswt:
Procrastination at it's finest.
annnnd after 2 days lol... and I still feel I need to work out a few kinks

Forum statistics

Threads
104,263
Messages
1,005,063
Members
135,773
Latest member
Krin92
Top