Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Pathfinder Roleplaying Game (http://forums.wolflair.com/forumdisplay.php?f=62)
-   -   Level + feat eval script? (http://forums.wolflair.com/showthread.php?t=22781)

TalMeta August 27th, 2012 02:57 PM

Level + feat eval script?
 
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?

Mathias August 27th, 2012 03:00 PM

Use nested ifs:

Code:


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


TalMeta August 27th, 2012 03:19 PM

Quote:

Originally Posted by Mathias (Post 89915)
Use nested ifs:

Code:


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


Thank you! :)

TalMeta August 27th, 2012 03:43 PM

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

Mathias August 27th, 2012 03:49 PM

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?

TalMeta August 27th, 2012 04:19 PM

Quote:

Originally Posted by Mathias (Post 89923)
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.

Mathias August 27th, 2012 11:12 PM

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.


All times are GMT -8. The time now is 10:42 PM.

Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.