• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Level + feat eval script?

TalMeta

Well-known member
I'm trying to code a legacy weapon, and want to control the dex bonus it grants as the wielder increases in level.

I tried using

if (#totallevelcount[] >= 17) & (#hasfeat[fToBGLDW]) then
#enhancementbonus[hero.child[aDEX], 6]
elseif (#totallevelcount[] >= 14) & (#hasfeat[fToBL2DW]) then
#enhancementbonus[hero.child[aDEX], 4]
elseif (#totallevelcount[] >= 7) & (#hasfeat[fToBLLDW]) then
#enhancementbonus[hero.child[aDEX], 2]
endif

but it seems to be crapping out on my use of "& (#hasfeat[xxxx]") as it was working fine before I added that bit. Suggestions?
 
Use nested ifs:

Code:
if (#hasfeat[fToBLLDW] <> 0) then
  if (#totallevelcount[] >= 17) then
  elseif (#totallevelcount[] >= 14) then
  elseif (#totallevelcount[] >= 7) then
    endif
  endif
 
Okay, so I plug in

if (#totallevelcount[] >= 17) then
if (#hasfeat[fToBGLDW] <> 0) then

elseif (#totallevelcount[] >= 14) then
if (#hasfeat[fToBL2DW] <> 0) then

elseif (#totallevelcount[] >= 7) then
if (#hasfeat[fToBLLDW] <> 0) then
endif
endif
endif
endif

but its no longer giving me the +2 DEX at level 7 when the feat is known (or at any level). Did I miss something?

NVM. My eyes are tired. LOL
 
Last edited:
Code:
if (#totallevelcount[] >= 17) then
  if (#hasfeat[fToBGLDW] <> 0) then
 
  elseif (#totallevelcount[] >= 14) then
    if (#hasfeat[fToBL2DW] <> 0) then
 
    elseif (#totallevelcount[] >= 7) then
      if (#hasfeat[fToBLLDW] <> 0) then
        endif
      endif
    endif
  endif

I've added indentation to what you wrote - look at how things line up - look at what tests are nested inside other tests. Is that what you intended to code?
 
Code:
if (#totallevelcount[] >= 17) then
  if (#hasfeat[fToBGLDW] <> 0) then
 
  elseif (#totallevelcount[] >= 14) then
    if (#hasfeat[fToBL2DW] <> 0) then
 
    elseif (#totallevelcount[] >= 7) then
      if (#hasfeat[fToBLLDW] <> 0) then
        endif
      endif
    endif
  endif

I've added indentation to what you wrote - look at how things line up - look at what tests are nested inside other tests. Is that what you intended to code?

Pretty much. I forgot to add back in the "#enhancementbonus[hero.child[aDEX], 2]" bit before. Which is why I came back and edited my post.
 
Don't you want:

Code:
if (#totallevelcount[] >= 17) then
  if (#hasfeat[fToBGLDW] <> 0) then
    endif
elseif (#totallevelcount[] >= 14) then
  if (#hasfeat[fToBL2DW] <> 0) then
    endif
elseif (#totallevelcount[] >= 7) then
  if (#hasfeat[fToBLLDW] <> 0) then
    endif
  endif

The way you had it written, it won't do anything until you're level 17. This way, it will check the other two level options if you're not level 17 yet.
 
Back
Top