The official VisuStella notetag help thread

● ARCHIVED · READ-ONLY
Started by Trihan 1458 posts Page 13 of 73 View original ↗
  1. 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!
  2. I'll have a look and see what I can do. :)
  3. 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.
  4. optiprimeful said:
    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.

    Junane said:
    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>
  5. Trihan said:
    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>
    I'm afraid I'm confused on how to assign a variable to the state, since at present the barrier reads as 0.
  6. Junane said:
    I'm afraid I'm confused on how to assign a variable to the state, since at present the barrier reads as 0.
    What specifically is it meant to do?
  7. Adds a barrier equal to 125% of HP it heals. (e.g. 500 HP = 625 barrier); the single-target version is 150% instead.
  8. What was the .barrierPoints() bit doing?
  9. Trihan said:
    What was the .barrierPoints() bit doing?
    Two things: it'd first check if there were any points remaining (e.g. 150) then subtract the barrier points of the old from the new (if it healed for 600 and 150 remained, 600 - 150 = 450 barrier points added). It also checked if the barrier points were higher than the heal (e.g. 400 heal when 500 barrier exists) in which case the barrier effect would not happen).
  10. Ahh, okay. I see now.

    Code:
    <JS Post-Damage>
      const existingBarrier = target._stateDisplay[id of absorb state];
      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 > existingBarrier) {
            target._barrierPoints = -value * 2 - existingBarrier;
            target.addState(id of absorb state);
          }
        }
      } else if (this.isHpEffect() && this.isSkill() && value < 0){
        if (-value > existingBarrier){
          target._barrierPoints = -value - existingBarrier;
          target.addState(id of absorb state);
        }
      }
    </JS Post-Damage>
  11. is existingBarrier defined anywhere? and how does that interact with the state to determine the number since I get no absorption barrier counter?
  12. "const existingBarrier" is the line that defines it.

    If you set the notetag for your barrier state to use <All Absorb Barrier: user._absorbPoints> it'll add the state with that number of absorb points.
  13. Trihan said:
    If you set the notetag for your barrier state to use <All Absorb Barrier: user._absorbPoints> it'll add the state with that number of absorb points.
    Still coming up as 0 despite healing 365 (should be appearing as 548) causing it to end on the start of their next turn.

    EDIT: Solution found!

    <JS Post-Damage>
    if (this.isHpEffect() && value < 0){
    var Heal = Math.round(-value * 1.5)
    $gameVariables.setValue(1, Heal)
    }
    </JS Post-Damage>

    <All Absorb Barrier: $gameVariables.value(1)>
  14. I could have worked through with you why a local var wasn't working but if using a game one does then happy days. Don't want to mess with it if it ain't broke. :)
  15. Trihan said:
    I could have worked through with you why a local var wasn't working but if using a game one does then happy days. Don't want to mess with it if it ain't broke. :)
    I sadly must come back to it as that's only step 1. Step 2 needs a weaker barrier number from the same state to not overwrite a stronger one (68 overwrote a 608 barrier in my playtest) and the absorption barrier function is not playing nice with the attached skill which adds state #33.
  16. Just make sure value isn't < user._stateDisplay[id of barrier state] (the state display is used for how many points the barrier has) and don't call addState if it is.
  17. Testing with a x1 multiplier for now.

    EDIT: Step 2 works with:

    Barrier fix
    <JS Post-Damage>
    if (this.isHpEffect() && value < 0){
    var Heal = Math.round(-value * 1.5);
    if (b.isStateAffected(32)){
    if (Heal > target._stateDisplay[32]){
    $gameVariables.setValue(1, Heal);
    b.addState(32);
    }
    } else {
    $gameVariables.setValue(1, Heal);
    b.addState(32);
    }
    }
    </JS Post-Damage>

    Now onto step 3...

    EDIT 2: My single-target heal proves reliable with Rapid Response using the following code:

    Restoration
    <JS Post-Damage>
    if (this.isHpEffect() && value < 0){
    var Heal = Math.round(-value * 1.5);
    if (a.isStateAffected(33)){
    $gameVariables.setValue(1, Heal);
    b.gainHp(-value + $gameVariables.value(1));
    a.removeState(33);
    } else if (b.isStateAffected(32)){
    if (Heal > target._stateDisplay[32]){
    $gameVariables.setValue(1, Heal);
    b.addState(32);
    }
    } else {
    $gameVariables.setValue(1, Heal);
    b.addState(32);
    }
    }
    </JS Post-Damage>

    However my party heal equivalent only works on the first actor and ignores everyone else.
  18. Trihan said:
    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>
    Thank you so much! I removed the bad note tags and added this skill. Now it works perfectly!:D
  19. Junane said:
    Testing with a x1 multiplier for now.

    EDIT: Step 2 works with:

    Barrier fix
    <JS Post-Damage>
    if (this.isHpEffect() && value < 0){
    var Heal = Math.round(-value * 1.5);
    if (b.isStateAffected(32)){
    if (Heal > target._stateDisplay[32]){
    $gameVariables.setValue(1, Heal);
    b.addState(32);
    }
    } else {
    $gameVariables.setValue(1, Heal);
    b.addState(32);
    }
    }
    </JS Post-Damage>

    Now onto step 3...

    EDIT 2: My single-target heal proves reliable with Rapid Response using the following code:

    Restoration
    <JS Post-Damage>
    if (this.isHpEffect() && value < 0){
    var Heal = Math.round(-value * 1.5);
    if (a.isStateAffected(33)){
    $gameVariables.setValue(1, Heal);
    b.gainHp(-value + $gameVariables.value(1));
    a.removeState(33);
    } else if (b.isStateAffected(32)){
    if (Heal > target._stateDisplay[32]){
    $gameVariables.setValue(1, Heal);
    b.addState(32);
    }
    } else {
    $gameVariables.setValue(1, Heal);
    b.addState(32);
    }
    }
    </JS Post-Damage>

    However my party heal equivalent only works on the first actor and ignores everyone else.
    What's the code for your party heal?
  20. Trihan said:
    What's the code for your party heal?
    Exactly the same as the single ally heal listed under the Restoration spoiler tag, only difference being 1.5 changes into 1.25.

    EDIT: That got solved by adding "Remove State" into the effects box.