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.