Eval Tags MZ

● ARCHIVED · READ-ONLY
Started by ATT_Turan 62 posts Page 1 of 4 View original ↗
  1. Eval Tags 2.0
    ATT_Turan

    Introduction
    I have found I often recommend plugins to people solely for the ability to use notetags to execute code at times when events are not accessible. However, there are situations where those plugins include many other features that the user may not want in their project.

    So, inspired by @AquaEcho's list of plugin alternatives, I've made this one-stop shop for eval notetags.

    I have tested the basic functionality, but due to the scope I expect there will be errors - please let me know and I will address them as found. I am also amenable to requests for additional notetags at other times.

    Features
    The entirety of this plugin's features are in the extensive list of notetags to cover a wide variety of timing situations.

    These times include in the flow of a battle, the flow of an action, and the lifespan of a state.

    How to Use
    All notetags provide a "user" variable to refer to the actor/enemy the tag is attached to. Other variables are provided depending on context.

    All notetags are in the format:
    Code:
    <notetag title>
    code
    </notetag title>

    Battle-related notetags occur in the following order:

    Actor, Enemy, Class, Weapon, Armor, and State notetags

    <Battle Before Eval>
    <Battle Start Eval>
    <Turn Start Eval>
    <Regenerate Eval>
    <Turn End Eval>
    <Escape Failed Eval>
    <Escape Succeeded Eval>
    <Defeated Eval>
    <Victory Eval>
    <Battle End Eval>
    <Battle After Eval>

    The following notetags include a "target" variable for the target of the action, a "skill" variable for the current action, and a "value" variable referencing the damage dealt where applicable.

    They are resolved in the following order:

    Actor, Enemy, Class, Weapon, Armor, and State notetags

    <Action Start Eval> - performed by the user, also a Skill notetag
    <Action Targeted Eval> - performed by the target
    <Action Hit Eval> - performed by the user on a successful hit
    <Action Reaction Eval> - performed by the target on a successful hit
    <Action Apply Eval> - a Skill notetag
    -- action is resolved --
    <Action Post-Apply Eval> - a Skill notetag
    <Action Damaged Eval> - performed by the user after successful damage
    <Action Respond Eval> - performed by the target after successful damage
    <Action After Eval> - performed by the user whether it hit or not; also a Skill notetag
    <Action Finish Eval> - performed by the target whether it hit or not

    The following notetags include a "stateId" variable for the ID of the state.

    State notetags

    <State Apply Eval> - executed when a state is added to a battler
    <State End Eval> - executed when a state expires
    <State Remove Eval> - executed when a state is removed in any way

    Terms and Credits
    Free for non-commercial and commercial use. Credit ATT_Turan.
  2. are those applied to MV as well or only MZ?
    I see a cool notetag for state:

    <State Apply Eval>
    $gameMessage.add("oh no, what happend to me..!")
    </State Apply Eval>

    <State End Eval>
    // big explosion animation (actor died)
    // game over (usefull for 1 actor or affects all party members to be killed!
    </State End Eval>

    but it seems really usefull if it works with all plugins or just those ^^
  3. ShadowDragon said:
    are those applied to MV as well or only MZ?
    These are for MZ.

    For MV, Yanfly's Buffs & States Core is a pretty lightweight plugin, so you could use the Custom Apply and Custom Remove notetags the way you describe.
  4. I need state and buff core, but so far I see the code, it could work in MV as well,
    just not entirely sure of Game_Unit part, but the rest works, even the ?? if nwjs
    is higher than 4.8.x that is or it throws an error.

    anyway, it's a cool looking plugin for people not using many plugins if it works
    without any 3rd-party plugin (as in stand alone).

    keep up the nice work though ^^
  5. Fixed an error when the player loses in battle.
  6. Two that you might find high demand for based on how often I see people talking about those effects or asking how to do them are when an action crits, and when an action is evaded or misses.
  7. Trihan said:
    Two that you might find high demand for...
    Thanks for the suggestions!

    Critical can be checked using Action Damaged or Respond, and the conditional
    if (target.result().critical)

    Evade or miss would use Action After or Finish, and
    Code:
    if (target.result().evaded)
    if (target.result().missed)
  8. ATT_Turan said:
    Thanks for the suggestions!

    Critical can be checked using Action Damaged or Respond, and the conditional
    if (target.result().critical)

    Evade or miss would use Action After or Finish, and
    Code:
    if (target.result().evaded)
    if (target.result().missed)
    They can, yes. I'm just suggesting a shorthand tag specifically for those to make it easier. :)
  9. Hey Hey

    I am trying to use in a skill:

    <Action Start Eval>
    $gameVariables.setValue(44, 10);
    </Action Start Eval>

    to set a variable at the start of the skills use. Am I using the correct notetagging? Asking cause obviously its not changing on my end. So not sure what I'm doing wrong here.


    EDIT: No Urgency here, while It'll still be good to know what I'm doing wrong, I'm realizing I don't actually need to set a variable this way anymore with my updated battle motions.
  10. @Puppet Knight Action Start is not a skill notetag.

    Is there something you need to capture before Action Apply?
  11. ATT_Turan said:
    @Puppet Knight Action Start is not a skill notetag.

    Is there something you need to capture before Action Apply?
    I figured that was the problem. It would be nice to be able to use all the Action Tags to allow users to set variables or perform any checks on the fly that could affect damage calcs or do cool things like alter the actors Image/Motions.


    I know its doable by setting them on the Actor directly and having them check the skill note tag via script call, but always nice to have options
  12. @Puppet Knight It could be altered but I had some reason in my head for doing it that way to begin with.

    You didn't answer whether just using Action Apply works or there's something that changes between start and apply that you need to get.
  13. ATT_Turan said:
    @Puppet Knight It could be altered but I had some reason in my head for doing it that way to begin with.

    You didn't answer whether just using Action Apply works or there's something that changes between start and apply that you need to get.


    I don't fully know how to answer your question so I'll be frank in my intention. Looking for a way to effectively replace the skill note tags of Battle Core.
  14. @Puppet Knight Okay...well, if you don't know what you're trying to do, I guess the answer is use Action Apply in the skill notes :p
  15. ATT_Turan said:
    @Puppet Knight Okay...well, if you don't know what you're trying to do, I guess the answer is use Action Apply in the skill notes :p

    I know what I'm trying to do. I already gave an example. Your question was confusing because I did say
    Puppet Knight said:
    allow users to set variables or perform any checks on the fly that could affect damage calcs or do cool things like alter the actors Image/Motions.

    Those would be pre apply. Pre Start Action and Post Start Action would be useful timing as well as pre and post end action. So specifically pre and post applies.

    Which is why I was trying to use specifically:

    <Action Start Eval>
    $gameVariables.setValue(44, 10);
    </Action Start Eval>
  16. Puppet Knight said:
    set variables or perform any checks on the fly that could affect damage calcs
    Damage calculation is a part of applying the action, so Action Apply can do that.

    Puppet Knight said:
    I know its doable by setting them on the Actor directly and having them check the skill note tag via script call
    That sounds strange, I dunno why you'd do that.

    It's pretty trivial to add a post-apply skill notetag. I'd have to look and see how many times I've ever told someone to use Yanfly's Before Eval and After Eval to see if it's worth adding equivalents.

    I'll update later today.
  17. Version 1.2 added an Action Post-Apply for skills.

    It also executes Action Start and Action After notetags when placed in skills.

    Note that while those notetags are the same for actors (and their attached objects) and skills, the this will be different.
  18. ATT_Turan said:
    Version 1.2 added an Action Post-Apply for skills.

    It also executes Action Start and Action After notetags when placed in skills.

    Note that while those notetags are the same for actors (and their attached objects) and skills, the this will be different.

    Woot!

    For the After I had some pretty extensive use of the of <JS Pre-End Action>


    <JS Pre-End Action>
    user.aspect = 1;
    user.set = 1;
    </JS Pre-End Action>

    For example to set some property values after an action is applied. The timing mattered since the availability of other skills was impacted by those properties. And even the UI would be impacted if the properties were set too soon.

    Not to mention the modified version of a notetag you helped me with a while back for AP gain:



    <JS Pre-End Action>
    const skillId = this.item().id;
    if (this.isSkill()) {
    const matchedSkills = equipmentNote.match(/<skills: (\d+(?:;\d+)*)>/);
    if (matchedSkills) {
    const skillIds = matchedSkills[1].split(';').map(Number);
    if (skillIds.includes(skillId)) {
    user.gainSkillAP(skillId, 1);
    }
    }
    }
    </JS Pre-End Action>
  19. Have not worked much with MZ specifically, but these kind of hooks were always really useful and easy to use.

    One detail that would come to mind right now, but might be intended, would be that "State Removal Eval" is currently not triggered when the state is cleared through the "State Resist" trait or Death/Recover All, which would be useful to have in cases where you want to clean up something you set up earlier in the same state.

    ATT_Turan said:
    It's pretty trivial to add a post-apply skill notetag. I'd have to look and see how many times I've ever told someone to use Yanfly's Before Eval and After Eval to see if it's worth adding equivalents.
    Maybe no longer relevant, but I found "After Eval" in particular to be really useful whenever I would want a custom effect for a skill that might not have a damage formula.
    Admittedly I've rarely used "Before Eval", but it has come in very handy to temporarily add a state to the user/target for the duration of the hit (e.g. "increase ATK by 50% against fire weak targets")
  20. Another Fen said:
    One detail that would come to mind right now, but might be intended, would be that "State Removal Eval" is currently not triggered when the state is cleared through the "State Resist" trait or Death/Recover All
    Good call! I assumed those used removeState(), but I've uploaded version 1.3 that moves the Remove Eval hook to cover those scenarios.

    Another Fen said:
    Maybe no longer relevant, but I found "After Eval" in particular to be really useful whenever I would want a custom effect for a skill that might not have a damage formula.
    Yeah, that's the big draw there.

    Another Fen said:
    Admittedly I've rarely used "Before Eval", but it has come in very handy to temporarily add a state to the user/target for the duration of the hit (e.g. "increase ATK by 50% against fire weak targets")
    The Apply Eval would work for that; I think I've really only seen Before Eval used for niche scenarios like changing the actor's portrait for the duration of the action or something like that. Regardless, it's in :smile: