Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
foreach pick in hero from BaseNatWep where "!Custom.InitDam & Custom.FromTpl"
var v_size as number
var v_mod as number
var v_dam as string
var v_over as number
~ set focus
perform eachpick.setfocus
~ initialize damage string
dam = "wMain."
v_size = herofield[tSize].value + 4 + mod
if (v_size <= 0) then
~ for blank damage
v_size = 0
~ the rest follows the table in the bestiary
elseif (v_size = 1) then
dam &= "1_1"
elseif (v_size = 2) then
dam & = "1d2_2"
elseif (v_size = 3) then
dam &= "1d3_3"
elseif (v_size = 4) then
dam &= "1d4_4"
elseif (v_size = 5) then
dam &= "1d6_5"
elseif (v_size = 6) then
dam &= "1d8_6"
elseif (v_size = 7) then
dam &= "2d6_104"
elseif (v_size = 8) then
dam &= "2d8_104"
elseif (v_size = 9) then
dam &= "4d6_106"
elseif (v_size = 10) then
dam &= "4d8_206"
~ this is extrapolating from the improved natural attack feat
elseif (v_size = 11) then
dam &= "6d6_107"
elseif (v_size = 12) then
dam &= "6d8_207"
elseif (v_size = 13) then
dam &= "8d8_208"
else
dam &= "8d8_208"
v_over = v_size - 13
endif
if (v_size <> 0) then
perform focus.assignstr[dam]
endif
if (v_over <> 0) then
focus.field[wDamage].value += v_over
~ will fill in the other wDamage type fields here as well
endif
~ tag tells us not to go through this again
perform eachpick.assign[Custom.InitDam]
perform state.clearfocus
nexteach
Hey FYI Frumple. Part of your code is using "eachpick" and part of it is using "focus." but I see no set focus. Could that be the issue?Code:if (v_size <> 0) then perform [B]focus.[/B]assignstr[dam] endif if (v_over <> 0) then [B]focus.[/B]field[wDamage].value += v_over ~ will fill in the other wDamage type fields here as well endif ~ tag tells us not to go through this again perform [B]eachpick.[/B]assign[Custom.InitDam] endif
I feel your pain in this actually. HL sizing of natural attacks has some issues. Currently seen it recently with a player's character with a druid. Based upon how you activate things like "enlarge" "Strong Jaw" or other abilities that increase natural damage you get different results.Oops forgot to put in the perform eachpick.setfocus at the beginning when I typed it in above. It is in the code I am experimenting with. I just fixed it.
I guess the issue is that I want to be able to set the damage of an attack in a template by size according to one table, but have it follow the same pattern of scaling on any future changes in size or application of feats.
doneif (tagis[Custom.InitDam] <> 0)
var v_size as number
var v_mod as number
var v_dam as string
var v_over as number
v_mod = 1
~ initialize damage string
v_dam = "wMain."
v_size = 4 + v_mod
if (v_size <= 0) then
~ for blank damage
v_size = 0
~ the rest follows the table in the bestiary
elseif (v_size = 1) then
v_dam &= "1_1"
elseif (v_size = 2) then
v_dam &= "1d2_2"
elseif (v_size = 3) then
v_dam&= "1d3_3"
elseif (v_size = 4) then
v_dam &= "1d4_4"
elseif (v_size = 5) then
v_dam &= "1d6_5"
elseif (v_size = 6) then
v_dam &= "1d8_6"
elseif (v_size = 7) then
v_dam &= "2d6_104"
elseif (v_size = 8) then
v_dam &= "2d8_104"
elseif (v_size = 9) then
v_dam &= "4d6_106"
elseif (v_size = 10) then
v_dam &= "4d8_206"
~ this is extrapolating from the improved natural attack feat
elseif (v_size = 11) then
v_dam &= "6d6_107"
elseif (v_size = 12) then
v_dam &= "6d8_207"
elseif (v_size = 13) then
v_dam &= "8d8_208"
else
v_dam &= "8d8_208"
v_over = v_size - 13
endif
debug "v_size: " & v_size
debug "v_dam: " & v_dam
debug "v_over: " & v_over
if (v_size <> 0) then
perform assignstr[v_dam]
endif
if (v_over <> 0) then
field[wDamage].value += v_over
~ will fill in the other wDamage type fields here as well
endif
~ tag tells us not to go through this again
perform assign[Custom.InitDam]
~ run at First/1000
~ user needs to set focus to weapon before calling this
~ and set v_mod and v_type before call
~ v_mod is how many sizes above or below the damage is done as
~ v_type is what kind of natural attack we are starting as
~ note the string for v_type is strictly the same as the kind of natural attack given
~ in Table 3-1 of the Bestiary
doneif (this.tagis[Custom.InitDam] <> 0)
var v_size as number
var v_mod as number
var v_type as string
var v_start as number
var v_dam as string
var v_over as number
var d4track as number
~ initialize damage string
v_dam = "wMain."
~ set us on the correct track
v_type = lowercase(v_type)
~ since medium always starts as 1d4 or 1d6 we check if we are on the 1d4 track
~ if not we go to the 1d6
~ with compare if we have one of the comparison strings the product will be 0
~ otherwise it will be some non-zero value
d4track = compare("claw",v_type) * compare("hoof",v_type) * compare ("tentacle",v_type) * compare("wing",v_type) * compare("slam",v_type) * compare("sting",v_type) * compare("talons",v_type) * compare("other",v_type)
if (d4track = 0) then
~ start with 1d4 for medium
v_start += 4
else
~ start with 1d6 for medium
v_start += 5
endif
v_size = v_mod + v_start
if (v_size <= 0) then
~ for blank damage
v_size = 0
~ the rest follows the table in the bestiary
elseif (v_size = 1) then
v_dam &= "1_1"
elseif (v_size = 2) then
v_dam &= "1d2_2"
elseif (v_size = 3) then
v_dam&= "1d3_3"
elseif (v_size = 4) then
v_dam &= "1d4_4"
elseif (v_size = 5) then
v_dam &= "1d6_5"
elseif (v_size = 6) then
v_dam &= "1d8_6"
elseif (v_size = 7) then
v_dam &= "2d6_104"
elseif (v_size = 8) then
v_dam &= "2d8_104"
elseif (v_size = 9) then
v_dam &= "4d6_106"
elseif (v_size = 10) then
v_dam &= "4d8_206"
~ this is extrapolating from the improved natural attack feat
elseif (v_size = 11) then
v_dam &= "6d6_107"
elseif (v_size = 12) then
v_dam &= "6d8_207"
elseif (v_size = 13) then
v_dam &= "8d8_208"
else
v_dam &= "8d8_208"
v_over = v_size - 13
endif
if (v_size <> 0) then
perform this.assignstr[v_dam]
endif
if (v_over <> 0) then
field[wDamage].value += v_over
endif
~ tag tells us not to go through this again
perform this.assign[Custom.InitDam]