So I found out the code for giving traits to an item, which is:
item.traits.push({"code":21, "dataId":2, "value":1.10}) --> this will give +10% ATK trait to the item
However, I'm struggling to make it so the value given is random from +5% to +10% and the dataID to random 0 to 7.
So the question is... how can I randomize these?
I tried using variables but it doesn't work 🙁
here's the code I tried that didn't work:
item.traits.push({"code":21, "dataId":2, "value":1.10}) --> this will give +10% ATK trait to the item
However, I'm struggling to make it so the value given is random from +5% to +10% and the dataID to random 0 to 7.
So the question is... how can I randomize these?
I tried using variables but it doesn't work 🙁
here's the code I tried that didn't work:
Code:
var statparams = ['0', '1', '2', '3', '4', '5', '6', '7'];
var randomStat = statparams[Math.floor(Math.random()*statparams.length)];
// then declare that randomStat is the dataId