Eval Tags MZ

● ARCHIVED · READ-ONLY
Started by ATT_Turan 62 posts Page 3 of 4 View original ↗
  1. azurezero said:
    the game crashes once all actors/enemies have had their turn
    Thanks for the report, I've corrected the error (which only existed in the most recent version).

    If you've deleted portions and you don't need to use those tags, that's fine - otherwise, the file on the first post is updated.
  2. ATT_Turan said:
    Thanks for the report, I've corrected the error (which only existed in the most recent version).

    If you've deleted portions and you don't need to use those tags, that's fine - otherwise, the file on the first post is updated.
    i couldnt tell what those tags were in the first place, i only need the action start eval though, since im only turning on switches to trigger common events to execute plugin commands for live2d animations
    my friend has also made an addon so i can use battle core too, so now i can get all the fun stuff like visual drops
  3. I'm looking to move away from Visustella plugins, and I'm testing this one out!
    The state I'm using to test is 'Frozen,' like from Final Fantasy 9, where the character is frozen icy solid and if hit by a physical attack, they are KOd. If they're hit with fire, the state is removed and they return to normal. This is what I have as notetags for the state, which worked with Visustella using <JS Post-Damage As Target>:
    Code:
    <Action Respond Eval>
      const fire = 4;
      if (this.isAttack() && value > 0) {
        target.setHp(0);
      } else if (this.item().damage.elementId === fire) {
        target.removeState(state.id);
      }
    </Action Respond Eval>

    It seems right to me? However it's not working and I'm not sure why. I've tried <Action Damaged Eval> as well, plus a couple others, but when hit with a physical attack, the actor doesn't KO. Fire doesn't remove the state either. I don't believe I have any other plugins that should affect the evals, so I'm not sure what's up!
  4. starguy said:
    if (this.isAttack() && value > 0) {
    you didnt make the condition being hit by a physical attack. you made it isAttack(), which is only true if the skill is the same as the one that shows up on the actor command window alongside Guard and Item. So skill 1 in most cases.

    then
    starguy said:
    this.item().damage.elementId === fire
    you are sure your skill has the element set to element 4 in your terms? this will not adjust for skills with the normal attack element with a fire attack element trait
  5. Robro33 said:
    you didnt make the condition being hit by a physical attack. you made it isAttack(), which is only true if the skill is the same as the one that shows up on the actor command window alongside Guard and Item. So skill 1 in most cases.

    then

    you are sure your skill has the element set to element 4 in your terms? this will not adjust for skills with the normal attack element with a fire attack element trait
    Ah, good to know. However I originally had it as isPhysical(), but that didn't do anything either, so I tried isAttack() to see if it changed, but nope, it still doesn't do as it should.

    And for fire, I'm using an item that does HP damage with fire as its element. Which worked previously with Visustella. Is there a way to check if any weapon, skill, or item has an element attached to it in any way? I haven't come across that yet in my searches.
  6. starguy said:
    However it's not working and I'm not sure why.
    Aside from the isAttack() part that @Robro33 pointed out - this does not refer to the current Game_Action.

    Per the documentation, there is a skill variable provided for that purpose.
  7. ATT_Turan said:
    Aside from the isAttack() part that @Robro33 pointed out - this does not refer to the current Game_Action.

    Per the documentation, there is a skill variable provided for that purpose.
    Alright. Over the weekend I tried that plus a few other things out, also changing 'target' to 'user' since I saw the notation that 'user' is for the actor/enemy the tag is attached to. So far it all results the same.

    Code:
    <Action Damaged Eval>
      const fire = 4;
      if (skill.isPhysical() && value > 0) {
        user.setHp(0); 
      } else if (this.item().damage.elementId === fire) {
        user.removeState(state.id);
      }
    </Action Damaged Eval>

    I guess I'll ask straight forward, haha: how should this be written to function as it should? If I can understand one, I'm hoping that will help me convert the others I have.
  8. starguy said:
    So far it all results the same.
    Because your notetag still has this in it. You only corrected one conditional.

    starguy said:
    Code:
    } else if (this.item().damage.elementId === fire) {
    should be
    Code:
    } else if (skill.item().damage.elementId == fire) {
    (although I don't personally get the point of an entire extra line of code to make a variable named fire just to use it one time, instead of just checking whether elementId == 4).

    starguy said:
    I tried...also changing 'target' to 'user' since I saw the notation that 'user' is for the actor/enemy the tag is attached to.
    I suppose I should clarify that in the documentation. That is only true for the state-timing-related notetags.

    For anything that resolves during an action, this functions identically to the Yanfly and VisuStella notetags - user is always the battler performing the current action and target is the target of that action.

    Good luck with your project.
  9. ATT_Turan said:
    Because your notetag still has this in it. You only corrected one conditional.


    should be
    Code:
    } else if (skill.damage.elementId == fire) {
    (although I don't personally get the point of an entire extra line of code to make a variable named fire just to use it one time, instead of just checking whether elementId == 4).


    I suppose I should clarify that in the documentation. That is only true for the state-timing-related notetags.

    For anything that resolves during an action, this functions identically to the Yanfly and VisuStella notetags - user is always the battler performing the current action and target is the target of that action.

    Good luck with your project.
    True, I was focusing on getting hit with a physical attack and killing the target figured out first. I'll try different eval tags and see if I can get it working, like <Action Reaction Eval>.
  10. starguy said:
    True, I was focusing on getting hit with a physical attack and killing the target figured out first. I'll try different eval tags and see if I can get it working, like <Action Reaction Eval>.
    I don't see how a difference in timing would matter in your case.

    If the damage from the incoming attack will kill the target, setting the HP to 0 doesn't change anything and the state will get removed.

    If anything, sticking it into Action Reaction would make it look weird, as you might see the battler drop dead before the damage is visually dealt.

    To clarify, are you saying you're still having issues with this working with the corrections I gave you above?

    As a side note, I would almost always avoid the use of setHp() directly. Aside from any technical glitches, I think it would look weird for my Frozen actor with 200 HP to get hit for 12 fire damage and die.

    I would, instead, just change the value of the attack to be equal to the current HP. However, that nuance doesn't matter if you're saying it still doesn't work at all.
  11. ATT_Turan said:
    I don't see how a difference in timing would matter in your case.

    If the damage from the incoming attack will kill the target, setting the HP to 0 doesn't change anything and the state will get removed.

    If anything, sticking it into Action Reaction would make it look weird, as you might see the battler drop dead before the damage is visually dealt.

    To clarify, are you saying you're still having issues with this working with the corrections I gave you above?

    As a side note, I would almost always avoid the use of setHp() directly. Aside from any technical glitches, I think it would look weird for my Frozen actor with 200 HP to get hit for 12 fire damage and die.

    I would, instead, just change the value of the attack to be equal to the current HP. However, that nuance doesn't matter if you're saying it still doesn't work at all.
    Ah, good to know about Action Reaction.

    So the deal with this state mirrors the same status effect from Final Fantasy 9; when a battler is 'frozen' they cannot do a thing. If they're hit with a physical attack, they essentially shatter and die, an instant KO, regardless of how much HP they currently have. However, if attacked with anything that has the fire element attached, it melts the ice and they return to normal. As a thought, perhaps I should avoid that including weapons that deal physical damage and have the fire element as the damage type; keep it to spells only.

    Currently, over all, I haven't been able to get it to work, even in a new project with this as the only plugin installed. I'm just looking for help to get it figured out haha.

    Rather than setHP() to 0, would performCollapse() be better?
  12. starguy said:
    Currently, over all, I haven't been able to get it to work, even in a new project with this as the only plugin installed. I'm just looking for help to get it figured out haha.
    Then you should show the current code of the notetag and a screenshot of the state from your database.

    When you say you can't get it to work, are there any errors when you press F8 during the game and look at the Console tab? Or is just nothing happening?

    starguy said:
    Rather than setHP() to 0, would performCollapse() be better?
    As I mentioned above, I think changing value would be better, but what you have looks at first glance like it should work.
  13. ATT_Turan said:
    Then you should show the current code of the notetag and a screenshot of the state from your database.

    When you say you can't get it to work, are there any errors when you press F8 during the game and look at the Console tab? Or is just nothing happening?


    As I mentioned above, I think changing value would be better, but what you have looks at first glance like it should work.
    No errors show up in the log, no.

    This is what I've got so far! Screenshot is attached as well.

    Code:
    <Action Damaged Eval>
      if (skill.isPhysical() && value > 0) {
        target.performCollapse();
      } else if (skill.damage.elementId == 4) {
        target.removeState(state.id);
      }
    </Action Damaged Eval>
  14. starguy said:
    This is what I've got so far! Screenshot is attached as well.
    So you are using the incorrect notetag. Per the documentation, Action Damaged is checked on the user after inflicting damage, but you've put this in the state that would be on the target so it will not be getting evaluated when they're hit.

    I also don't know why you changed it to performCollapse() when I said that wasn't a better idea - all that's going to do is glitch your battle because it'll play the sound effect/visuals of the battler dying without actually killing them and removing them from the fight.

    Using an appropriate notetag and taking my earlier suggestions into account, this works fine in my test game:
    Code:
    <Action Reaction Eval>
      if (skill.isPhysical() && value > 0)
        value = target.hp;
      else if (skill.item().damage.elementId == 4)
        target.removeState(state.id);
    </Action Reaction Eval>

    I did make a mistake previously regarding the syntax for skill as I haven't looked at this plugin in a while. This is correct, and I've corrected it in my earlier post.
  15. ATT_Turan said:
    So you are using the incorrect notetag. Per the documentation, Action Damaged is checked on the user after inflicting damage, but you've put this in the state that would be on the target so it will not be getting evaluated when they're hit.

    I also don't know why you changed it to performCollapse() when I said that wasn't a better idea - all that's going to do is glitch your battle because it'll play the sound effect/visuals of the battler dying without actually killing them and removing them from the fight.

    Using an appropriate notetag and taking my earlier suggestions into account, this works fine in my test game:
    Code:
    <Action Reaction Eval>
      if (skill.isPhysical() && value > 0)
        value = target.hp;
      else if (skill.item().damage.elementId == 4)
        target.removeState(state.id);
    </Action Reaction Eval>

    I did make a mistake previously regarding the syntax for skill as I haven't looked at this plugin in a while. This is correct, and I've corrected it in my earlier post.
    Ah ok. I think understanding correctly how to use target and user got me a bit.

    This definitely works in my test project, as you said! So that's great. I haven't had it work in a clean project yet. So with that, it doesn't seem to work in my current project, which is fine because now I know it should work and I can troubleshoot what other plugins are causing the problem.

    Thanks for taking the time to help me out with this @ATT_Turan ! Much appreciated.
  16. Hey @ATT_Turan , thanks so much for this awesome plugin. I'll give you a sense of something I'm trying to do with it, and you'll let me know if its possible. First, assume I am very dumb (I am), but I don't see any specific notetags that specifically are for when an actor DIES with a State. So the closest I could find was <State Remove Eval> which at least SHOULD trigger upon death, right? It's not ideal, as if the thing gets removed in some other way, it would still trigger, but I could theoretically make this particular state unremovable by any other means except death or end of battle, I guess.

    At any rate, I'm trying to do this. I want to to make a "Parasite" style skill that infects an enemy with a State. Upon death, I want this Parasite to "explode" and harm the rest of the enemies in some way. Okay, so, I tried this in the State note box:


    Code:
    <State Remove Eval>
    const dmg = Math.floor(user.mhp / 3);
    $gameTroop.aliveMembers().forEach(enemy => {
      if (enemy !== user) {
        const result = enemy.result();
        result.clear();
        result.used = true;
        result.hpDamage = dmg;
        enemy.gainHp(-dmg);
        enemy.startDamagePopup();
        enemy.refresh();
      }
    });
    $gameMessage.add(" parasite triggered!");
    $gameScreen.startFlash([255, 0, 0, 160], 60);
    $gameScreen.shake(5, 5, 30);
    </State Remove Eval>

    At first, when the affected enemy was killed, I couldn't get anything to happen. Thought maybe I wrote things poorly. But okay, I tried something else, I changed the StateId to checkmark "remove upon any damage," and set the enemy HP a little higher so an attack didn't kill it. I hit the infected enemy and BOOM, all those things above triggered. The enemies HP was 12, it hit every other enemy for 4. Great, it worked! But I cannot for the LIFE of me get this thing to activate on Death. It's like the state isn't removed upon death? Is there some way to make that happen, or trigger it upon death? Or am I just dumb (very likely) and missing something obvious?

    Thanks so much for any advice you might have on this one!
  17. orgint said:
    It's like the state isn't removed upon death? Is there some way to make that happen, or trigger it upon death? Or am I just dumb (very likely) and missing something obvious?
    no, your observation is good. when a battler dies, the way its states are removed is handled in a fairly unique way compared to all other instances of removal. the plugin isnt set to catch it.

    try adding this as an extension to his original plugin. its an application of his yanfly buffs and states core fix for the same topic.
    Code:
    Game_BattlerBase.prototype.clearStates = function()
    {
      if (this._states)
      {
        for (let i=0; i<this._states.length; i++)
        {
            this.oneStateEval("stateRemoveEval", this._states[i]);
        }
      }
        this._states = [];
        this._stateTurns = {};
    };
  18. @orgint Nope, not a dumb question.

    You could do what @Robro33 suggested - the other solution could be to put it as an Action Reaction. Something like
    Code:
    <Action Reaction Eval>
    if (value >= target.hp)
    // do your parasite stuff
    </Action Reaction Eval>

    Unless you have other state wizardry that could prevent the target from dying when they take damage which would remove the last of their HP, that should also do what you want.

    But I should probably do what Robro suggested and put my own code into my own plugin - it's a situation I fixed in Yanfly's plugin, but didn't think to account for in mine :guffaw:

    Edit: Fixed with version 2.0.

    And as far as this concern:
    orgint said:
    It's not ideal, as if the thing gets removed in some other way, it would still trigger

    Simply check for that in your code.

    Code:
    <State Remove Eval>
    if (user.hp <= 0)
    {
        // put all your code in here
    }
    </State Remove Eval>
    (Edit: corrected)
  19. Amazing, thank you both for these excellent solutions!! I really appreciate it :)

    Edit: Just tested with version 2.0 -- works great with the notetag script I was using. In the event of death, the script fires off now! The only problem is, if I try the method of adding an hp check like above: "if (target.hp <= 0)," then nothing happens at all on death!
  20. orgint said:
    Amazing, thank you both for these excellent solutions!! I really appreciate it :)

    Edit: Just tested with version 2.0 -- works great with the notetag script I was using. In the event of death, the script fires off now! The only problem is, if I try the method of adding an hp check like above: "if (target.hp <= 0)," then nothing happens at all on death!
    Sorry, my error - I haven't used the plugin in a while. Per the documentation, only the Action notetags have a target variable.

    Just change what I gave you to user.hp instead of target