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,522
Reaction score
14,255
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
20
Reaction score
2
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,522
Reaction score
14,255
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

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,018
Members
137,563
Latest member
MinyakaAeon
Top