recoculous

Veteran
Veteran
Joined
Jul 20, 2021
Messages
83
Reaction score
21
First Language
English
Primarily Uses
RMMV
I am using YEP Row Formation, YEP Base Troop Events, YEP Actor Party Switch, SR Dude's Battle End Events, and Aloe Guvner's script to use rows, and to save the row positions. The idea is that rows can change during battle, and it can be frustrating to keep resetting the rows back to the default. Saving the row positions and resetting them with the scripts is helpful. This mostly works for me.

The problem: The main problem is Aloe Guvner's script. I can switch actors during battle, and the script does not reset any actors that are switched out at the end of battle. Is there a way to reset all actors, even if they aren't currently in battle?

For example, Actor 1, 2, 3, 4, and 5 can be in battle starting in the back row. They are all moved to the front row. Actor 1 can be swapped with actor 6 from the reserves. Actor 1 will not be returned to the back row using the script.
 
Last edited:

recoculous

Veteran
Veteran
Joined
Jul 20, 2021
Messages
83
Reaction score
21
First Language
English
Primarily Uses
RMMV
My guess is that there are no easy solutions to this problem, so I added a plugin request.

The Actor Party Switch plugin seems to cause problems for the normal solution.

If I am wrong, let me know. For now my plan is just to stop rows from changing during battle, which is disappointing.
 

eomereolsson

Veteran
Veteran
Joined
Sep 29, 2021
Messages
543
Reaction score
461
First Language
German
Primarily Uses
RMMV
The problem: The main problem is Aloe Guvner's script. I can switch actors during battle, and the script does not reset any actors that are switched out at the end of battle. Is there a way to reset all actors, even if they aren't currently in battle?
That depends a bit on how exactly that actor switching works. Because as far as I can tell Aloe Guvner's setup should already reset all party members - whether they are in battle or not. So maybe the plugin you use for switching does something weird?
Alternatively, are you executing that event while still in battle? Because the script Aloe Guvner provided acts on all $gameParty.members(), which will be all members, unless you are in combat. In that case $gameParty.members() will return only the actors actually currently in battle. In that case I recommend trying out $gameParty.allMembers() instead.
 

recoculous

Veteran
Veteran
Joined
Jul 20, 2021
Messages
83
Reaction score
21
First Language
English
Primarily Uses
RMMV
That depends a bit on how exactly that actor switching works. Because as far as I can tell Aloe Guvner's setup should already reset all party members - whether they are in battle or not. So maybe the plugin you use for switching does something weird?
Alternatively, are you executing that event while still in battle? Because the script Aloe Guvner provided acts on all $gameParty.members(), which will be all members, unless you are in combat. In that case $gameParty.members() will return only the actors actually currently in battle. In that case I recommend trying out $gameParty.allMembers() instead.
Edit (8-29-2022): @eomereolsson

There is still a problem. Actors 2-10 were all in row 2 (the back row). Actor 1 was in row 1 (the front row). I switched out actor 1 during the battle. After the battle, the actor in the first position is in row 1.

The variables are saved to slots 1 - 10 for the current actor formation, and it just assumes that the actor in a position will be the same actor. It does not save info for every unique actor slot, so I don't know how this script can work for actor switching.
 
Last edited:

eomereolsson

Veteran
Veteran
Joined
Sep 29, 2021
Messages
543
Reaction score
461
First Language
German
Primarily Uses
RMMV
Huh, didn't think of that. Aloe Guvner's approach relies on the order of the members not changing. With actors switching mid-battle, of course they do just that and the assignment of actors to game variables is no longer correct. But that should also be a pretty easy fix. Instead of using game variables, we can just slap a new property onto the actors and be done with it.
So you would end up with something like this for the pre-battle event:
JavaScript:
$gameParty.allMembers().forEach(actor => actor._preCombatRow = actor.row());

And in the post-combat event we can reference that property again:
JavaScript:
$gameParty.allMembers().forEach(actor => actor.setRow(actor._preCombatRow));
 

recoculous

Veteran
Veteran
Joined
Jul 20, 2021
Messages
83
Reaction score
21
First Language
English
Primarily Uses
RMMV
Huh, didn't think of that. Aloe Guvner's approach relies on the order of the members not changing. With actors switching mid-battle, of course they do just that and the assignment of actors to game variables is no longer correct. But that should also be a pretty easy fix. Instead of using game variables, we can just slap a new property onto the actors and be done with it.
So you would end up with something like this for the pre-battle event:
JavaScript:
$gameParty.allMembers().forEach(actor => actor._preCombatRow = actor.row());

And in the post-combat event we can reference that property again:
JavaScript:
$gameParty.allMembers().forEach(actor => actor.setRow(actor._preCombatRow));
This isn't working for me. Do I need to do anything else?

Edit: Never mind! I think it works! I just made a mistake when trying it out. Thanks!
 
Last edited:

eomereolsson

Veteran
Veteran
Joined
Sep 29, 2021
Messages
543
Reaction score
461
First Language
German
Primarily Uses
RMMV
Huh, that is weird. I just set up a small test project and confirmed the script commands I provided work as intended for me. No need to do anything extra. Just execute the first script before combat and the second one afterwards. Can you be more specific about what isn't working? Can you share screenshots of your exact event setup?
 

recoculous

Veteran
Veteran
Joined
Jul 20, 2021
Messages
83
Reaction score
21
First Language
English
Primarily Uses
RMMV
Huh, that is weird. I just set up a small test project and confirmed the script commands I provided work as intended for me. No need to do anything extra. Just execute the first script before combat and the second one afterwards. Can you be more specific about what isn't working? Can you share screenshots of your exact event setup?

I think I just made a mistake and I think it works.

However, I think it might have a strange interaction with
Code:
$gameTroop.updateRows();
, which automatically moves row 2 to row 1 when no one is in row 1. It seems like characters are now just changing rows a lot in a way I don't understand.

"This is a special command. This will check each row in the party. If a row
is empty and/or doesn't have any alive members, all the remaining members
behind that row will move forward one row until all the empty rows are gone." (Explained here).


Edit: I disabled the scripts and I am having a problem with actors changing rows in a seemingly random way. If I use an old save file, there is no problem. The added actor properties seem to be causing a problem.
 
Last edited:

eomereolsson

Veteran
Veteran
Joined
Sep 29, 2021
Messages
543
Reaction score
461
First Language
German
Primarily Uses
RMMV
However, I think it might have a strange interaction with
It should not interact in any way.
Edit: I disabled the scripts and I am still having a problem with actors changing rows in a seemingly random way.
I believe this is because this is its own separate issue. As far as I can tell $gameTroop.updateRows(); should not move any actors at all, but rather the enemies. To move actors you would need the command $gameParty.updateRows();. If a call to $gameTroop causes actors to be moved you have some plugin somewhere making it so that $gameTroop.aliveMembers() also returns actors. That is not the expected default behavior.

Edit:
The added actor properties seem to be causing a problem.
If you believe the added property is causing trouble you can simply rename it to something else. The property solely existing will not cause any problems. The only probable cause would be another plugin using the same property.
 
Last edited:

recoculous

Veteran
Veteran
Joined
Jul 20, 2021
Messages
83
Reaction score
21
First Language
English
Primarily Uses
RMMV
It should not interact in any way.

I believe this is because this is its own separate issue. As far as I can tell $gameTroop.updateRows(); should not move any actors at all, but rather the enemies. To move actors you would need the command $gameParty.updateRows();. If a call to $gameTroop causes actors to be moved you have some plugin somewhere making it so that $gameTroop.aliveMembers() also returns actors. That is not the expected default behavior.

Edit:

If you believe the added property is causing trouble you can simply rename it to something else. The property solely existing will not cause any problems. The only probable cause would be another plugin using the same property.
Yes, I mentioned the wrong update rows code.

I am now trying these scripts:

pre-battle

$gameParty.allMembers().forEach(actor => actor._preCombatPosition = actor.row());

post-battle

$gameParty.allMembers().forEach(actor => actor.setRow(actor._preCombatPosition));

I think it is working now, so I guess the property was already being used for something else. Thanks for the help!
 

Latest Threads

Latest Profile Posts

You know your room is too tiny for how much stuff you have when it gives you literal insomnia. I just cleared a bunch of stuff out and man it feels good!
1670381555475.png
Meet the Kernel. You encounter him in cyberspace. He's important!
I released a test version of my game on itch.io. If anyone wants to check it out, here's the link (for now in Brazilian Portuguese only, sorry).

https://rafael-lobo.itch.io/insolita
Back up your project.
When you open MV to check something while answering a question and accidentally leave it running for 10 hours...yes, that is absolutely time I spent working on my project. >_>

Forum statistics

Threads
127,082
Messages
1,183,803
Members
166,988
Latest member
Ares158
Top