Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - d20 System (http://forums.wolflair.com/forumdisplay.php?f=46)
-   -   Help cleaning this up (http://forums.wolflair.com/showthread.php?t=63863)

Illyahr February 13th, 2020 12:43 PM

Help cleaning this up
 
I'm trying to program in a custom special but I can't get the code to work itself out properly

Code:

foreach pick in hero from BaseSkill
  if (eachpick.islinkage[skillattr] <> 0) then
    if (eachpick.linkage[skillattr].tagis[thingid.aCHA] + eachpick.linkage[skillattr].tagis[thingid.aINT] + eachpick.linkage[skillattr].tagis[thingid.aWIS] <> 0) then
      field[usrCandid1].text = "hero.child.[thingid.each]"
    endif
  endif
nexteach

var bonus as number
var pen as number
bonus = chosen.field[kModValue].value/4
bonus = round(bonus,0,-1)
pen = chosen.field[kModValue].value/2
pen = round(pen,0,-1)

if (field[hIsOn1].value <> 0) then
  foreach pick in hero from BaseWep where "thingid.wSwordBast | thingid.wShortswd"
    eachpick.field[wAttBonus].value += bonus
    chosen.field[aFinalVal].value -= pen
  nexteach
endif

You choose a mental-based skill. While active, you gain a bonus to attack equal to 1/4 the bonus while using katana or wakizashi (bastard sword or shortsword) but you also lose half the final value from that skill.

Sendric February 13th, 2020 02:44 PM

What part isnt working?

Try adding this in front of chosen: field[usrChosen1].

Illyahr February 14th, 2020 11:06 AM

Quote:

Originally Posted by Sendric (Post 285905)
Try adding this in front of chosen: field[usrChosen1].

That works to get it to compile, but I'm getting a custom expression error and doesn't reduce to just mental-based skills. It also doesn't pull the bonus from the chosen skill.

I changed the expression line to:
Code:

field[usrCandid1].text = "hero.child.tagis[thingid.each]"
EDIT: Got the bonuses and penalty to work. Just need to figure out why the selection isn't reduced to just skills

Sendric February 18th, 2020 04:24 AM

Replace your foreach loop with this:

Code:

var expr as string
var lngth as number

foreach pick in hero from BaseSkill
  if (eachpick.islinkage[skillattr] <> 0) then
    if (eachpick.linkage[skillattr].tagis[thingid.aCHA] + eachpick.linkage[skillattr].tagis[thingid.aINT] + eachpick.linkage[skillattr].tagis[thingid.aWIS] <> 0) then
      expr &= eachpick.tagids[thingid.?, " | "] & " | "
    endif
  endif
nexteach

lngth = length(expr)
lngth -= 2
expr = left(expr,lngth)

field[usrCandid1].text = expr

Let me know if that works for you.

Illyahr February 18th, 2020 02:52 PM

That worked, thanks :)


All times are GMT -8. The time now is 09:44 AM.

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