blakwhiteknight

Veteran
Veteran
Joined
Jun 30, 2013
Messages
32
Reaction score
7
First Language
English
Primarily Uses
I have been searching around and I can't seem to find a solution to this, at least for MV. Basically, in the game I am creating, there are party members who can do various actions (e.g. one can break boulders, another has a light source, another moves fast, another can walk on ice tiles, etc.). You would need to rotate the party formation and have a certain member be the leader in order to do a certain action. However, I would like to rotate the party formation with the use of a button (e.g. the "S" key).

So for example, default party is structured like so at the start:
[A, B, C, D]

When pressing the "S" key, party structure becomes:
[B, C, D, A]

And likewise, if you press "S" again, party structure will be:
[C, D, A, B]

And so on, and so forth.

I tried looking for a plugin that could help out but PH Swap Party hasn't been working for me even when turning off my other plugins, and I've only seen scripts of this calibre be VX Ace only, so I tried thinking of scripting it myself instead.

So far, I thought of:
rotatepartyformationwithbutton.PNG

Then I'm kind of stuck on how to do the party rotation part. I would very much appreciate it if someone can help out.
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,870
Reaction score
699
First Language
German
Primarily Uses
RMMZ
This Thread has a list of many Scriptcommands to rebuild Event Commands but more flexible.

This seem to work on my end, but it is with the Page Up Button.
partyrotator15465652.png
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
3,133
Reaction score
2,401
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi there!
In addition to what @Bex said, don't know if you can run into any problems using the "removeActor" function. But another solution would be something similar to what Bex did, but on the script call part you would do this:

JavaScript:
const firstActor = $gameParty._actors.shift()
$gameParty._actors.push(firstActor)
$gamePlayer.refresh() // You need to call that.

The proper function to do this, the same way the menu does, is that one:

JavaScript:
Game_Party.prototype.swapOrder = function(index1, index2) {
    const temp = this._actors[index1];
    this._actors[index1] = this._actors[index2];
    this._actors[index2] = temp;
    $gamePlayer.refresh();
};

I can see that it did not remove any actor id on the process, so don't know if either my solution or the Bex one could lead you into any trouble.
 

RianQuenlin

Veteran
Veteran
Joined
Jul 28, 2022
Messages
100
Reaction score
68
First Language
English
Primarily Uses
N/A
.
 
Last edited:

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,870
Reaction score
699
First Language
German
Primarily Uses
RMMZ
The removing and adding of the Actor is directly executed after each other without any Waits or Page Changes, therfor it should not be possible to trigger a Game Over.
Edit2: Just tested it, no Game Over, works seemingly flawless.

What Bug i could think of but did not occur, is that the Event Command Add Actor, got a Box for "Initialise" , so a Char starts from Level 1 again, i dont know script equivalent for that, but thanks to
the PC gods the Script Command does add the Actor back like it was and does not initialise it again and again to LV1.

Edit: If the Mage is Dead, she could still be Selected as Map Char and run around.
That could be fixed with some more code Logic if needed.
 
Last edited:

blakwhiteknight

Veteran
Veteran
Joined
Jun 30, 2013
Messages
32
Reaction score
7
First Language
English
Primarily Uses
@Bex - I'm pretty sure I've done it correctly as you've instructed but nothing happens when I press the PageUp key. Could a plugin be perhaps interfering somehow? That being said, thank you very much for the Script Call List! Definitely bookmarking and looking through that.
1659168896281.png

@Eliaquim - For your method, I assume it's a conditional branch then insert the first Javascript code (const firstActor etc.) as a Script Call?

@RianQuenlin - I actually won't be having battles at all in this project: it's all puzzles and you die if your HP goes to zero from obstacles such as spikes in the floor and poisonous gas, so...would that make things more difficult or easier? (Or even neither?)
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,870
Reaction score
699
First Language
German
Primarily Uses
RMMZ
Yes it could. No problem, you are Welcome.

Trouble shoot guesses:
Page Up Key = Q Button on Keyboard
Page Down Key = W Button on Keyboard
Normaly the Page Up Button should also work.

- Make sure no other Events or Common Events with trigger "Autorun" are active.
- Did you test it on the Correct Map, since you rebuild it as Map Event and not directly into Common Event.
- I would recomment testing it in a fresh Project, to exclude Project stuff interfering.
- Keyboard Button Plugins installed?
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
3,133
Reaction score
2,401
First Language
Portuguese - Br
Primarily Uses
RMMZ
@Bex - I'm pretty sure I've done it correctly as you've instructed but nothing happens when I press the PageUp key. Could a plugin be perhaps interfering somehow? That being said, thank you very much for the Script Call List! Definitely bookmarking and looking through that.
View attachment 236147

@Eliaquim - For your method, I assume it's a conditional branch then insert the first Javascript code (const firstActor etc.) as a Script Call?

@RianQuenlin - I actually won't be having battles at all in this project: it's all puzzles and you die if your HP goes to zero from obstacles such as spikes in the floor and poisonous gas, so...would that make things more difficult or easier? (Or even neither?)
On my side you just need that:

if page up is pressed down
copy and paste this as a script call:
const firstActor = $gameParty._actors.shift()
$gameParty._actors.push(firstActor)
$gamePlayer.refresh() // You need to call that.

And maybe add a wait command of 10 frames, so the event does not repeat too fast.

Also, maybe the Page Up button is not working because it is detecting by pressing(holding for an amount of time) instead of triggered.
 
  • Like
Reactions: Bex

siguren

Veteran
Veteran
Joined
May 21, 2017
Messages
100
Reaction score
109
First Language
Japanese
Primarily Uses
RMMZ

I have created a plugin for MZ in the past with the same functionality.
It is possible to port this plugin to MV, so please be patient.
 

blakwhiteknight

Veteran
Veteran
Joined
Jun 30, 2013
Messages
32
Reaction score
7
First Language
English
Primarily Uses
@Bex - Just as you responded, I actually found the culprit as to why it didn't work - a plugin (YEP Party System). Turned it off, did input with the S key in a common event, and it wound up working. Thanks a lot again for the help!

Though just wondering - how would this method work if I wanted to assign say the A key to shuffle the party formation in the reverse order?
So if Key1 (S) is pressed, then order goes from A, B, C, D ---> B, C, D, A.
But when Key2 (A) is pressed, order goes from A, B, C, D ---> D, A, B, C.

@Eliaquim - I was able to make Bex's method work after turning off one of Yanfly's plugins. But thank you very much for your help regardless!

@siguren - While I've found out what was wrong on my end, that plugin would be amazing to see finished for MV: especially as I also wanted the A key to shuffle the party in reverse order. Take your time with it though. :)
 
Last edited:

rpgLord69

Veteran
Veteran
Joined
Oct 23, 2021
Messages
327
Reaction score
301
First Language
Finnish
Primarily Uses
RMMZ
Though just wondering - how would this method work if I wanted to assign say the A key to shuffle the party formation in the reverse order?
So if Key1 (S) is pressed, then order goes from A, B, C, D ---> B, C, D, A.
But when Key2 (A) is pressed, order goes from A, B, C, D ---> D, A, B, C.

Don't you just run the remove actor / add actor stuff three times?
 
  • Like
Reactions: Bex

blakwhiteknight

Veteran
Veteran
Joined
Jun 30, 2013
Messages
32
Reaction score
7
First Language
English
Primarily Uses
Don't you just run the remove actor / add actor stuff three times?
Tried it out before as a Common Event but I wound up getting an error:1659173239455.png

I could be implementing it wrong though. Here's what it looks like in the Common Event:
1659173306411.png
1659173352447.png
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,870
Reaction score
699
First Language
German
Primarily Uses
RMMZ
For the reverse change we have to check how many Party Members are in the Party.
Here a example for 4 Member Party, you have to make the other cases yourself, else it would not have fit the Picture.
If you run in trouble, you can get further help with this.
reversepartychange065465.png
 

rpgLord69

Veteran
Veteran
Joined
Oct 23, 2021
Messages
327
Reaction score
301
First Language
Finnish
Primarily Uses
RMMZ
Do you need 3 variables, because when you remove the first actor then the next becomes party member 1, right? And you can just use the same variable (edit: use the same command that gets the actor id of party member 1 to that same variable).
 
Last edited:

RianQuenlin

Veteran
Veteran
Joined
Jul 28, 2022
Messages
100
Reaction score
68
First Language
English
Primarily Uses
N/A
.
 
Last edited:

blakwhiteknight

Veteran
Veteran
Joined
Jun 30, 2013
Messages
32
Reaction score
7
First Language
English
Primarily Uses
@Bex - I now have the A and S keys successfully shuffling the party leader back and forth. Again, thank you kindly for everything. :D
 
  • Like
Reactions: Bex

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,870
Reaction score
699
First Language
German
Primarily Uses
RMMZ
Do you need 3 variables
In this setup, yes. Edit: Now while thinking more about it, iam not sure anymore.

@Bex - I now have the A and S keys successfully shuffling the party leader back and forth. Again, thank you kindly for everything. :D
Good to hear that it helped you.
In case you need adjustments, let us know in the Thread.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,034
Reaction score
4,856
First Language
English
Primarily Uses
RMMV
Just as a quick note, another method for this without having to worry about the accidental game over stuff is to just use the built-in swapOrder() method.
 
  • Like
Reactions: Bex

blakwhiteknight

Veteran
Veteran
Joined
Jun 30, 2013
Messages
32
Reaction score
7
First Language
English
Primarily Uses

Latest Threads

Latest Profile Posts

1675350575605.png
If i had to make a game cover, this would probaby be it :kaoslp:
Useless trivia time:
Today I found out that the masks of comedy and tragedy common to classical theatre are named Thalia and Melpomene (respectively)
the_more_you_know_nbc-1670292848.gif
aliceFranklin.png

I have no idea why I made a character for a story I'm not even working on yet... I've been told she wants to be build a snow man. :kaoswt:

Anyway,

...continuing work on that game in the hopes of needing her one day. :LZSwink:
Yesterday brought some interesting weather. As I was about to get off the bus, rain turned into an ice storm and then as I entered my workplace, changed to heavy snow.
I don't remember when it was the last time it rained ice.
Shaz wrote on Zeriab's profile.
You're stealing my thunder!

1675319487521.png

Forum statistics

Threads
128,428
Messages
1,194,496
Members
168,976
Latest member
velocino007
Top