I'm trying to create a passive state in which a specific class may, randomly, attack during other allies turn. In my first post I asked for a rogue, but now I'm thinking it would suit better my monk and it's evolution-classes. The monk has 5 sequential multiattack skills. Each one, when used, apply a dummy state, which allows him to use the next stronger one. So I had the following code, presenting two issues:
The first issue is that, in a party full of monks, they may be able to keep triggering the other indefinitely. The second issue is that, using Yanfly's Action Sequences, every skill with multiple "action effect"s have multiple chances to trigger the monks' attacks - and when it triggers in the middle of the effects, it glitches the whole action sequence. I have tried tweaking these and changing from Establish Effect to Conclude or Action End, but somehow it made it all even more confusing, and the states were no longer being added/removed from the attacking monk, but from the first one who triggered the attacks.
So I thought maybe, if I could somehow check in line 2 if the triggering attack was forced, it would solve at least part of my problems. Has anyone heard of something like that? 😅
JavaScript:
<Custom Establish Effect>
if (this.isForOpponent()) {
const monks = user.friendsUnit().aliveMembers().filter(member => member !== user && (member._classId === 17 || member._classId === 18 || member._classId === 19));
monks.forEach(monk => {
if (monk.canMove()) {
const bonusChance = monk.agi; // For testing purposes
const random = Math.random();
if (random < bonusChance) {
var action = 1;
if (monk.isStateAffected(249)) {action = 388; monk.removeState(249); monk.addState(250);}
else if (monk.isStateAffected(250)) {action = 389; monk.removeState(250); monk.addState(251);}
else if (monk.isStateAffected(251)) {action = 390; monk.removeState(251); monk.addState(252);}
else if (monk.isStateAffected(252)) {action = 391; monk.removeState(252);}
monk.forceAction(action, -2);
BattleManager.forceAction(monk);
}
}
});
}
</Custom Establish Effect>
The first issue is that, in a party full of monks, they may be able to keep triggering the other indefinitely. The second issue is that, using Yanfly's Action Sequences, every skill with multiple "action effect"s have multiple chances to trigger the monks' attacks - and when it triggers in the middle of the effects, it glitches the whole action sequence. I have tried tweaking these and changing from Establish Effect to Conclude or Action End, but somehow it made it all even more confusing, and the states were no longer being added/removed from the attacking monk, but from the first one who triggered the attacks.
So I thought maybe, if I could somehow check in line 2 if the triggering attack was forced, it would solve at least part of my problems. Has anyone heard of something like that? 😅