[SOLVED] RMMZ Changing the party in map

miyanke

Veteran
Veteran
Joined
Dec 2, 2015
Messages
51
Reaction score
4
First Language
Spanish
Primarily Uses
RMMV
Hi everyone,
I'm not sure if this is the place to ask this, if it's not, please move wherever it should be, thanks.

I'd like to build a map (a tavern/inn) where all the party appears, being able to change between them without using the Formation Scene.

To do this I set two pages for each character:
The second page is blank and appears when the character is in the team
1600868866773.png
The first page is filled with the character image and it start if the character is unblocked (switch #2 ON).
1600868987522.png
My problem is with the content of this page, I would be able to check how many characters are in the party (max 4) with a conditional and the script ($gameParty.members().length >= 4), but now I need to open the Formation Scene to change the party and I don't know how to do it.
¿Should I use a script?
I tried to add the character and open the script: SceneManager._scene.commandFormation(); but it doesn't work.

Do you have any other ideas or scripts to make this work?

Thank you in advance.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,617
Reaction score
5,156
First Language
Dutch
Primarily Uses
RMXP

I've moved this thread to MZ Support. Please be sure to post your threads in the correct forum next time. Thank you.

 

Nolonar

Veteran
Veteran
Joined
Feb 18, 2018
Messages
160
Reaction score
232
First Language
French, German
Primarily Uses
RMMZ
The problem with SceneManager._scene.commandFormation() is that SceneManager._scene is currently a Scene_Map, whereas commandFormation() belongs to Scene_Menu, so your game will crash because it's trying to execute a function that doesn't exist yet. Only after the player opens the menu (with Esc or some other key/button) does SceneManager._scene become a Scene_Menu.

Instead you would need to call SceneManager.push(Scene_Menu) first, but the problem is that SceneManager.push() doesn't immediately switch to the new scene. It just signals the SceneManager to switch at the next opportunity. This means that calling SceneManager._scene.commandFormation() will still crash your game, because the current scene is still Scene_Map (until the SceneManager gets to switch the scene).

So you'll need to create a new scene that inherits from Scene_Menu, but launches directly into the formation window instead.

One possible solution would be:
Code:
SceneManager.push(class Scene_Formation extends Scene_Menu {
    start() {
        super.start();
        this.commandFormation();
    }
    createCommandWindow() { /* No command window */ }
    statusWindowRect() {
        const rect = super.statusWindowRect();
        return new Rectangle(0, rect.y, Graphics.boxWidth, rect.height);
    }
    onFormationCancel() { SceneManager.pop(); }
});
This will automatically launch a modified version of the Scene_Menu, which only allows changing formation.

Sorry for the barely readable code. The script event command only supports up to 12 lines of code.
 
Last edited:

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,610
Reaction score
976
First Language
Portuguese - Br
Primarily Uses
RMMV
Hi!
If I get it right, do you say that need to open the formation command to change the party, right?
There is a script call that changes the order of your party members(not add or remove party members):
$gameParty.swapOrder(position1, position2)

Changes the member which is in position 1 to the one of position 2.

maybe this can help too?
 

miyanke

Veteran
Veteran
Joined
Dec 2, 2015
Messages
51
Reaction score
4
First Language
Spanish
Primarily Uses
RMMV
Thank you all.
Hi!
If I get it right, do you say that need to open the formation command to change the party, right?
There is a script call that changes the order of your party members(not add or remove party members):
$gameParty.swapOrder(position1, position2)

Changes the member which is in position 1 to the one of position 2.

maybe this can help too?
No I think that's not a solution, because my first character shouldn't be send off, but second, third and fourth should.

One possible solution would be:
Code:
SceneManager.push(class Scene_Formation extends Scene_Menu {
    start() {
        super.start();
        this.commandFormation();
    }
    createCommandWindow() { /* No command window */ }
    statusWindowRect() {
        const rect = super.statusWindowRect();
        return new Rectangle(0, rect.y, Graphics.boxWidth, rect.height);
    }
    onFormationCancel() { SceneManager.pop(); }
});
This will automatically launch a modified version of the Scene_Menu, which only allows changing formation.

Sorry for the barely readable code. The script event command only supports up to 12 lines of code.
I tried it but it gives me an error. Anyway, I've been thinking that I can't control who left out of the party to push him/her out, so I'm thinking on a text selection, changing the new character with one on the party.

I set 3 variables in a parallel process where V03 is the ID of the member in second place, V04 third place, and V05 in fourth.
1600960252603.png
So when I ask someone to "join the group", and the $gameParty.members().length >= 4 is correct, then the program should ask me who in the team I want to change.
Using Visutella Message Core I created a box with multiple selections where the game reads the ID in the variables:
1600960393625.png
But again I need a script to "force" a hero to leave the team.

I found this Script call and…

1600961247650.png
It WORKS!

By this way, (and using visutella main menu) I can block the Formation page, and the First character can't be moved.

If you have other ideas it would be a pleasure to listen to them.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Officially not a mod anymore. Thanks for the many years!
Thinking if i should post on the classifieds section...
Made another plugin showcase video! :kaojoy:
(Plugins and details inside the description of the YouTube video.) :LZScheeze:
Ami
Castle is my Biggest Fear :kaodes:. I just Managed make Part by Part (like the Entrance only),not the Entire Castle like in the RM Sample...
This video really speaks to me...

Forum statistics

Threads
104,373
Messages
1,005,905
Members
135,894
Latest member
EnriX
Top