View Single Post
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old June 16th, 2020, 07:47 AM
Here's how I'd write this:

Code:
  <eval index="1" phase="PreLevel" priority="1000"><![CDATA[
     ~ 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 1
      field[abValue].value += 1


    ~ 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 +1 to the focus's value
      focus.field[abValue].value += 1
      endif
    ]]></eval>
  <eval index="2" phase="PostLevel" priority="10000"><![CDATA[
    doneif (tagis[Helper.SpcDisable] <> 0)
    doneif (tagis[Helper.FirstCopy] = 0)

     ~ if we're not fighting defensively, get out now
    doneif (hero.childfound[pstFtDefen].field[pIsOn].value = 0)
 
    ~ Give a dodge bonus to Armor Class
    hero.childfound[ArmorClass].field[tACDodge].value += field[abValue].value 
     ]]></eval>

And then use the automated livename generation mechanisms to set abValue as an append to the livename, and set it as signed - but that all happens in tags, not in a script.
Mathias is online now   #10 Reply With Quote