RMMV Question about Yanfly's Row Formation Lunatic Mode Java Script Function

Klammsi

Veteran
Veteran
Joined
Nov 19, 2016
Messages
87
Reaction score
10
First Language
English
Primarily Uses
There's @Trihan 's Jump Into JavaScript, which explains the structure and contents of MV's code. I haven't read through it, so I'm not sure how much of a beginner's JavaScript tutorial it is.

Then these pop up in an initial search:
Thank you for this! I'll definitely gonna check it out.

So I have tested the script again and it runs fine without any error messages in the console. It applies the "Protected" state at the beginning of the battle as intended, but it doesn't seem to remove it when all members in row 1 are affected by "Disabled" state nor when everybody in row 1 has died...

I don't know I think I may have bitten off more than I can chew... maybe I have to return to this once I gained a bit more knowledge.


I think I figured out why it is removing and adding the "Protected" State to both, Party and Troop at the same time.

When the Custom Row Condition in the "Protected" State is met the state will apply, if it is not met it will remove it. However Row States always affect both the party and the troop, it does't differentiate between the two...
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,159
Reaction score
634
First Language
English
Primarily Uses
RMMV
It applies the "Protected" state at the beginning of the battle as intended, but it doesn't seem to remove it when all members in row 1 are affected by "Disabled" state nor when everybody in row 1 has died...
Are you running this script as a battle event with the condition Turn 1 + 1 or Turn End and a span of Turn? The default span is Battle, which means it will only be run once in the whole battle.

If the answer is yes, throw a display message test in there to make sure it's getting run each turn as expected.

If you want it to take effect immediately as soon as the front row is Disabled or dead, you'll need to transfer code into parts of the Disabled and Knockdown states. But get this working first.
 

Klammsi

Veteran
Veteran
Joined
Nov 19, 2016
Messages
87
Reaction score
10
First Language
English
Primarily Uses
Are you running this script as a battle event with the condition Turn 1 + 1 or Turn End and a span of Turn? The default span is Battle, which means it will only be run once in the whole battle.

If the answer is yes, throw a display message test in there to make sure it's getting run each turn as expected.

If you want it to take effect immediately as soon as the front row is Disabled or dead, you'll need to transfer code into parts of the Disabled and Knockdown states. But get this working first.

Yes, that is correct, this is how I run the script.
Battle event with the condition Turn 1 + 1 with the span of Turn. That means it should run the event at the end of every turn until the battle if over. I followed your tip with the display message and yes the text is being displayed at the end of every round. So the battle event should be set up ok.

I think I know what you are referring to regarding the effect being instant. I would need to use Yanfly's Buffs and States Core and use the Custom Apply Effect and Custom Remove Effect Nottags.

By the way I think I figured out why it is removing and adding the "Protected" State to both, Party and Troop at the same time.

When the Custom Row Condition in the "Protected" State is met the state will apply, if it is not met it will remove it. However Row States always affect both the party and the troop, it does't differentiate between the two...
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,159
Reaction score
634
First Language
English
Primarily Uses
RMMV
Yes, that is correct, this is how I run the script.
Battle event with the condition Turn 1 + 1 with the span of Turn. That means it should run the event at the end of every turn until the battle if over. I followed your tip with the display message and yes the text is being displayed at the end of every round. So the battle event should be set up ok.
Then I'm not sure what the problem is. Can you provide fresh screenshots?
When the Custom Row Condition in the "Protected" State is met the state will apply, if it is not met it will remove it. However Row States always affect both the party and the troop, it does't differentiate between the two...
I don't know what you mean here. Row States affect only the actors or battlers that you put them onto with notetags. And once you're in battle, it absolutely differentiates between the two. $gameParty only looks at playable actors in your party. We would have to reference $gameTroop for it to have anything to do with enemies.

I don't recall you saying that you were using the same row states for your enemies as your party. If you don't want your enemies getting Protected when your front row of the party is alive, don't give them the same row state (or change your row condition to be condition=user.isActor() && $gameSwitches.value(1); ).

Get into a fight and kill off your front row. Then press F8, click over to Console, and enter $gameParty.rowAliveMembers(1).length and see if it returns 0
 
Last edited:

Klammsi

Veteran
Veteran
Joined
Nov 19, 2016
Messages
87
Reaction score
10
First Language
English
Primarily Uses
Then I'm not sure what the problem is. Can you provide fresh screenshots?

I don't know what you mean here. Row States affect only the actors or battlers that you put them onto with notetags. And once you're in battle, it absolutely differentiates between the two. $gameParty only looks at playable actors in your party. We would have to reference $gameTroop for it to have anything to do with enemies.

I don't recall you saying that you were using the same row states for your enemies as your party. If you don't want your enemies getting Protected when your front row of the party is alive, don't give them the same row state (or include a check for it in this...but get this working, first).

So on the screenshots you can see how I set everything up. I don't think I made a mistake here.

Regarding the Row States; I don't think you are right there mate. The Row States are defined in the plugin parameters, not via notetags.

And if you look what it says in the helpfile, I think it supports that.

"To the users who have a bit of JavaScript proficiency, you can use these
notetags to give your row states conditional activation properities, you can
use these notetags. These states have to be applied via the Row States in
the plugin parameters
. However, they will not be applied to the battler
unless the conditions are met.

State Notetags:

<Custom Row Condition>
if (user.hp / user.mhp <= 0.25) {
condition = true;
} else {
condition = false;
}
</Custom Row Condition>

The 'condition' variable determines if the condition is met or not. If the
condition is true, the condition is met and this state will be applied to
the battler as a row state. If the 'condition' variable is false, then the
row state will not be applied to the battler."
 

Attachments

  • Picture Troop event.PNG
    Picture Troop event.PNG
    389.4 KB · Views: 5
  • Row formation plugin.PNG
    Row formation plugin.PNG
    428 KB · Views: 5
  • Script.PNG
    Script.PNG
    298.6 KB · Views: 5
  • States.PNG
    States.PNG
    346.3 KB · Views: 5

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,453
Reaction score
2,571
First Language
English
Primarily Uses
RMMZ
My series assumes at least a basic knowledge of programming, but it covers new concepts fairly in-depth as they're encountered.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,159
Reaction score
634
First Language
English
Primarily Uses
RMMV
Regarding the Row States; I don't think you are right there mate. The Row States are defined in the plugin parameters, not via notetags.
Ah, I haven't used the plugin, I presumed they were user-defined. Then just use the code I gave you, and only actors will get affected by it. But then, if it were me, I would want the state saying what row someone is in to be separate from a state that actually does things (such as Protected).

Or you could give your enemies the notetag <Default Row: 1> and <Row Lock>. Or whatever else you like.

What result do you get from checking the variable in the console when you've killed off the front row?

Is there a reason you're using the plugin parameters reserved for old versions of RPG Maker?

Edit:
Okay, I changed some things to debug, and I've discovered one thing. For some reason, JavaScript doesn't like if (!$gameParty.rowAliveMembers(1)[i].isStateAffected(13)) I don't know why, maybe functions that return booleans do them as strings and the not operator checks for a null value...whatever.

Regardless!

Changing that line to if ($gameParty.rowAliveMembers(1)[i].isStateAffected(13)==false) makes the thing work as intended! The only thing is that I discovered that while changing it from a row affect to a passive state. So...I have to go to work right now. It works as a passive state with that modification to the script, go ahead and just make that little change and see if it works the same as a row affect.
 
Last edited:

Klammsi

Veteran
Veteran
Joined
Nov 19, 2016
Messages
87
Reaction score
10
First Language
English
Primarily Uses
Ah, I haven't used the plugin, I presumed they were user-defined. Then just use the code I gave you, and only actors will get affected by it. But then, if it were me, I would want the state saying what row someone is in to be separate from a state that actually does things (such as Protected).

Or you could give your enemies the notetag <Default Row: 1> and <Row Lock>. Or whatever else you like.

What result do you get from checking the variable in the console when you've killed off the front row?

Is there a reason you're using the plugin parameters reserved for old versions of RPG Maker?
You must think I am the biggest noob ever now, but I don't actually know how to check for variables in the console... I only ever used it to se if something would trigger an error.

Regarding the plugin parameter version 1.5.0+:
They both do the same thing but if you are running a version of RPG Maker MV that is version 1.5.0 or higher you can select the states from a convenient drop down list rather than typing them out.

I have tested it a bit more and I don't think using the <Custom Row Condition> Function is going to be the answer. If I use the code that you so kindly offered it will still apply or remove from both Party and Troop at the same time. I think its just the nature of how "Row States" that are defined through the plugin parameters work. I don't know if there is a way to add a state to an entire row via script call? This might be a different angle to solve the problem.

I have used the Row Formation plugin for a little while now and became quite familiar with it. I just never tackled the Java Functions... However together with Yanflys Selection Control plugin I actually managed to create a tactical combat system that I am quite proud of...

Melee Weapons can only hit the front row, ranged weapons can target any row, skills that can push or pull enemies into different rows etc. As my coding knowledge is still limited I mainly used eventing and a combination of notetags to achieve this. I am quite happy with it but there was always one thing that bugged me and I could never work out how to do using eventing or notetags...

Imagine you have two enemies in the front row. As long as they are alive melee weapons would not be able to target any enemies in the rows behind. But what if both of the enemies in the front row were to be stunned, frozen, asleep or petrified (essentially "Disabled")

At this point It wouldn't make sense that melee weapons could only target the front row. They should be able to target the 2nd row as well as enemies in the front row wouldn't represent an active threat at this point. But once at least one enemy in the front row is no longer "Disabled" the 2nd row will be protected again and melee weapons cant target it.

I sort of managed to achieve it with some ridiculous troop eventing but it becomes almost impossible once enemies or actors start moving between the rows. Hence why I started to look at the functions provided in the row formation plugin...
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,159
Reaction score
634
First Language
English
Primarily Uses
RMMV
You must think I am the biggest noob ever now, but I don't actually know how to check for variables in the console... I only ever used it to se if something would trigger an error.
$gameVariables.value(ID);
I have tested it a bit more and I don't think using the <Custom Row Condition> Function is going to be the answer. If I use the code that you so kindly offered it will still apply or remove from both Party and Troop at the same time.
That's just weird to me...I see no logical/organizational reason why the states on the troop's row would be connected in any way to those on the party's.

But if that's the case, the simple solution would just be to put Protected on all of your actors as a passive state. The only thing you'd need to add is a check to see if they're in the second row in order to get the benefit.
Code:
<Custom Passive Condition>
condition=(user.row()==2 && $gameSwitches.value(1));
</Custom Passive Condition>

That way you can move the characters between rows as you like, and they'll always have it when applicable.
 

Klammsi

Veteran
Veteran
Joined
Nov 19, 2016
Messages
87
Reaction score
10
First Language
English
Primarily Uses
$gameVariables.value(ID);

That's just weird to me...I see no logical/organizational reason why the states on the troop's row would be connected in any way to those on the party's.

But if that's the case, the simple solution would just be to put Protected on all of your actors as a passive state. The only thing you'd need to add is a check to see if they're in the second row in order to get the benefit.
Code:
<Custom Passive Condition>
condition=(user.row()==2 && $gameSwitches.value(1));
</Custom Passive Condition>

That way you can move the characters between rows as you like, and they'll always have it when applicable.
Hey ATT_Turan

Thank you for your help, I have applied the changes to the code that you suggested and moved away from the Row States and created the passive sate that you recommended and it is now working fine!

I have made one script for the party and one for the troops with their own Switches and "Protected" States which now allows me to remove and reapply the "Protected" States independently from each other.

I should have probably addressed this from the start but didn't fully realise how complex this was.
But how would I go about this if I had an additional row. (3 rows in total).

Same principle: If all members in row one are alive, row 2 and 3 have the "Protected" state. once every one in row one is killed or disabled, row 2 will loose the "Protected" State but row 3 will still have it until all members of row 2 are either killed or disabled as well...

I have modified the the protected sates and I think I have done this correctly:

<Custom Passive Condition>

condition=(user.row()==2 && $gameSwitches.value(99)) || (user.row()==3 && $gameSwitches.value(99));

</Custom Passive Condition>


Not entirely sure I have to go about the script call though...
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,159
Reaction score
634
First Language
English
Primarily Uses
RMMV
I have made one script for the party and one for the troops with their own Switches and "Protected" States which now allows me to remove and reapply the "Protected" States independently from each other.
I'm glad it's working. Just to put it out there, the other thing you could have done was assign different rows to enemies than actors in their notetags. So, say, actors use rows 1-3 and enemies are assigned to rows 4-6. They could be made to work as identically or differently as you like, and the player would never know, but you could assign different effects as you liked.

Regardless!
<Custom Passive Condition>

condition=(user.row()==2 && $gameSwitches.value(99)) || (user.row()==3 && $gameSwitches.value(99));

</Custom Passive Condition>
This will work, although it's a little bit more than you need. If you were to say it to me, you wouldn't say "If they're in the second row and the switch is on, or they're in the third row and the switch is on" - you'd say "If they're in the second or third row and the switch is on": (user.row()==2 || user.row()==3) &&...

Or we could be even a bit more clever about it.
Code:
<Custom Passive Condition>
condition=(user.row()>1 && $gameSwitches.value(99));
</Custom Passive Condition>
 

Klammsi

Veteran
Veteran
Joined
Nov 19, 2016
Messages
87
Reaction score
10
First Language
English
Primarily Uses
I'm glad it's working. Just to put it out there, the other thing you could have done was assign different rows to enemies than actors in their notetags. So, say, actors use rows 1-3 and enemies are assigned to rows 4-6. They could be made to work as identically or differently as you like, and the player would never know, but you could assign different effects as you liked.

Regardless!

This will work, although it's a little bit more than you need. If you were to say it to me, you wouldn't say "If they're in the second row and the switch is on, or they're in the third row and the switch is on" - you'd say "If they're in the second or third row and the switch is on": (user.row()==2 || user.row()==3) &&...

Or we could be even a bit more clever about it.
Code:
<Custom Passive Condition>
condition=(user.row()>1 && $gameSwitches.value(99));
</Custom Passive Condition>
That is an interesting idea regarding the different rows for party and enemies! Never thought about it but definitely gonna play around with it as it might open up other possibilities as well! The only thing that would be required is to tweek the settings for the row positions in the plugin parameters as they depend on the maximum amount of rows.

Just trying to figure out what how I would need to adjust the script call now to make it work for the 3 rows..
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,159
Reaction score
634
First Language
English
Primarily Uses
RMMV
Just trying to figure out what how I would need to adjust the script call now to make it work for the 3 rows..
Nothing? The script doesn't have anything to do with any information except the members of the first row. It doesn't know or care how many rows are behind that. You're taking care of that in the passive state.
 

Klammsi

Veteran
Veteran
Joined
Nov 19, 2016
Messages
87
Reaction score
10
First Language
English
Primarily Uses
Nothing? The script doesn't have anything to do with any information except the members of the first row. It doesn't know or care how many rows are behind that. You're taking care of that in the passive state.
Hmm ok, does it not need to check the 2nd row as well? because what is happening at the moment is:

Even if there are still alive members in row 2, row 3 looses the "Protected" State as soon as all members in row 1 are "Disabled".

Everybody in row 2 should also be either dead or "Disabled" in order for row 3 to loose the "Protected" State.

So I guess I would have to do another "if" statement in the script call?

sry I feel like I asked you like a million things already....
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,159
Reaction score
634
First Language
English
Primarily Uses
RMMV
Even if there are still alive members in row 2, row 3 looses the "Protected" State as soon as all members in row 1 are "Disabled".

Everybody in row 2 should also be either dead or "Disabled" in order for row 3 to loose the "Protected" State.
Sorry, I didn't read your post carefully enough.

If you want it to work that way, you'll need to copy the entire script and paste it a second time, changing references to row(1) to row(2) and setting a different switch. Put that entire pasted section inside of
if (!healthy) { } (with the pasted code inside the braces).
Then your custom state will be (row 2 && switch 1) || (row 3 && switch 2).
 

Klammsi

Veteran
Veteran
Joined
Nov 19, 2016
Messages
87
Reaction score
10
First Language
English
Primarily Uses
Sorry, I didn't read your post carefully enough.

If you want it to work that way, you'll need to copy the entire script and paste it a second time, changing references to row(1) to row(2) and setting a different switch. Put that entire pasted section inside of
if (!healthy) { } (with the pasted code inside the braces).
Then your custom state will be (row 2 && switch 1) || (row 3 && switch 2).
Hey ATT_Turan,

Sorry for the late response but I was swamped with work in the last couple of days.

I have applied the changes that you suggested.

The script call looks like this now:

if ($gameTroop.rowAliveMembers(1).length<1) $gameSwitches.setValue(99, false);
else {var healthy=false; for (var i=0; i<$gameTroop.rowAliveMembers(1).length; i++)

{ if ($gameTroop.rowAliveMembers(1).isStateAffected(342)==false)

{ healthy=true; // He's not Disabled, so we can still have Protected

break; }

} $gameSwitches.setValue(99, healthy);

}

if (!healthy) {if ($gameTroop.rowAliveMembers(2).length<1) $gameSwitches.setValue(102, false); else
{var healthy=false; for (var i=0; i<$gameTroop.rowAliveMembers(2).length; i++)

{ if ($gameTroop.rowAliveMembers(2).isStateAffected(342)==false)

{ healthy=true; // He's not Disabled, so we can still have Protected

break; }

} $gameSwitches.setValue(102, healthy);}

}

And the passive state Condition as follows:

<Custom Passive Condition>

condition=(user.row()==2 && $gameSwitches.value(99)) || (user.row()==3 && $gameSwitches.value(102));

</Custom Passive Condition>


It seems to be running fine with the only problem that row number 3 doesn't receive the "Protected" State from the beginning of the fight as intended but only once row 2 has lost the "Protected" state.
See Pictures row test 1 & 2

The biggest problem that I am facing, which essentially breaks this system is, that the states are only being updated once the effected battlers reach their turn and not instantly, making it often the case that characters with melee weapons can target enemies that they should't or the other way around.

Now I know that this is due to how the troop event is set up, but I have tried a lot of different things now and I can't seem to get it to update instantly. I have experimented with the <Custom Apply Effect> Notetag as you suggested in one of your earlier posts but can't seem to get it to work.
 

Attachments

  • row test1.png
    row test1.png
    444.1 KB · Views: 1
  • row test 2.png
    row test 2.png
    457.5 KB · Views: 1

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,159
Reaction score
634
First Language
English
Primarily Uses
RMMV
It seems to be running fine with the only problem that row number 3 doesn't receive the "Protected" State from the beginning of the fight as intended but only once row 2 has lost the "Protected" state.
Then add after the last brace else $gameSwitches.setValue(102, true);
The biggest problem that I am facing, which essentially breaks this system is, that the states are only being updated once the effected battlers reach their turn and not instantly, making it often the case that characters with melee weapons can target enemies that they should't or the other way around.

Now I know that this is due to how the troop event is set up, but I have tried a lot of different things now and I can't seem to get it to update instantly. I have experimented with the <Custom Apply Effect> Notetag as you suggested in one of your earlier posts but can't seem to get it to work.
You can try setting the event span to Moment, but I'm not sure how frequently that will make the code run and if it might create any lag in your game.

The most efficient way to get it to work with custom state tags depends on how many actors and such you have.

Have you considered doing this a more traditional way? When a party member gets knocked out (or Disabled), creating an empty space in the formation, they get punted to the back and people move forward to fill in the hole. That would do away with the need for the conditional row entirely.
 

Klammsi

Veteran
Veteran
Joined
Nov 19, 2016
Messages
87
Reaction score
10
First Language
English
Primarily Uses
Then add after the last brace else $gameSwitches.setValue(102, true);

You can try setting the event span to Moment, but I'm not sure how frequently that will make the code run and if it might create any lag in your game.

The most efficient way to get it to work with custom state tags depends on how many actors and such you have.

Have you considered doing this a more traditional way? When a party member gets knocked out (or Disabled), creating an empty space in the formation, they get punted to the back and people move forward to fill in the hole. That would do away with the need for the conditional row entirely.
As always you were spot on mate, adding this line "else $gameSwitches.setValue(102, true);" made it work exactly as it should.

I have done some intensive testing with the troop event span set to "Moment" and the <Custom Apply Effect> and <Custom Remove Effect> Notetags and I am pretty much certain I figured out the reason why the "Protected" state is not updated instantly when the conditions are met.

It is down to the fact that it is applied to the battlers via a passive state...

I made some "dummy" events to recreate what we are doing in the script call via eventing and the "Protected" State is always removed and added immediately as intended, unless it is added via a passive state... :/
Which is a big shame as the script is working exactly as it should now...

I don't know if there is any other way to ad or remove a state to all members of a row if a certain condition is met?

Regarding your suggestion of doing it a more traditional way:
Yeah I have played around with this in the past before as well but wanted to do something a bit different.
The thing is, the way how the battle system in my game is at the moment, it really works well and is fun and tactical ( at least in my opinion).
The feature that we are working on here (characters with melee weapons being able to move past a row if all members are "Disabled" to attack the row behind) would have been the cherry on the top to really make it 100% how I would want it to be as it adds another layer of tactics to it.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,159
Reaction score
634
First Language
English
Primarily Uses
RMMV
Here is what I would do.

Put this code into both Disabled and Knockout (I presume Disabled is still 342...how the holy hell do you have over 300 states in your game?!):
Code:
<Custom Apply Effect>
if (user.row()==1)
{
// If everyone in row 1 is dead, row 2 can't be Protected
    if ($gameParty.rowAliveMembers(1).length<1)
        $gameSwitches.setValue(99, false);

    else if ($gameSwitches.value(99)) // If row 2 is protected and something happens in 1
    {
        var healthy=false;

        for (var i=0; i<$gameParty.rowAliveMembers(1).length; i++)
        {
            if ($gameParty.rowAliveMembers(1)[i].isStateAffected(342)==false)
            {
                healthy=true; // He's not Disabled, so we can still have Protected
                break;
            }
        } 
        $gameSwitches.setValue(99, healthy);
   }
}
else if (user.row()==2)
{
// If everyone in row 2 is dead, row 3 can't be Protected
    if ($gameParty.rowAliveMembers(2).length<1)
        $gameSwitches.setValue(102, false);

    else if ($gameSwitches.value(102)) // If row 3 is protected and something happens in 2
    {
        var healthy=false;

        for (var i=0; i<$gameParty.rowAliveMembers(2).length; i++)
        {
            if ($gameParty.rowAliveMembers(2)[i].isStateAffected(342)==false)
            {
                healthy=true; // He's not Disabled, so we can still have Protected
                break;
            }
        } 
        $gameSwitches.setValue(102, healthy);
   }
}
That should make it so that if someone in row 1 gets knocked out or disabled, and that causes all of row 1 to be knocked out or disabled, it turns off switch 99. Ditto for row 2 and switch 102.

Then, still in both of those states, put:
Code:
<Custom Remove Effect>
if (user.row()==1)
    $gameSwitches.setValue(99, true);
else if (user.row()==2)
    $gameSwitches.setValue(102, true);
</Custom Remove Effect>
That should make it so that any time someone has Disabled removed, or is revived from Knockout, it will enable the appropriate switch.

Finally, put Protected on all of your actors as a passive state. Put in the notetags:
Code:
<Custom Passive Condition>
condition=(user.row()==2 && $gameSwitches.value(99)==true) || (user.row()==3 && $gameSwitches.value(102)==true);
</Custom Passive Condition>[/SPOILER]
That should make the state turn on any time that actor is in the appropriate row and the appropriate switch is on, and off as soon as either condition changes.

You'll need to run an event at the beginning of your game to set those two switches to true to begin with.

Test.
 
Last edited:

Klammsi

Veteran
Veteran
Joined
Nov 19, 2016
Messages
87
Reaction score
10
First Language
English
Primarily Uses
Here is what I would do.

Put this code into both Disabled and Knockout (I presume Disabled is still 342...how the holy hell do you have over 300 states in your game?!):
Code:
<Custom Apply Effect>
if (user.row()==1)
{
// If everyone in row 1 is dead, row 2 can't be Protected
    if ($gameParty.rowAliveMembers(1).length<1)
        $gameSwitches.setValue(99, false);

    else if ($gameSwitches.value(99)) // If row 2 is protected and something happens in 1
    {
        var healthy=false;

        for (var i=0; i<$gameParty.rowAliveMembers(1).length; i++)
        {
            if ($gameParty.rowAliveMembers(1)[i].isStateAffected(342)==false)
            {
                healthy=true; // He's not Disabled, so we can still have Protected
                break;
            }
        }
        $gameSwitches.setValue(99, healthy);
   }
}
else if (user.row()==2)
{
// If everyone in row 2 is dead, row 3 can't be Protected
    if ($gameParty.rowAliveMembers(2).length<1)
        $gameSwitches.setValue(102, false);

    else if ($gameSwitches.value(102)) // If row 3 is protected and something happens in 2
    {
        var healthy=false;

        for (var i=0; i<$gameParty.rowAliveMembers(2).length; i++)
        {
            if ($gameParty.rowAliveMembers(2)[i].isStateAffected(342)==false)
            {
                healthy=true; // He's not Disabled, so we can still have Protected
                break;
            }
        }
        $gameSwitches.setValue(102, healthy);
   }
}
That should make it so that if someone in row 1 gets knocked out or disabled, and that causes all of row 1 to be knocked out or disabled, it turns off switch 99. Ditto for row 2 and switch 102.

Then, still in both of those states, put:
Code:
<Custom Remove Effect>
if (user.row()==1)
    $gameSwitches.setValue(99, true);
else if (user.row()==2)
    $gameSwitches.setValue(102, true);
</Custom Remove Effect>
That should make it so that any time someone has Disabled removed, or is revived from Knockout, it will enable the appropriate switch.

Finally, put Protected on all of your actors as a passive state. Put in the notetags:
Code:
<Custom Passive Condition>
condition=(user.row()==2 && $gameSwitches.value(99)==true) || (user.row()==3 && $gameSwitches.value(102)==true);
</Custom Passive Condition>[/SPOILER]
That should make the state turn on any time that actor is in the appropriate row and the appropriate switch is on, and off as soon as either condition changes.

You'll need to run an event at the beginning of your game to set those two switches to true to begin with.

Test.
Hello ATT_Turan,

Wow thank you so much for this I really appreciate your help in this matter, it's more that I could ask for!
Im at work all day today/night today but can't wait to try it out tommorrow!

Hey @ATT_Turan ,

Sry for the late reply but I ot really busy with work.
I spent quite a bit of time testing it now and although the way how you set it up makes perfect sense, the "Protected" State still isn't removed immediately... If all member's in row 1 are "Disabled" the "Protected" State is only removed from row 2 once the first member of row 2 reaches its turn. (Which seems really weird to me..) As you can see in picture1 and 2.

The same thing happens when everybody in the rows in front has been killed... See picture 3

What is funny, re-applying the "Protected" State happens immediately though!
So as soon as at least 1 member of row1 is no longer "Disabled" row 2 will regain the "Protected" State. So I don't really understand why it wouldn't work instantly when the state needs to be removed...
 

Attachments

  • Picture 1.png
    Picture 1.png
    540 KB · Views: 1
  • Picture 2.png
    Picture 2.png
    530 KB · Views: 1
  • Picture 3.png
    Picture 3.png
    533 KB · Views: 1
Last edited:

Latest Threads

Latest Profile Posts

My favorite thing about my magical girl Yuki is her ahoge can sense food, she's lazy and a crybaby and LOVES food
ahahahaha just some girls yunaandyuka.png
and some girls im working on
1624241110918.png
Not about my game project but i feels like to talk about it a bit. :kaohi:
moka.jpg

It's my コテキャ and maybe closest thing in english is a "avatar personality" i guess?
Her design also looks very similar to protagonist from my game because i'm so uninspiring :kaoslp:
Oh and my hobby is sleeping and drawing. :kaojoy:
Okay, so it seems I've found a major bug in VNM. Check my thread about variable buttons in the support forum for more info.
Man, this quick One Map game is causing unprecedented amounts of trouble.

Forum statistics

Threads
112,403
Messages
1,068,076
Members
146,053
Latest member
komradiv
Top