Hey, team!
I've been trying to implement a mechanic using Yanfly row formation plugin that is simple in my head, but hard in practice:
The only thing I could do without coding is give the "Taunt" state to everyone in first row. But if I have 2 characters there and 2 in the back rows, I'm unable to reach the backward ones until I kill everyone in Row 1, which is not the purpose...
I've trying this code, but it is definitely not working (everyone is getting the state even with someone in front of them):
Please, can anyone help me?
The logic behind it was:
- Check if the state "user" is an Actor or an Enemy;
- If Enemy: have to use $gameTroop variables;
- If Actor: have to use $gameParty variables;
- Which is the user row?
- Who are the front row members?
- Check if the front row is not empty (or if the members in there aren't dead. I've try the two different versions in the same code just to see if the results change - but they don't);
- Check if the member in the position X in the front row exists/is alive (I created 3 states: each one per one different position in a row)
- If they do: do nothing (they already have the taunt state because it is given to everyone in row 1 by Row Formation plugin parameters - or with a similar code that shoud be working...);
- If they don't: condition is true and the state is activate in user
I've been trying to implement a mechanic using Yanfly row formation plugin that is simple in my head, but hard in practice:
- Each actor/enemy positioned in front of another one will "taunt" the normal attacks from the opposite team.
- When the actor/enemy in front of another actor/enemy dies, the one backward "assumes" the "taunt" state. And so on...
Row3Pos1 Row2Pos1 Row1Pos1
Row3Pos2 Row2Pos2 Row1Pos2
Row3Pos3 Row2Pos3 Row1Pos3
(If the character in R1P1 dies, the R2P1 character assumes the "Taunt" state, even if I have a Character in R1P2 with a "Taunt" state too. They will protect the characters in R3P1 and R2P2 respectively)Row3Pos2 Row2Pos2 Row1Pos2
Row3Pos3 Row2Pos3 Row1Pos3
The only thing I could do without coding is give the "Taunt" state to everyone in first row. But if I have 2 characters there and 2 in the back rows, I'm unable to reach the backward ones until I kill everyone in Row 1, which is not the purpose...
I've trying this code, but it is definitely not working (everyone is getting the state even with someone in front of them):
JavaScript:
<Custom Row Condition>
if(user.isEnemy()){
var userRow = user.row();
var rowMembers = $gameTroop.rowAliveMembers(user.row - 1);
for (var i = 0; i < rowMembers.length; ++i) {
var member = members[i];
if (!member[0]) {
condition = true;
}
else
condition = false;
}
}
else if(user.isActor()){
var userRow = user.row();
var rowMembers = $gameParty.rowMembers(user.row - 1);
for (var i = 0; i < rowMembers.length; ++i) {
var member = members[i];
if (!member[0]) {
condition = true
}
}
}
</Custom Row Condition>
Please, can anyone help me?
The logic behind it was:
- Check if the state "user" is an Actor or an Enemy;
- If Enemy: have to use $gameTroop variables;
- If Actor: have to use $gameParty variables;
- Which is the user row?
- Who are the front row members?
- Check if the front row is not empty (or if the members in there aren't dead. I've try the two different versions in the same code just to see if the results change - but they don't);
- Check if the member in the position X in the front row exists/is alive (I created 3 states: each one per one different position in a row)
- If they do: do nothing (they already have the taunt state because it is given to everyone in row 1 by Row Formation plugin parameters - or with a similar code that shoud be working...);
- If they don't: condition is true and the state is activate in user
Thank you for your explanation!