Hello,
I'm trying to create a paralyze state like the one in Pokemon (probability of not attacking) but it doesn't seem to work in MZ.
<JS Pre-Start Action>
// Set the paralyze success rate.
var paralyzeRate = 1.0;
// Make a random number check to see if paralyze passes...
if (Math.random() < paralyzeRate) {
// If it does, play the paralyze animation on the target.
user.startAnimation(64);
// Check for the user's current action...
if (user.currentAction()) {
// And make the user consume its resources.
user.useItem(user.currentAction().item());
}
// Clear the user's actions making the user lose the actions.
user.clearActions();
// Make the battle wait for the paralysis animation to finish playing.
BattleManager.actionWaitForAnimation();
}
</JS Pre-Start Action>
Thanks!
Okay, so you have a couple of issues here. First is that startAnimation no longer exists in MZ, and actionWaitForAnimation isn't a thing either. There's also the fact that clearing the user's actions at this point will crash the engine because it was already processing an action at the time. However, I've managed to create an effect that's almost exactly what you were going for.
Create a new skill called "Paralyzed" with the following notetag:
Code:
<Cast animation: 64>
<JS Post-Apply>
const text = user.name() + " is paralyzed and can't attack!";
const window = SceneManager._scene._logWindow;
if (text) {
window._lines.push(text + '<CENTER>');
window.refresh();
}
</JS Post-Apply>
Then instead of user.clearActions(), do user.currentAction().setSkill(id of your paralyzed skill);
This will replace the action with the paralyzed one, which will use 64 as its cast animation and output a message to the log similar to the one you get in Pokémon.
Hello,
I'm having trouble with two skills, both of which do healing, and applying the same state which is an absorption barrier; the single-target form, in MV, reads:
<Post-Damage Eval>
if (a.isStateAffected(25)){
if (this.isHpEffect() && this.isSkill() && value < 0){
b.gainHp(Math.round(-value * 2));
a.removeState(25);
}
} else if (target.result().critical) {
if (this.isHpEffect() && this.isSkill() && value < 0){
if (-value * 2 > target.barrierPoints(-1)) {
target.gainBarrier(((-value * 2) - target.barrierPoints()), 10)
}
}
} else if (this.isHpEffect() && this.isSkill() && value < 0){
if (-value > target.barrierPoints(-1)){
target.gainBarrier((-value - target.barrierPoints()), 10)
}
}
</Post-Damage Eval>
Note that the "25" state was generated by another skill (this may move to state #33) to convert the barrier into extra healing and the critical section does not exist in the party-wide form of this skill.
Naturally, this is unlikely to work in MZ's Anti-Damage Barriers plugin so any assistance would be nice.
You're right, the MZ version doesn't have the gainBarrier() or barrierPoints() functions. It's actually somewhat easier though, since it's done via state tags.
What you need to do is assign your barrier value to a temporary variable, like user._absorbPoints, then have a new state for your barrier with the notetag
<All Absorb Barrier: user._stateDisplay[id of barrier state] + user._absorbPoints>
<JS On Erase State>
delete target._absorbPoints;
</JS On Erase State>