Inline math operations?
Posted: Wed Nov 26, 2003 6:20 pm
For a script I'm writing I need to apply a damage effect equal to the character's weight divided by 10... The problem I run in to is the division component. In pretty much every syntax I've ever worked at least one of these two variants should work:
EffectDamage(GetWeight(oVictim)/10,DAMAGE_TYPE_BLUDGEON);
Or...
int iDamage = GetWeight(oVictim)/10;
EffectDamage(iDamage,DAMAGE_TYPE_BLUDGEON);
Now, the script applies the damage effect correctly in terms of actually applying damage of the correct type, but in neither case does it do the division. So in the case of my test character with a weight of 16 it's applying 16 points of damage instead of 2 (assuming integer divisions round with normal rounding rules, but even 1 would be fine.). So, what do I need to do to get the result of GetWeight() divided by 10?
EffectDamage(GetWeight(oVictim)/10,DAMAGE_TYPE_BLUDGEON);
Or...
int iDamage = GetWeight(oVictim)/10;
EffectDamage(iDamage,DAMAGE_TYPE_BLUDGEON);
Now, the script applies the damage effect correctly in terms of actually applying damage of the correct type, but in neither case does it do the division. So in the case of my test character with a weight of 16 it's applying 16 points of damage instead of 2 (assuming integer divisions round with normal rounding rules, but even 1 would be fine.). So, what do I need to do to get the result of GetWeight() divided by 10?