NeMV - Tags

● ARCHIVED · READ-ONLY
Started by Nekoyoubi 17 posts View original ↗
  1. Plugin: NeMV - Tags


    Version: 1.2.3


    Author: Nekoyoubi


    Release: March 28th 2016


    Download: https://raw.githubusercontent.com/nekoyoubi/NeMV/master/NeMV_Tags.js


    Introduction


    This plugin allows actors, enemies, classes, skills, states, items, weapons, armors, and events to be tagged and those tags to be easily retrieved via script.


    Features

    • Simple notetag syntax
    • Applies to nearly any object (now even events!)
    • Reduces conditional blocks considerably



    Example Use Cases


    The general usage below should give you a couple of ideas, but in case you miss them here are the examples mentioned, and maybe a few others:

    • Adding/removing states to items (e.g. fresh/spoiled food)
    • Defining thematic categories of items (e.g. scientific/magical)
    • Giving enemies traits to affect the behaviors of skills (e.g. weapons that hurt plants extra)
    • Giving actors/enemies a gender to better influence random conversation (e.g. "Yeah, girl power!" when all party actors are tagged female)
    • Changing the user experience dynamically (e.g. only show crafting UI options when the party actually has a crafting material)
    • Customizing skills (e.g. only purge positive states from an enemy without specifying every possible buff)
    • Tracking event activation (e.g. how many treasure chests the player opens or elders they talk to)
    • Add visual markers to types of events (e.g. highlight all "harvestable" plants on a common event)



    Anyway, those are just a few things that come to mind (and a couple that I'm using in my project currently), but I'm sure there are many, many more that can surface over time.


    How to Use


    Add tags to your actor, class, enemy, skill, state, item, weapon, armor, or event as illustrated below.


    Multiple tags per entry can be separated by white-space or commas, and tags are case insensitive.


    Add tags to events via the Comment event command.


    <Tags: Plant>


    ... or...


    <TAGS: root, red, alchemy>


    ... or...


    <tags: BOSS FIRERESIST EXTRAGOLD>


    Once your tags are added, they can be accessed in almost any location via:


    [Object].hasTag("plant") // for exact tag checking

    // ... or you can use asterisks to specify wild-card tag searches (v1.1)...

    [Object].hasTag("*RESIST") // for performing a wild-card search looking for anything that ends with "resist"


    This will return a boolean result indicating whether your object contains that tag or not. Tags can also be added and removed programmatically by calling either:


    [Object].addTag("spoiled")


    ... or...


    [Object].removeTag("fresh")


    Note: Removing a tag that does not exist will NOT throw an error.


    Events Note: Due to the volatile nature of events, adding and removing tags dynamically is not currently possible. Tags on events do change between the events pages; they simply cannot be addTag()/removeTag()'d.


    A couple of utility methods have also been added to allow you to quickly scan the party for tags on items they either possess or have equipped, or tags on states they may have active.


    NeMV.Tags.AnyPartyItemsHaveTag("magical")


    ... will return true if the party possesses any items tagged as "magical".


    NeMV.Tags.AnyPartyStatesHaveTag("weapon")


    ... will return true if a party actor has a state tagged as "weapon".


    NeMV.Tags.EventsThatHaveTag("harvestable")


    ... will return a collection of Game_Event objects tagged as "harvestable".


    Script (external)


    NeMV on GitHub  | Tags on GitHub  | Tags on MV Plugins  | Tags on Stitch Gaming | >> Download Tags <<


    FAQ


    Q: Does this work with YEP - ______?


    A: There is some additional support for YEP - Item Core, and that works assuming you use... 


    DataManager.getBaseItem(item)


    Other than that, I don't know of any conflicts with anything in the YEP.


    Q: Is this able to be used in commercial projects?


    A: Absolutely! Wouldn't that be cool?!


    Q: If I use this, do I need to say so anywhere?


    A: If you can make use of my work on any level, then I would absolutely love to know about it, but I make no attribution requirements or the like. NeMV is licensed under the WTFPLv2.


    Credits & Thanks

    • Yanfly for always giving such awesome feedback!



    Author's Notes


    I put together this little plugin that I thought may be of use to someone, and since I don't have any real posts here yet, I thought I'd give it a go. Happy tagging!
  2. I think that is one of the MOST useful utility plugin I have seen!


    Thank you!
  3. Hi!


    Great plugin, thank you!


    I don't know much about JS programming but I managed to make this work with Yanfly's Item Core / Augment Attachments by using ._equips[x].hasTag("x") instead of .equips()[x].hasTag("x") to check an independent armor's or weapon's tags. For some reason $gameActors.actor(x).equips()[x].hasTag("x") didn't work for me. I don't know what the difference between those two is but apparently it matters....My game kept crashing. I could have used the script call with DataManager.getBaseItem(item) but that only gives you the tags of the base item, no? I needed the tags of the independent item because I add and remove tags with augments during the game.


    To dynamically add or remove a tag with an augment, I used this:

    Code:
    <Augment Attach Eval: Test>
    item.tags.push("test".toUpperCase());
    </Augment Attach Eval: Test>
    Code:
    <Augment Detach Eval: Test>
    var index = item.tags.indexOf("test".toUpperCase());
    if (index > -1) item.tags.splice(index, 1);
    </Augment Detach Eval: Test>

    Cause item.addTag("x") and item.removeTag("x") didn't work for me, so I copied over the content of the functions from the Tags plugin.


    Took me a while to figure this out, I hope it helps people who have the same problem I had! It's possible that I used the instructions wrong or made things utterly overcomplicated but I was just trial and erroring for the last hour with no idea what I was even doing and this is the result.
  4. How would I use this plugin to create an exorcism skill that can only harm demons and the undead, then?
  5. Hey, I'm loving the plugin but I'm not able to check if the actor has a weapon with a tag. What method should I use? Using user.hasTag() only Works if the actor has the tag, but not if the actor has a sword with such tag. Thank you for your time :rhappy:
  6. I love your plugin, THANK YOU! :kaothx:
  7. Oh my god this is so amazing! I really needed something like this, I was doing this the hard way (checking for large lists of IDs and Common Events), this saves me a lot of painful work. Thank you so much!
  8. Hello! Are the tags saved in the save file and after the game is restarted, the changes will be saved?
  9. moonraydreiko said:
    Hello! Are the tags saved in the save file
    No. You enter the tags in the editor's database.
  10. Hmm, this looks to be incredibly useful if I am understanding it correctly. Surprised this thread doesn't have more activity. Will be playing with this in a bit and hopefully be able to provide some example usecases before too long.
  11. Gilgameshed said:
    Hmm, this looks to be incredibly useful if I am understanding it correctly. Surprised this thread doesn't have more activity. Will be playing with this in a bit and hopefully be able to provide some example usecases before too long.
    I used to use this script a lot but found out you could easily do the same thing without a script using plain ol JavaScript.

    A skill notetag of
    <cool>

    Can be accessed with skill.meta.cool !== undefined
  12. boomy said:
    I used to use this script a lot but found out you could easily do the same thing without a script using plain ol JavaScript.

    A skill notetag of
    <cool>

    Can be accessed with skill.meta.cool !== undefined
    Cool, thanks for that. I am still just getting familiar with js and have not encountered the .meta. tag yet, so this will likely be useful in the future. I am guessing you would create an if condition with skill.meta.cool !== undefined and then run the code associated per each skill, or enemy/actor/class, to more or less cut down on how many conditions would need to be ran if not grouping things together.

    Say custom dialogue that would occur if class.meta.cool is present in the party to lead to unique conversation, as opposed to individually putting in each class one by one.

    If that is the case, then I think I have that figured out and this can definitely be of use to me.
  13. ATT_Turan said:
    No. You enter the tags in the editor's database.
    I see, thanks.
    I wanted to use this plugin in order to add properties equipment "seen" or "not seen" NPC. But addTag() removeTag() does not change the records of items/armors in database or save file ((

    Do you know if there are any plugins that can add modifiable properties to equipment or items?
  14. moonraydreiko said:
    I wanted to use this plugin in order to add properties equipment "seen" or "not seen" NPC.
    Why can't you just use the built-in functionality and flip one of their self-switches?
  15. ATT_Turan said:
    Why can't you just use the built-in functionality and flip one of their self-switches?
    Most likely, I will have to do it through them or through arrays. But it will be a lot of if-else...

    There was such an idea.
    The player can use different equipment and there are several NPCs, who might notice the player.
    I wanted to make sure that after the player was caught NPS, the equipment tags are recorded <tags: SAWNPC1 SAWNPC2 SAWNPC3> and then the NPCs have different dialogues, depending on who saw and whether the player is equipping this thing now.
  16. @moonraydreiko Okay.

    Well, as none of this really has anything to do with this plugin, your questions would go better in your own thread in MV Support.
  17. Ok)
    But it would be great if this plugin has a version with the ability to save tag changes to a save file!