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):
Valid Effect Codes (value in JSON file - text to use in plugin):
Plugin
Download from pastebin
Credit
- Shaz
Terms
- free for use in commercial games
Notes
Post below if you need help setting up plugin commands
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):
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):
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
Last edited by a moderator:


