Quote:
Originally Posted by Mjolnirh
ok I got it oddly enough here are the scripts that worked.
var bonbon as number
if (#totallevelcount[] >= 8) then
bonbon = 1
endif
if (#totallevelcount[] >= 12) then
bonbon = 2
endif
if (#totallevelcount[] >= 17) then
bonbon = 3
endif
hero.child[iThaas].field[Bonus].value = hero.child[iThaas].field[Bonus].value + bonbon
var iLevel as number
var sText as string
iLevel = #totallevelcount[]
if (iLevel >= 8) then
sText = "1d6"
endif
if (iLevel >= 11) then
sText = "2d6"
endif
if (iLevel >= 16) then
sText = "3d6"
endif
if (iLevel >= 20) then
sText = "4d6"
endif
sText = " plus " & sText & " radiant"
#extradamage[hero.child[iThaas], sText, field[thingname].text]
|
When you have a lot of if statements testing the same value, using elseifs can make the code clearer and easier tot read. Like so:
Code:
if (iLevel >= 20) then
sText = "4d6"
elseif (iLevel >= 16) then
sText = "3d6"
elseif (iLevel >= 11) then
sText = "2d6"
elseif (iLevel >= 8) then
sText = "1d6"
endif
sText = " plus " & sText & " radiant"
#extradamage[hero.child[iThaas], sText, field[thingname].text]