• 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

FirstCopy tag troubles

Bob G

Well-known member
Ability says: Each time the rogue selects this avoidance, she gains a +1 dodge bonus to AC when fighting defensively. So I did this:
<First/500>
Code:
~ If we're not shown, just get out now
      doneif (tagis[Helper.ShowSpec] <> 1)
~ if we've been disabled, get out now
      doneif (tagis[Helper.SpcDisable] <> 0)
~ if we're not fighting defensively, get out now
     if (hero.childfound[pstFtDefen].field[pIsOn].value <> 0) then
     
~ Set the bonus based on the number of active abilities
      field[abValue].value += field[xIndex].value
      field[livename].text = field[thingname].text & " " & field[abValue].value

~ The following should only happen once on the first copy
      doneif (tagis[Helper.FirstCopy] = 0)

~ Give a dodge bonus to Armor Class
      hero.childfound[ArmorClass].field[tACDodge].value += field[abValue].value
endif
But dodge bonus does not add. Why is this happening?
 
I am pretty sure CustomSpec Picks don't get Helper.FirstCopy unless you apply it yourself first. If you have the community pack installed this is easy as calling X1SetFirst.

You can see an example HERE.
 
I am pretty sure CustomSpec Picks don't get Helper.FirstCopy unless you apply it yourself first. If you have the community pack installed this is easy as calling X1SetFirst.

You can see an example HERE.

Wow, I have been pulling my hair out for two months trying to figure out why Helper.FirstCopy wasn't behaving like it should. I had no idea that it didn't automatically get assigned on custom abilities. "Call X1SetFirst" did the trick. Thanks for the code SC!
 
Still having problems

I am pretty sure CustomSpec Picks don't get Helper.FirstCopy unless you apply it yourself first. If you have the community pack installed this is easy as calling X1SetFirst.

You can see an example HERE.

I tried using the X1SetFirst procedure with the script below, but the value isn't stacking after the first copy.
Code:
~ Set Helper.FirstCopy for custom abilities
      call X1SetFirst
      
      var DamRed as number
      DamRed += 3

~Grant damage reduction 
      #applydr[xDamRd,DamRed]
I also tried removing the call X1SetFirst line, but the result was the same. What's going on here?
 
Still not getting this...

I thought I had this figured out, but after a few months I revisited the ability, and realized it wasn't working as I hoped.

It's a custom ability that can be selected multiple times. Each time, it adds +1 dodge bonus to AC when hero is fighting defensively.

I don't receive any error messages, and the bonus adds to AC correctly, but the livename doesn't reflect the correct value after the first copy. It could be a timing issue, but I tried other phases to no avail.
<Post-Attributes 10000>
Code:
     call X1SetFirst
     field[abValue].value += 1
     
     field[livename].text &= field[thingname].text & " +" & field[abValue].value
     hero.childfound[pstFtDefen].field[abValue].value += field[abValue].value

~ if we're not the first copy, get out now
     doneif (tagis[Helper.FirstCopy] <> 1)
     
~ if we're not fighting defensively, get out now
     doneif (hero.childfound[pstFtDefen].field[pIsOn].value = 0)
     hero.childfound[ArmorClass].field[tACDodge].value += field[abValue].value

I have several custom abilities that work similarly, so if the community can assist, you will help me solve several problems. Thanks as always!
 
I think normally the livename field is set late in the Final phase.

Try just pulling just this line out to something like Render/5000:

field[livename].text = field[thingname].text & " +" & field[abValue].value
 
I think normally the livename field is set late in the Final phase.

Try just pulling just this line out to something like Render/5000:

field[livename].text = field[thingname].text & " +" & field[abValue].value

Thanks for the suggestions everyone (Minous too). Unfortunately, pulling the livename line out and putting on Render/5000 didn't change the abValue of the livename after the first copy. I also discovered that the bonus to AC wasn't adding after the first copy either.

It seems so simple, yet I just can't seem to get the concept right. Talk me off the ledge, someone!
 
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, this is amazing! Thank you so much for this, not just for the solution, but for the comments explaining what each line does. This is over and above!
 
Back
Top