Dynamic Traits and Effects

● ARCHIVED · READ-ONLY
Started by Shaz 20 posts View original ↗
  1. Dynamic Traits and Effects


    2015.11.26


    by Shaz


    Introduction


    This plugin allows you to add and remove traits and effects on database items during gameplay, and to put their values into variables for querying.


    How to Use


    Add to your plugins folder (file name is irrelevant, but I call mine DynamicTraitsAndEffects.js)


    To add or remove traits, use the following plugin commands:


    AddTrait class id traitCode dataId [value]
    RemoveTrait class id traitCode [dataId] [value]




    To add or remove effects, use the following plugin commands:


    AddEffect class id effectCode dataId [value1] [value2]
    RemoveEffect class id effectCode [dataId] [value1] [value2]




    To put the value of a trait or effect into a variable, use the following plugin commands:


    GetTrait var class id traitCode dataId
    GetEffect var1 var2 class id effectCode dataId




    class is the type of object your are changing or querying, and will be one of the following words: actor, class, skill, item, weapon, armor, enemy or state


    id is the object's id in the database


    traitCode and effectCode are tags that correspond to the titles in the Traits and Effects dialogue boxes (see spoiler below).  You need to use the words, not the numbers (so use TRAIT_ELEMENT_RATE rather than 11).


    dataId is the item in the drop-down list in the dialogue boxes.  When the list contains database items (like states, skills, elements) this will be the id of the item.  When the list does not contain database items (HP, maxHP, etc) the first item in the list is 0


    value, value1 and value2 are the values to populate in the trait or effect - if omitted, these will default to 0


    var, var1, var2 are variable ids that will be populated with the value of the traits (one value only) and effects (two values)


    The RemoveTrait and RemoveEffect plugins have optional parameters for dataId and values.  If not entered, ALL traits/effects with the trait/effect code will be removed


    Object id and values can be formulae as long as they have no spaces


    To determine the correct values to pass into the plugin, and whether numbers representing percentages should be whole numbers or fractions (ie 1 = 100% or 100 = 100%), the best thing to do would be to set up the trait or effect temporarily in the database, save, then view the appropriate json file in the Data folder.  The Online JavaScript Beautifier can be used to make it more readable.


    Valid Trait Codes (value in JSON file - text to use in plugin):

    Spoiler
    Code:
     *  11-TRAIT_ELEMENT_RATE      41-TRAIT_STYPE_ADD       61-TRAIT_ACTION_PLUS
     *  12-TRAIT_DEBUFF_RATE       42-TRAIT_STYPE_SEAL      62-TRAIT_SPECIAL_FLAG
     *  13-TRAIT_STATE_RATE        43-TRAIT_SKILL_ADD       63-TRAIT_COLLAPSE_TYPE
     *  14-TRAIT_STATE_RESIST      44-TRAIT_SKILL_SEAL      64-TRAIT_PARTY_ABILITY
     *  21-TRAIT_PARAM             51-TRAIT_EQUIP_WTYPE
     *  22-TRAIT_XPARAM            52-TRAIT_EQUIP_ATYPE
     *  23-TRAIT_SPARAM            53-TRAIT_EQUIP_LOCK
     *  31-TRAIT_ATTACK_ELEMENT    54-TRAIT_EQUIP_SEAL
     *  32-TRAIT_ATTACK_STATE      55-TRAIT_SLOT_TYPE
     *  33-TRAIT_ATTACK_SPEED
     *  34-TRAIT_ATTACK_TIMES



    Valid Effect Codes (value in JSON file - text to use in plugin):

    Spoiler
    Code:
     *  11-EFFECT_RECOVER_HP       41-EFFECT_SPECIAL
     *  12-EFFECT_RECOVER_MP       42-EFFECT_GROW
     *  13-EFFECT_GAIN_TP          43-EFFECT_LEARN_SKILL
     *  21-EFFECT_ADD_STATE        44-EFFECT_COMMON_EVENT
     *  22-EFFECT_REMOVE_STATE
     *  31-EFFECT_ADD_BUFF
     *  32-EFFECT_ADD_DEBUFF
     *  33-EFFECT_REMOVE_BUFF
     *  34-EFFECT_REMOVE_DEBUFF



    Plugin


    Download from pastebin


    Credit


    - Shaz


    Terms


    - free for use in commercial games


    Notes


    Post below if you need help setting up plugin commands
  2. Can this remove a state and store it in a variable to retrieve after battle? Like for example, if I want to create a skill that temporarily removes passive states, like Gastro Acid from pokemon, could this plugin do it?
  3. No. This plugin is so you can modify the traits and effects on database items (including states) during game play. It has nothing to do with adding or removing states or seeing what states have been applied.


    Maybe take a look at my State Add/Remove Commands plugin?
  4. Shaz said:
    No. This plugin is so you can modify the traits and effects on database items (including states) during game play. It has nothing to do with adding or removing states or seeing what states have been applied.Maybe take a look at my State Add/Remove Commands plugin?
    That may be the one I was thinking about when I saw this and got them mixed up. I'll try that one, thanks !
  5. Can this also be used on consumable items to permanently increase a character's resistance vs a certain element or state?
  6. If it has traits or effects, this can be used.
  7. I've been trying to get the following to work:

    AddTrait class 0001 51 01where class 0001 is 'Hero' and weapon type is sword, I've added it to the notebox of a skill (that does nothing else), and gave the skill to the class, started up a playtest and picked up a sword. I cannot equip it. I've even tried the following:

    <AddTrait class 0001 51 01>and

    <AddTrait: class 0001 51 01>but still nothing, what am I doing wrong?
  8. Trying to use a syntax that is completely different to the correct syntax shown is definitely not the way to get it to work ;)


    That is a plugin command, not something to put in the notebox.


    If you want the character to be able to equip that weapon as soon as they're given that skill, just set the trait in the skill's traits. You don't need to use this plugin at all for that.
  9. Skills don't have traits, only effects... unless I'm missing something the skills effects don't give equip options (Very possible I am missing something tho..)
  10. ah, I see what you mean.


    The command needs to be called from the 'Plugin Command'. It does not use note tags at all.


    So, at the point where you give the actor the skill, use Plugin Command, and enter all of that line.


    If the skill is ever removed, use Plugin Command, to enter the equivalent RemoveTrait call.


    If they gain the skill via levelling up, and it's set up in the Class tab, it's going to be a bit more difficult - we'd need to make a mod to the plugin to make it check for new skills, and probably at that time use the note box.
  11. Oh, I see xD It needs to be part of an event :p tyvm
  12. I'm getting an error "Object is not a function" when using $gameVariables(64) for the id.
  13. I can't seem to get this to work at all, maybe im just not understanding how to set it up or something.


    I am trying to make my main character learn a new skill type half way through the game.


    The plugin command im using with this is


    AddTrait actor 1 41 2


    what i get from that is... the "actor" id number "1" will (41)"TRAIT_STYPE_ADD" the 3rd skill type on the drop down list "2".
  14. Hey Shaz,

    I'm a little confused with the commands. Should I use brackets or what is the format I am suppose to use?
     


    Thank you.
  15. @HintonR - The new forum has messed up the format of the commands.  I have just redone them to look more correct.  


    No, you don't use brackets.  The items in [brackets] indicate that they may be optional - it depends on what trait/effect you're trying to modify.  If you need help, state what you're attempting to do, and I or someone else can give you the correct command.


    @Aidensmercy - Try changing the 2 to 3.  You only start at 0 for things that are not defined in the database, and skill type IS defined in the database.


    @Bahamut20 - $gameVariables.value(64) not $gameVariables(64)
  16. Random thing also. Can I rename the plugin without affecting it? Just to easily refer to it easier. And little OCD haha. 
  17. Shaz said:
    Try changing the 2 to 3.  You only start at 0 for things that are not defined in the database, and skill type IS defined in the database.



    Still didn't work. So i made you some pictures to see if you can figure out what's not working.

    Spoiler
    here's my command that I'm using


    YEdqSRS.png


    I want to add a new skill type to this actor, Number 1


    63XPvSw.png


    I want to add this skill type to the number 1 actor (3rd on the drop down menu)


    IyoDfza.png


    In game before the event


    Kvg52Oe.png


    after the event, nothing happens or changes


    hUdSySW.png
  18. Just found this plugin. You saved my life!


    Well, not my life, but you made me very happy
  19. Okay! Official support request post.

    Situation is this: I want an event to give Actor 1 a trait to buff him to 150% ATK.


    I currently have a test event that executes the following Plugin Command on action button:
        AddTrait actor 1 21 2 1.5

    ... and then pops up a text box, "Done", to inform me the event triggered.

    I've tried the above as well as 150 instead of 1.5, and either way I do it, the ATK value stays at 24. Tried putting it at both the top and bottom of my plugin list, too.

    Screenshots of my actor setup and how I'm calling the plugin command:


    1.png

    2.png
  20. Okay, had a more in-depth look at this.  Next time you show screenshots, please show the whole window - you've cropped out the actor list so I can't tell what actor you've got there.  I'm assuming it's actor 1 and you've already checked that, but sometimes it's not so obvious.  Entire windows are almost always more useful that cropped.  Alt+PrintScreen will get you the active window while eliminating the rest of the desktop background.


    The problem is that you've used the trait code rather than the name.


    From the plugin instructions:

    Code:
     * Valid Trait Codes (value in JSON file - text to use in plugin):
     *  11-TRAIT_ELEMENT_RATE      41-TRAIT_STYPE_ADD       61-TRAIT_ACTION_PLUS
     *  12-TRAIT_DEBUFF_RATE       42-TRAIT_STYPE_SEAL      62-TRAIT_SPECIAL_FLAG
     *  13-TRAIT_STATE_RATE        43-TRAIT_SKILL_ADD       63-TRAIT_COLLAPSE_TYPE
     *  14-TRAIT_STATE_RESIST      44-TRAIT_SKILL_SEAL      64-TRAIT_PARTY_ABILITY
     *  21-TRAIT_PARAM             51-TRAIT_EQUIP_WTYPE
     *  22-TRAIT_XPARAM            52-TRAIT_EQUIP_ATYPE
     *  23-TRAIT_SPARAM            53-TRAIT_EQUIP_LOCK
     *  31-TRAIT_ATTACK_ELEMENT    54-TRAIT_EQUIP_SEAL
     *  32-TRAIT_ATTACK_STATE      55-TRAIT_SLOT_TYPE
     *  33-TRAIT_ATTACK_SPEED
     *  34-TRAIT_ATTACK_TIMES



    So your plugin command needs to be:

    Code:
    AddTrait actor 1 TRAIT_PARAM 2 1.5