And here is the list of constants from "nwscript":
int DAMAGE_BONUS_1 = 1;
int DAMAGE_BONUS_2 = 2;
int DAMAGE_BONUS_3 = 3;
int DAMAGE_BONUS_4 = 4;
int DAMAGE_BONUS_5 = 5;
int DAMAGE_BONUS_1d4 = 6;
int DAMAGE_BONUS_1d6 = 7;
int DAMAGE_BONUS_1d8 = 8;
int DAMAGE_BONUS_1d10 = 9;
int DAMAGE_BONUS_2d6 = 10;
int DAMAGE_BONUS_2d8 = 11;
int DAMAGE_BONUS_2d4 = 12;
int DAMAGE_BONUS_2d10 = 13;
int DAMAGE_BONUS_1d12 = 14;
int DAMAGE_BONUS_2d12 = 15;
int DAMAGE_BONUS_6 = 16;
int DAMAGE_BONUS_7 = 17;
int DAMAGE_BONUS_8 = 18;
int DAMAGE_BONUS_9 = 19;
int DAMAGE_BONUS_10 = 20;
int DAMAGE_BONUS_11 = 21;
int DAMAGE_BONUS_12 = 22;
int DAMAGE_BONUS_13 = 23;
int DAMAGE_BONUS_14 = 24;
int DAMAGE_BONUS_15 = 25;
int DAMAGE_BONUS_16 = 26;
int DAMAGE_BONUS_17 = 27;
int DAMAGE_BONUS_18 = 28;
int DAMAGE_BONUS_19 = 29;
int DAMAGE_BONUS_20 = 30;
So as an example if we did...:
int iDamage = d4();
effect eDamage = EffectDamageIncrease(iDamage, DAMAGE_TYPE_FIRE);
...it would give us a random bonus damage of 1 - 4. But you'll notice the constants don't line up with their counterparts. If we wanted a damage bonus of 20 for example then iDamage would have to = 30. Or if you said int iDamage = 6; you wouldn't really get a bonus of 6, it would be 1d4. So if you are looking for a way to do something like d20 and actually get a 1 through 20 bonus you would need to write your own function. Something like so maybe:
int ConvertDamageBonusInt(int iInt)
{
int iReturn;
if (iInt > 0 && iInt <= 30)
{
if (iInt > 5)
iReturn +=10;
else
iReturn = iInt;
return iReturn;
}
return -1;
}
Modifié par GhostOfGod, 25 mai 2012 - 09:11 .