Dynamic Traits and Effects

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,770
Reaction score
12,204
First Language
English
Primarily Uses
RMMV
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):

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:

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
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?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,770
Reaction score
12,204
First Language
English
Primarily Uses
RMMV
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?
 

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
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 !
 

gRaViJa

Veteran
Veteran
Joined
Mar 16, 2012
Messages
806
Reaction score
290
First Language
Dutch
Can this also be used on consumable items to permanently increase a character's resistance vs a certain element or state?
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,770
Reaction score
12,204
First Language
English
Primarily Uses
RMMV
If it has traits or effects, this can be used.
 

ShadowfireOmega

Finally found out how to change this!
Veteran
Joined
Jan 1, 2016
Messages
39
Reaction score
3
First Language
English
Primarily Uses
N/A
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?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,770
Reaction score
12,204
First Language
English
Primarily Uses
RMMV
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.
 
Last edited by a moderator:

ShadowfireOmega

Finally found out how to change this!
Veteran
Joined
Jan 1, 2016
Messages
39
Reaction score
3
First Language
English
Primarily Uses
N/A
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..)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,770
Reaction score
12,204
First Language
English
Primarily Uses
RMMV
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.
 
Last edited by a moderator:

ShadowfireOmega

Finally found out how to change this!
Veteran
Joined
Jan 1, 2016
Messages
39
Reaction score
3
First Language
English
Primarily Uses
N/A
Oh, I see xD It needs to be part of an event :p tyvm
 

Bahamut20

Can I edit this?
Veteran
Joined
Jul 7, 2015
Messages
42
Reaction score
9
First Language
English/Spanish
Primarily Uses
I'm getting an error "Object is not a function" when using $gameVariables(64) for the id.
 
Last edited by a moderator:

Aidensmercy

Veteran
Veteran
Joined
Oct 29, 2015
Messages
121
Reaction score
24
First Language
english
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".
 

HintonR

Veteran
Veteran
Joined
Mar 2, 2016
Messages
197
Reaction score
25
First Language
English
Primarily Uses
RMMV
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,770
Reaction score
12,204
First Language
English
Primarily Uses
RMMV
@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)
 
Last edited by a moderator:

HintonR

Veteran
Veteran
Joined
Mar 2, 2016
Messages
197
Reaction score
25
First Language
English
Primarily Uses
RMMV
Random thing also. Can I rename the plugin without affecting it? Just to easily refer to it easier. And little OCD haha. 
 

Aidensmercy

Veteran
Veteran
Joined
Oct 29, 2015
Messages
121
Reaction score
24
First Language
english
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.

here's my command that I'm using





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





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





In game before the event





after the event, nothing happens or changes


 

Michael Caiola

The Stone Bull
Veteran
Joined
Sep 14, 2016
Messages
392
Reaction score
74
First Language
English
Primarily Uses
Just found this plugin. You saved my life!


Well, not my life, but you made me very happy
 

TakaDynasty

Apologetic Lurker
Veteran
Joined
Dec 21, 2016
Messages
41
Reaction score
8
First Language
English
Primarily Uses
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
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,770
Reaction score
12,204
First Language
English
Primarily Uses
RMMV
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
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

buinguyenhoangtho wrote on fizzly's profile.
Hello @fizzly, i would like to use your asset/ resource for my project ( is maybe commercial ). May i have your permission? Thanks you !
Working on breaking the limits of RPGMaker! :cool:
I have 470+ hours on RMMV but have only made a demo game, is this normal? :kaoswt: (I lose motivation a lot plus I use a 32gb laptop, so..)
I like Iron Maiden.
Benku wrote on Magnus0808's profile.
Hey man you helped me out a long time ago with a plugin i was wondering if you can help me out one more time since its literally the last thing i need help with if not is cool but id figured id ask you one more soild.

Forum statistics

Threads
95,427
Messages
929,082
Members
125,659
Latest member
AphoticAmaranth
Top