
var maxweapondam = parseInt(getAttrByName(who.id, 'damage', 'max') * 2);
var minweapondam = parseInt(getAttrByName(who.id, 'damage'));
var damageroll = randomInteger(maxweapondam) + minweapondam;
if (damageroll > maxweapondam)
{
damageroll = maxweapondam;
} Attribute damage has a value of 2 and max of 6. This is to simulate damage from a weapon that does 2d6 worth of damage. So the minimum value that should be returned from this simulated dice roll should be 2 and the max 12. While the maxdamage is never over 12, I can not get the minimum damage to be 2. I am logging damageroll and the lowest number in the series is 3, over a good 30 rolls. when I log minweapondam I am returned 2. I know randomInteger(max) can return 0 that's is what the minweapondamage is set to the number of dice as the lowest each can roll is 1. 1+1=2 so why does this never produce minweapondam? Edit: after further testing I have concluded that randomInteger(max) will return a value of 1 through max. So I guess I need to add and if statement after to check if the return was a 1, and if it was, set damageroll to equal minweapondam. Edit 2: Yep, works like a charm now.