View Single Post
Bob G
Senior Member
 
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226

Old June 20th, 2021, 05:54 PM
I had a look at the alchemist's poison resistances, and tried to implement it for my ability, but since this ability is a custom ability, xIndex and xCount aren't valid fields. Instead, I tried using abValue as the argument to swap resistance for immunity:
<Pre-levels 1000>
Code:
If we're not active, just get out now
    doneif (tagis[Helper.SpcDisable] <> 0)

    ~ see if a quickfind has been created by another copy
    perform quickfind.setfocus

    ~ if we didn't find a redirection, we're the first copy of this ability to run this script, so we'll make ourselves the FirstCopy.
    if (state.isfocus = 0) then
      perform quickadd
      perform assign[Helper.FirstCopy]
      ~Add the base value of 2
      field[abValue].value += 2

    ~ otherwise, redirect hero.child[] to the FirstCopy, and make us an upgrade
    else
      perform focus.redirect
      perform assign[Helper.SpecUp]
      perform assign[Hide.Statblock]
      ~ add +2 to the focus's value
      focus.field[abValue].value += 2
      endif
<Post-levels 10000>
Code:
doneif (tagis[Helper.SpcDisable] <> 0)
    doneif (tagis[Helper.FirstCopy] = 0)

if (field[abValue].value <= 6) then
#situational[hero.child[svAll],signed(field[abValue].value) & " bonus on all saving throws against poison.",field[thingname].text]
else
      ~ If 4 copies are active, that's immunity
      if (field[abValue].value >= 8) then
        ~ We also want to change our special type from resistance to immunity
        perform delete[SpecType.Resist]
        perform assign[SpecType.Immune]

        ~ Since we're adding the immune to poison special, this ability
        ~ doesn't need to be shown once we're an immunity
        perform assign[Helper.SpecUp]
        endif
     endif
<Render 5000>
Code:
if (field[abValue].value <= 6) then
field[livename].text = field[thingname].text & " +" & field[abValue].value
else
field[livename].text = field[thingname].text & " Immunity to poison"
endif
Everything works until the 4th time the hero selects the ability. Resistance to Poison disappears, but immunity to poison doesn't replace it.

Projects: Legendary Rogue (Legendary Games) 97.9%, Assassin (Interjection Games) 88%, Fortunate (rebuild of Luckbringer, Rite Publishing) 87.2%, Adept Godling (Super Genius Games) 73.9%, Eldritch Godling (Super Genius Games) 72.9%, Mighty Godling (Super Genius Games) 44.3%, Clever Godling (Super Genius Games) 41.2%, Legendary Cavalier (Legendary Games) 30.9%

Message me for a list of completed projects.
Visit my blog! https://gauntletsofblogrepower.blogspot.com/
Bob G is offline   #6 Reply With Quote