MV Draw parameters in YRCrafting plugin

I am using YRCrafting plugin, this plugin lets me use independent items from Yanfly Item Core as crafting materials by letting me choose which independent item to use while showing me the stats of it:
1.png

The plugin has settings that let me put the paremeters that can be show like this:
Sin título.png


Does anyone know how could I make it draw the special or extra paremeters? buffs and debuffs too
Hey,

I have not actually tested this yet, but this should theoretically work:

For EX-Parameters:
- Name:
"Hit Rate"
- Value:
let index = 0; item.traits.filter(t => t.code === Game_BattlerBase.TRAIT_XPARAM && t.dataId === index).reduce((res, t) => res + t.value, 0)
- Format:
Math.round(100 * val) + "%"

Replace the index with a number between 1 and 9 for the other Ex-Parameters. Since the name box is also interpreted as Javascript code you'd need to add the quotes there.

For SP-Parameters:
- Value:
let index = 0; item.traits.filter(t => t.code === Game_BattlerBase.TRAIT_SPARAM && t.dataId === index).reduce((res, t) => res * t.value, 1)
- Show Eval:
value !== 1

(That said, if you don't use randomized items you probably won't have items with multiple traits of the same type, so this solution might be a bit overkill.)

---

In case you want to try your hand at displaying other traits as well:

item.traits contains the traits of your item as an array, with each trait having the following properties:
code : the selected trait type, see below.
dataId : the selected option from the drop down menu (if available. If possible this is the database-ID of the selected option, otherwise it is its position in the drop down list, starting at 0)
value : The number field (if available, percentages are always stored as fractions of 1)

You can find the list of trait type codes in rpg_objects.js, line 2094ff. You can use either the number or the variable name in your code:
Spoiler
Code:
Game_BattlerBase.TRAIT_ELEMENT_RATE   = 11;
Game_BattlerBase.TRAIT_DEBUFF_RATE    = 12;
Game_BattlerBase.TRAIT_STATE_RATE     = 13;
Game_BattlerBase.TRAIT_STATE_RESIST   = 14;
Game_BattlerBase.TRAIT_PARAM          = 21;
Game_BattlerBase.TRAIT_XPARAM         = 22;
Game_BattlerBase.TRAIT_SPARAM         = 23;
Game_BattlerBase.TRAIT_ATTACK_ELEMENT = 31;
Game_BattlerBase.TRAIT_ATTACK_STATE   = 32;
Game_BattlerBase.TRAIT_ATTACK_SPEED   = 33;
Game_BattlerBase.TRAIT_ATTACK_TIMES   = 34;
Game_BattlerBase.TRAIT_STYPE_ADD      = 41;
Game_BattlerBase.TRAIT_STYPE_SEAL     = 42;
Game_BattlerBase.TRAIT_SKILL_ADD      = 43;
Game_BattlerBase.TRAIT_SKILL_SEAL     = 44;
Game_BattlerBase.TRAIT_EQUIP_WTYPE    = 51;
Game_BattlerBase.TRAIT_EQUIP_ATYPE    = 52;
Game_BattlerBase.TRAIT_EQUIP_LOCK     = 53;
Game_BattlerBase.TRAIT_EQUIP_SEAL     = 54;
Game_BattlerBase.TRAIT_SLOT_TYPE      = 55;
Game_BattlerBase.TRAIT_ACTION_PLUS    = 61;
Game_BattlerBase.TRAIT_SPECIAL_FLAG   = 62;
Game_BattlerBase.TRAIT_COLLAPSE_TYPE  = 63;
Game_BattlerBase.TRAIT_PARTY_ABILITY  = 64;


I hope this helps a bit.
I may have misunderstood the "buffs" part.
Edit:I made a mistake, I was putting 1 but it starts from 0 😛

Everything works perfectly!! Thank you so #€&%! much!

Original thread: https://forums.rpgmakerweb.com/threads/draw-parameters-in-yrcrafting-plugin.159054/