RPGMaker MV Change Party Member Order via Event

Status
Not open for further replies.

ACECORP

Founder & Entrepreneur
Veteran
Joined
Apr 6, 2016
Messages
253
Reaction score
39
First Language
English
Primarily Uses
RMMV
How can I programmatically change the order of my party members from an event, when I pick up a new party member.


My party has 3 members, and instead of my new party member taking the 4th slot, I want to programatically swap him out with the second party member so that the second party member takes the 4th slot, and the new party member takes the 2nd slot. 


I believe this can be done in VX using the following command:


$game_party.swap(1, $game_actors[3].index)



However, when I try and execute this script in RPGMaker MV to swap the position of party members, I get the error shown in the screen shot below.


If there is a different way to programmatically swap party member positions, that's fine too, I just need to know what the command or process is to do it programatically.


Screen Shot 2016-06-18 at 2.58.46 PM.png
 
Last edited by a moderator:

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
Hi!


Try this to change the order of the party.


$gameParty.swapOrder(index1,index2)


To return the position of an actor in the party you can try:


$gameParty.members().indexOf($gameActors.actor(index))


So as an example, to make actor 2 the party leader:


$gameParty.swapOrder(0,$gameParty.members().indexOf($gameActors.actor(2)))


Or to swap actor 2 and 4 places:

Code:
var a, b
a = $gameParty.members().indexOf($gameActors.actor(2));
b = $gameParty.members().indexOf($gameActors.actor(4));
$gameParty.swapOrder(a, b)
 
Last edited by a moderator:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,517
Reaction score
14,248
First Language
English
Primarily Uses
RMVXA
Can you remove everyone from the party, then put them in the order you want? That's what I've been doing in ACE to force things into certain orders, and it works fine there, and I imagine it should work in MV as well.
 

ACECORP

Founder & Entrepreneur
Veteran
Joined
Apr 6, 2016
Messages
253
Reaction score
39
First Language
English
Primarily Uses
RMMV
Thanks Astfgl66 that's exactly what I was looking for!


bgillisp, I actually used your method an hour ago to get around my immediate roadblock. It works great for the specific road block I needed to get around today, but later on in my game, there are certain things I will be doing that require me to code it and track party members, positions and locations. So Astfgl66's answer is what I was really looking for.


However, I will use your suggestion (as I discovered) for the simple stuff where I don't need to track positions and react dynamically to various changes in party formation the game player may perform themselves. 
 
Last edited by a moderator:

Venex

Villager
Member
Joined
Nov 6, 2015
Messages
6
Reaction score
0
First Language
German
I've tried using

$gameParty.swapOrder(1, $gameParty.members().indexOf($gameActors.actor(2)));

to place actor 2 on party position 2.

My game stops running without the party members (completely) being switched out.

I tested the script in the troops tab of the database and I've tried using the integrated battle test function:

Database.png

Here's the party configuration before starting the battle:

actor1.png actor2.png actor3.png actor4.png

This is where the the game stops running (right at the beginning of the battle):

In-Battle.png

Actor 2 ("Milana") should be placed on party member position 2. In this case I'd like Agios to switch with Milana.

But, what happened here is:
Actor 1 ("Extro") was being pushed to party member position 2, position 1 is now empty. Agios just disappeared. Somehow the enemy already started using the first skill, which I do not understand and then it just stops.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,517
Reaction score
14,248
First Language
English
Primarily Uses
RMVXA

Venex, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.


Please create a new thread, as this one is over a year old, and there is no guarantee that anyone on this thread will see this and be able to help.
 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts


My only regret is the portal mirror effect is too subtle to show up in these GIFs. It probably just needs more sparkles. :LZSwink:
Microsoft: Hey, let's waste money advertising the Xbox Series X when nobody has any in stock, we don't seem to be making more, we aren't taking preorders and you can't get on a waiting list. BEST. IDEA. EVER.
So I'm practicing ITC with a spirit box, and decide to try to contact my deceased soulmate. It actually gave me multiple identifiers. Me, still a bit skeptical, asked aloud "Fine but does he still love me?" and the box spoke and printed the word "Forever" at the same time. Been a mess of tears since. :kaocry:
Been scratching away at my game and making progress, but just had a revelation. I'm working in full screen and adjusting all my pictures accordingly, but will they resize if someone's screen is smaller?? I hope this doesn't turn out to be a problem later.

Forum statistics

Threads
105,635
Messages
1,015,170
Members
137,307
Latest member
MrKaito
Top