RMMV Using $gameParty.rowAliveMembers in Custom Passive Conditions bricks Game???

Bagy

Villager
Member
Joined
Jul 26, 2021
Messages
6
Reaction score
2
First Language
English
Primarily Uses
RMMV
I'm using Yanfly's Row Formations plugin, along with his Auto Passive States to establish state changes according with each row.

Things got complicated when I starting making my row state changes mirror the behavior of <front row only> and <back row only> target selections. The idea is for row 1 to get "front row" states only until all members are dead; then row 2 gets "front row" states and row 3 gets "middle row" states. When both row 1 and 2 are all dead, row 3 gets the front row states.

Nevertheless, I got enemies working with these states exactly as desired with the following custom passive conditions:

//row 1
<Custom Passive Condition>
if ($gameTroop.rowAliveMembers(1) < '1' && $gameTroop.rowAliveMembers(2) < '1' ) {
condition = user.isStateAffected(27);
} else if ($gameTroop.rowAliveMembers(1) < '1' ) {
condition = user.isStateAffected(26);
} else {
condition = user.isStateAffected(25);
}
</Custom Passive Condition>

//row 2
<Custom Passive Condition>
if ($gameTroop.rowAliveMembers(1) >= '1' ) {
condition = user.isStateAffected(26);
} else if ($gameTroop.rowAliveMembers(1) < '1' && $gameTroop.rowAliveMembers(2) >= '1' ) {
condition = user.isStateAffected(27);
} else {
condition = false;
}
</Custom Passive Condition>

//row 3
<Custom Passive Condition>
if ($gameTroop.rowAliveMembers(1) >= '1' && $gameTroop.rowAliveMembers(2) >= '1' ) {
condition = user.isStateAffected(27);
} else {
condition = false;
}
</Custom Passive Condition>

So next I tried to apply this method to playable characters simply by changing "gameTroop.rowAliveMembers" to "gameParty.rowAliveMembers." As soon as I change this one thing, the game won't load.

Troops "Battle Test" shows an infinite black screen, "Playtest" loads the main menu, but it freezes right there as soon as "New Game" is selected. Can't even bring up game properties or debug menu. I've tried a bunch of variations on my custom conditions, and they all have these same result. "gameTroop" is fine, but "gameParty.rowAliveMembers" crashes on load.

Here's a couple versions of what I've been trying:

//row 1 states:
<Custom Passive Condition>
if ($gameParty.rowAliveMembers(1) < '1' && $gameParty.rowAliveMembers(2) < '1' ) {
condition = user.isStateAffected(27);
} else if ($gameParty.rowAliveMembers(1) < '1' ) {
condition = user.isStateAffected(26);
} else {
condition = user.isStateAffected(25);
}
</Custom Passive Condition>

//row 2 states
<Custom Passive Condition>
if ($gameParty.rowAliveMembers(1) >= '1' ) {
condition = user.isStateAffected(26);
} else if ($gameParty.rowAliveMembers(1) < '1' && $gameParty.rowAliveMembers(2) >= '1' ) {
condition = user.isStateAffected(27);
} else {
condition = false;
}
</Custom Passive Condition>

//row 3 states
<Custom Passive Condition>
if ($gameParty.rowAliveMembers(1) >= '1' && $gameParty.rowAliveMembers(2) >= '1' ) {
condition = user.isStateAffected(27);
} else {
condition = false;
}
</Custom Passive Condition>

//row 1 states:
<Custom Passive Condition>
if (user.isEnemy() && $gameTroop.rowAliveMembers(1) < '1' && $gameTroop.rowAliveMembers(2) < '1' ) {
condition = user.isStateAffected(27);
} else if (user.isEnemy() && $gameTroop.rowAliveMembers(1) < '1' ) {
condition = user.isStateAffected(26);
} else if (user.isActor() && $gameParty.rowAliveMembers(1) < '1' && $gameParty.rowAliveMembers(2) < '1' ) {
condition = user.isStateAffected(27);
} else if (user.isActor() && $gameParty.rowAliveMembers(1) < '1' ) {
condition = user.isStateAffected(26);
} else {
condition = user.isStateAffected(25);
}
</Custom Passive Condition>

//row 2 states:
<Custom Passive Condition>
if (user.isEnemy() && $gameTroop.rowAliveMembers(1) >= '1' ) {
condition = user.isStateAffected(26);
} else if (user.isEnemy() && $gameTroop.rowAliveMembers(1) < '1' && $gameTroop.rowAliveMembers(2) >= '1' ) {
condition = user.isStateAffected(27);
} else if (user.isActor() && $gameParty.rowAliveMembers(1) >= '1' ) {
condition = user.isStateAffected(27);
} else if (!user.isEActor() && $gameParty.rowAliveMembers(1) < '1' && $gameTroop.rowAliveMembers(2) >= '1' ) {
condition = user.isStateAffected(27);
} else {
condition = false;
}
</Custom Passive Condition>

//row 3 states:
<Custom Passive Condition>
if (user.isEnemy() && $gameTroop.rowAliveMembers(1) >= '1' && $gameTroop.rowAliveMembers(2) >= '1' ) {
condition = user.isStateAffected(27);
} else if (user.isActor() && $gameParty.rowAliveMembers(1) >= '1' && $gameParty.rowAliveMembers(2) >= '1' ) {
condition = user.isStateAffected(27);
} else {
condition = false;
}
</Custom Passive Condition>

Is there something horribly wrong I'm doing here that I'm simply unaware of?
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
656
Reaction score
368
First Language
German
Primarily Uses
Cannot say for certain this is what happens, but there were a few similar issues in the past.

Usually what happens is that the game gets caught in a loop when the passive conditions reference an actor that has not been created yet:
- Actor is accessed for the first time
- Game noticed the actor entry does not yet exist and creates a new one
- During creation that actors passive conditions are evaluated for the first time
- The passive condition includes a command that accesses the actor again
- Because the creation of the actor is not yet finished it has not been added to the list yet.
- Continue with step 2)

You could try to wrap your problematic conditions in another if-statement to check if the actor actually exists yet to break the cycle:
Code:
if (!user.isActor() || $gameActors._data[user.actorId()]) {

  if ($gameParty.rowAliveMembers(1) < '1' && $gameParty.rowAliveMembers(2) < '1' ) {
    condition = user.isStateAffected(27);
  } else if ($gameParty.rowAliveMembers(1) < '1' ) {
    condition = user.isStateAffected(26);
  } else {
    condition = user.isStateAffected(25);
  }

}

Edit: Not sure if the old version would work, corrected the code
 
Last edited:

Bagy

Villager
Member
Joined
Jul 26, 2021
Messages
6
Reaction score
2
First Language
English
Primarily Uses
RMMV
@Another Fen , your solution worked!

With the standalone player states wrapped in that extra if-statement, the game boots up instantly and everything worked as desired. Thanks a million!

On the other hand, wrapping the combined enemy/player versions with the same statement...the game does boot, but performance is really janky, all the enemy states are always on regardless of the conditions. Clearly something is amiss...I could spend more time troubleshooting, but I don't actually need these states combined, so I might just leave it and roll with the method that's immediately working.
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
656
Reaction score
368
First Language
German
Primarily Uses
If you were using the code from before I made the edit, I kind of forgot that enemies existed so trying to get their "actorId" would cause an error.

Also I'm not entirely sure how the script handles things, but it is possible that because you skipped the condition the first time when the actor was created, the actor might initially have the wrong passive conditions active until you update them again.
(Maybe this won't be an issue, but if it is $gameActors.actor( ID ).refresh() or any command that could change HP/MP/States/... of the actor should fix this)

But glad to hear it worked! :)

Edit: Could have sworn $gameParty.refresh() was a thing... turns out I misremembered.
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

Food for thought. Factorio: Spaghetti belts make your factory inefficient as you fight for space constantly. Satisfactory: Spaghetti belts and massive clipping is the most efficient way to run your factory since it's the shortest distances.
ScreenShot_8_19_2022_8_51_4.png
Both Mike and Ray here are in a "HYPE!" state after Mike uses "Wild Party", which also heals everyone. they'll do more damage and counter more often, but defense is lower along with hit rate.
WHEEL3.gif
Ooker spookers and fun attack mechanics! What a Friday!
Not today... Not today...
I guess I should send my CV to Hasbro. I've made Monopoly cheaters edition more fun and challenging. I've developed custom cheats and chest/chance cards for it. And I've cleared many nightmares through my cards and rules.

Forum statistics

Threads
124,708
Messages
1,165,420
Members
163,521
Latest member
Balalaika
Top