View Single Post
spannclann
Member
 
Join Date: Aug 2018
Location: Texas
Posts: 87

Old November 3rd, 2021, 09:43 AM
Here is the entire code I use. Though my code is checking for feats to raise damage, I am sure you can see the logic and can take what you need.



~ If we're not shown, just get out now
doneif (tagis[Helper.ShowSpec] = 0)

~ If we're disabled, do nothing
doneif (tagis[Helper.Disable] <> 0)

~ first we have to establish our benchmark, based on our level
~ all comparisons are made assuming that the wielder is medium,
~ because that is what wMain tags assume. Damage dice are then
~ adjusted up or down appropriately based on size.

~ There are two feats that can increase the level upward.

var act_level as number

~!!! You were looking for the field xAllLev on this ability, not the hero.
~!!! Doing herofield[xAllLev].value may work, but this macro should work,
~!!! too.

act_level = #totallevelcount[]


~!!! I added this debug code; you can see its output from Develop >
~!!! Floating Info Windows > Show debug output. It'll tell you what
~!!! act_level is at this stage in the script. If you add it again
~!!! later, you can see whether it's calculating correctly. You can
~!!! do this with any field, variable, etc.

debug "Current act_level: " & act_level


~ Checking for Grappler
if (#hasfeat[fGrappler] <> 0) then
act_level += 1
endif
~ Checking for Tavern Brawler
if (#hasfeat[ft5CTaverB] <> 0) then
act_level += 1
endif


~!!! Changed your test because it was looking to see if this
~!!! ability has the tag "IsWeapon.wUnarmed".
~!!! Now instead we're looking to see if the hero has the tags
~!!! for equipping stuff in their main and offhand.

if (hero.tagis[Hero.EquipMain] = 0) then
if (hero.tagis[Hero.EquipOff] = 0) then
if (hero.tagis[Hero.EquipShld] = 0) then
if (act_level >= 18) then
act_level += 6
elseif (act_level >= 11) then
act_level += 6
elseif (act_level >= 6) then
act_level += 6
elseif (act_level >= 3) then
act_level += 3
else
act_level += 2
endif
endif
endif
endif


if (#hasability[c5CFtrUnaFig] = 0) then
if (act_level >= 24) then
act_level += 6
elseif (act_level >= 18) then
act_level += 6
elseif (act_level >= 11) then
act_level += 6
elseif (act_level >= 6) then
act_level += 6
elseif (act_level >= 3) then
act_level += 3
else
act_level += 2
endif
endif

~!!! added hero.childfound[wUnarmed] to the beginning of
~!!! these, to tell HL to go to the wUnarmed thing
~!!! (Unarmed Strikes) and modify it's weapon dice #'s
~!!! Another thing you may want to think about doing is
~!!! telling it to be the maximum of whatever damage dice is
~!!! present, otherwise you're overriding a possibly higher dice,
~!!! like if they're a Monk. You'd do this:
~!!! hero.childfound[wUnarmed].field[wDieSize].value =
~!!! maximum(hero.childfound[wUnarmed].field[wDieSize].value,12)


if (act_level >= 30) then
~ Medium folks get 2d8 at this level. Avg = 9
hero.childfound[wUnarmed].field[wDieCount].value = 2
hero.childfound[wUnarmed].field[wDieSize].value = 8
field[abValue].value += 9
elseif (act_level >= 24) then
~ Medium folks get 1d12 at this level. Avg = 7
hero.childfound[wUnarmed].field[wDieCount].value = 2
hero.childfound[wUnarmed].field[wDieSize].value = 6
field[abValue].value += 7
elseif (act_level >= 18) then
~ Medium folks get 1d10 at this level. Avg = 5.5
hero.childfound[wUnarmed].field[wDieCount].value = 1
hero.childfound[wUnarmed].field[wDieSize].value = 10
field[abValue].value += 5.5
elseif (act_level >= 12) then
~ Medium folks get 1d8 at this level. Avg = 4.5
hero.childfound[wUnarmed].field[wDieCount].value = 1
hero.childfound[wUnarmed].field[wDieSize].value = 8
field[abValue].value += 4.5
elseif (act_level >= 6) then
~ Medium folks get 1d6 at this level. Avg = 3.5
hero.childfound[wUnarmed].field[wDieCount].value = 1
hero.childfound[wUnarmed].field[wDieSize].value = 6
field[abValue].value += 3.5
elseif (act_level >= 3) then
~ Medium folks get 1d4 at this level. Avg = 2.5
hero.childfound[wUnarmed].field[wDieCount].value = 1
hero.childfound[wUnarmed].field[wDieSize].value = 4
field[abValue].value += 2.5
else

~!!! I removed the part where you're telling it to be 1d1, since that's
~!!! already the default.
~!!! Again, you might accidentally override a higher die that someone
~!!! has from another source.

field[abValue].value += 1
endif


~!!! I have no idea what this is, but it's likely unrelated to your problem

var v_text as string

call wMainText

field[abText].text = v_text

Last edited by spannclann; November 3rd, 2021 at 09:47 AM.
spannclann is offline   #2 Reply With Quote