• 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

Help with scripting

JMD031

Well-known member
Hello. I am having some issues with scripting. I'm trying to re-create the Hexblade but I have ran into some problems.

For the Hexblade Curse ability I cannot get it to increase in uses per day as the character levels. An ability that is similar is a Paladin's smite ability and it is what I used as a template. Currently, at 20th level HL is saying that I only have two uses per day of the ability.

Phase: Post-Levels Priority: 10000 Index: 4

Code:
 field[trkMax].value += field[xCount].value
      field[listname].text = "Hexblade Curse " & field[xIndex].value & "/day"

The ability is supposed to add one use per day every 4 levels after 1st to 5/day at 17th level.

For the Aura of Unluck ability it has too many uses per day and too many rounds per use. I used the Touch of Darkness domain ability as a template since it was similar in nature.

Phase: Post-attributes Priority: 10000 Index: 1

Code:
      ~uses per day = 3 + CHA mod
      field[trkMax].value += 3 + hero.child[aCHA].field[aModBonus].value

      var bonus as number
      bonus = field[xAllLev].value / 2
      field[abDuration].value += maximum(round(bonus,0,-1),1)

      field[livename].text = "Aura of Unluck " & field[abDuration].value & " rounds"

I'm not going to lie but I think because I don't fully understand this I just kind of made some changes to certain words to make it work the way I thought it would. Anyways, the ability is supposed to be used once per day and then increases in use every 4 levels to a maximum of 3 per day at 20 (the ability is gained at 12). Then it is active for a number of rounds equal to 3 plus the Hexblade's CHA modifier.

I'm probably just off on a few things here and there. As always, any help you can provide will be greatly appreciated.
 
xIndex is the ability's position in the list of class abilities -so if you assign one copy to level 10, and one copy at level 20, the level 10 copy will have xIndex = 1 and the level 20 copy will have xIndex = 2

xCount is the number of copies that have reached the correct level.

Which of those copies is selected as the "FirstCopy", and is therefore the one shown to the user is random, as far as I can figure.

So, you make sure you're only running on the active copy:

Code:
~This creates the name as seen in the list on the class tab
~note that this is before the tests, because we want all the copies
~to generate a listname, no matter how many levels the character has
~in this class
field[listname].text = field[thingname].text & " (" & field[xIndex].value & "/day)"
 
~we only want to run the rest if we're the first copy
doneif (tagis[Helper.FirstCopy] = 0)
 
~we only proceed if we're shown
~this keeps the ability from generating a tracker from levels 1-3
doneif (tagis[Helper.ShowSpec] = 0)
 
~now, set our uses/day equal to the number of copies of our ability that have become active
field[trkMax].value += field[xCount].value

Back in the main options section for your ability, find the "Tracked Resources" section, check the box that says it's a tracker, leave the number of uses blank (since you're calculating that in a script), and set the usage period to " /day". HL will then see that trkMax > 0 and a usage period is set, so it will automatically append the " (X/day)" to the livename.

For the second one, set copies to activate at levels 12, 16, and 20.

Start by using the script I gave you above, and add this to the end to generate the duration:

Code:
field[abDuration].value += 3 + #attrmod[aCHA]
 
field[livename].text = field[thingname].text & " (" & field[abDuration].value & " rounds)"

Good work noting the correct timing for this ability - you need to be in the Post-Attributes phase or later, since you need to look up the bonus of an attribute.

Note that I used #attrmod[aCHA] where you had used hero.child[aCHA].field[aModBonus].value - that's a macro I added a few months ago to save typing, but I haven't updated all the existing scripts to use it yet.
 
Thanks!

Edit: Ok...I guess I'm not understanding what you mean by copies. Do I make an extra copy of the entire ability or just the script?
 
Last edited:
On the classes tab, in the "Class Special Abilities" option, add the class special you've created, and assign it to level 12. Then, press the copy button that's on the left-hand side of that entry in the list, add two more copies. Assign those two copies to levels 16 and 20.
 
On the classes tab, in the "Class Special Abilities" option, add the class special you've created, and assign it to level 12. Then, press the copy button that's on the left-hand side of that entry in the list, add two more copies. Assign those two copies to levels 16 and 20.

Ah, I see. Thanks again.
 
Please, any help at all is very welcome. I don't necessarily want to be told how to do this, I want to learn, but right now I need help.


Hi, welcome. What will help you get help is specifics. Post what you are specifically trying to do and I'm certain someone will come along and help you.
 
Back
Top