• 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

Script question

Steelight

Member
I wanted some advice on a script for a cleric domain ability. I want the ability to be usable 4 + WIS modifier per day, and inflict 2 points of strength drain, adding that drain to the cleric. The cleric would keep the bonus Strength for a number of rounds equal to their Charisma modifier.

I'm currently going through the tutorials, but can someone give me a hand with this one please?

Thanks in advance.
 
OK, I'll take up the challenge for this one.

Firstly, domain powers need to be added as Class Specials and then bootstrapped by the Domain itself. As Mathias would no doubt tell you, the best way to see how this works is to find something that works in a similar way and examine it. So, do a New (Copy) in both Cleric Domains and Class Specials (copying the Good domain and the Touch of Good class special). You should be able to see from there how the domain links to the the special power.

The touch of good has 2 scripts attached to it (top right corner under the button labelled "Eval Scripts"). The first is building the description of the power. In your case, I think it's a fixed amount of damage but for a variable number of rounds. So you would want to replace that script with something like

Code:
field[abSumm].text = "Drain 2 Strength from target and apply it to caster for " 
& hero.child[aCHA].field[aModBonus].value & " rounds."

The second script calculates the number of uses per day and is already set at almost what you want already. Just change the 3 to a 4 and you're done.

Code:
field[trkMax].value += 4 + hero.child[aWIS].field[aModBonus].value

The mechanics of actually adding the strength to the caster for x rounds is best left as just text since Hero Lab doesn't have a round counter that you can access, as far as I know.

Hope this helps. I know the scripting is tricky at first but if you stick at it, it does get easier.
 
Okay...

Thanks, that helped a bit.

Is it possible to get a break down of that script, so I can understand what each part does?

And how do I write a script that get's used 1/day at 8th level, and an additional time per day every 4 levels thereafter?

Also, for some reason when I try to make a cleric (of my new deities or core ones) the deity weapon proficiency comes up saying "requirements not met." To my knowledge being a 1st level cleric should be the only requirement. And it doesn't automatically select the weapon like I thought it was supposed to. Any suggestions on that one?
 
Last edited:
OK, to break the scripts down:

The first script is setting the text of a field called abSumm. For a class special, abSumm is the summary text that's displayed for it.

The part to the right of the = sign is simply joining together 3 pieces of text (that's what the & sign does), two of which are fixed and the 3rd is the Charisma bonus for the hero.

The second script is simply taking the hero's Wisdom bonus, adding 4 and storing the result in the trkMax field of the class special. This is the field that's used by the tracker to tell you how many uses the ability has.

For an ability that's used 1/day at 8th level plus 1/4 levels after, you'll want something like

Code:
var bonus as number
bonus = field[xAllLev].value / 4
field[trkMax].value += maximum(round(bonus,0,-1) - 1,1)

I've copied that script straight from the Good domain's Holy Lance power, by the way. For a brief breakdown of it, the first line sets up a temporary variable for us to use, the second gets the hero level, divides it by 4 and stores it in the variable we created and the final line sets up the trkMax field as the earlier script did. The maximum(round(.... bit is simply rounding off the level/4 to an integer and making sure it's at least 1. It's actually cheating a bit by just dividing the level by 4 and subtracting 1, but that gives the same result as the uses you want.

To give your cleric proficiency in your deity's favoured weapon, there are 2 solutions. If you've created your deity in the editor (rather than just type the name in on the background tab) then there is a button on there where you can click to assign the favoured weapon. Alternatively, if you go to the Cleric tab and click the "Special Abilities" button, then that pops up a form with a dropdown list of weapons. Just pick your selected weapon on there.
 
More questions

Sorry for asking so many questions, I'm a bit new at this whole scripting thing.

For the favorite weapon, I've added it in the deity I created, but it isn't even meeting the requirements for the deities from the Core Rulebook that is already in the program. Thus my confusion. From what I can tell, there is no difference (as far as what fields are filled) between the ones I created and the core ones, yet now neither gives a favored weapon (and I have checked both the favored weapon script and the cleric bootstraps and those haven't been changed to my knowledge).

Also, I have a saving throw DC I'm having trouble figuring out. The DC is supposed to be 10 + Wisdom modifier + the highest available spell level for the character. First, I'm not sure how to put a DC into script format, and second I'm not sure how to put in the highest available spell level without using a ton of if-then statements and checking for cleric levels equivalent to the spell levels.

I had yet another question but I can't remember it right now. Stand by for more I suppose. Though I must say, thanks alot for the help you've given me thus far. It is very much appreciated.

And thanks for the use script.
 
Last edited:
For an ability that's used 1/day at 8th level plus 1/4 levels after, you'll want something like

Code:
var bonus as number
bonus = field[xAllLev].value / 4
field[trkMax].value += maximum(round(bonus,0,-1) - 1,1)
For class abilities like this I use a different method that HL implemented later on in the pathfinder files. Instead of calculating the bonus which works with even levels you can use the xCount & xIndex fields instead to figure out how many times the ability has been set to the class.

So for example lets say you have an ability that provides a +1 bonus that stacks at levels 1,3,9,10,15, and 20. This would be hard to calculate in a script and be a pain if some errata changed those values.

Instead you can bootstrap the new class ability to the Class setting it's level to be active at those levels. Then the script would look like this:
Code:
~Set the list name
field[listname].text = field[thingname].text & "(+" & field[xIndex].value  & ")"

      ~ If we're not shown, just get out now
      doneif (tagis[Helper.ShowSpec] = 0)
field[abValue].value += field[xCount].value
field[livename].text = field[thingname].text & "(+" & field[abValue].value  & ")"
The other thing is that I am pulling the name of the Thing I am attached to set the other text fields. This way its even pretty generic script that I can use on more than one ability with minimum changes.

I am not saying what you wrote TopCat won't work but wanted to show a slightly different way to accomplish the same thing.

Here is the script changed to work with your exact class ability.
Code:
      ~ If we're not shown, just get out now
      doneif (tagis[Helper.ShowSpec] = 0)
    ~Set the Things abValue so outside Things can adjust the value
    field[abValue].value += field[xCount].value
    ~Set the per use value from the Things abValue
    field[trkMax].value += maximum(field[abValue],1)
The reason also I am setting the field[abValue] instead of making up my own variable is that one is already their. And two this allows outside things like say a Feat to adjust the value which can happen. As Pathfinder loves their Extra Use Per Day feats. Now a feat could simply adjust the abValue in a timing BEFORE the above scripts run and it will get added to the class ability correctly.

Hope that helps.
 
Last edited:
Okay, one last question (for now). For a prestige class, what is the coding in the "Pre-req" to make it require a specific deity?



Never mind. I figured it out.
 
Last edited:
In the editor, go to the Class Levels tab and make a copy of the "Inheritor's Crusader" or "Spherewalker" prestige classes - the Expr-Reqs for those include examples of prestige classes that are specific to a deity.
 
Thanks. That's actually how I figured it out.

How about a feat that changes creature type? (like the Dragonwrought feat)?
 
You'll have to tell me more about how exactly it changes the type.

Is this like a L20 Monk, where you're considered that type for the purpose of spells, but the racial HD size and racial attack/save progressions aren't changed? The Type in this case becomes "Outsider (Augmented Humanoid)".

Is this like the Half-Dragon/Half-Celestial/Half-Fiend templates, which are like the Monk, but the Type changes to the new type without referencing the old type?

Is this like the Ghost, where the Type changes, and the new Type's abilities and attack/save progressions replace the existing Type's abilities and attack/save progressions. The name becomes "Undead (Augmented Humanoid)".

Or the Skeleton, where the abilities and attack/save progression is overridden, and the name becomes "Undead", without referencing the original Type.

(yes, that's how complicated the OGL Type system actually is)
 
Does it change the Type's effects? Does it replace the name when displayed on the Character sheet?, and does it add "(Augmented Humanoid)" to that Type?

If you're not sure, please quote the feat's text, and I'll try to figure it out. Or, see if you can find a sample character in that book that uses the feat and see how things are displayed.
 
hmmm...

Here is my summary of what the feat does:

Your type is dragon rather than humanoid. You retain all other subtypes and kobold racial traits. Your scales become tinted with a color that matches your draconic heritage. As a dragon, you are immune to magic sleep and paralysis effects. You have darkvision out to 60 feet and low-light vision. You also gain a +2 racial bonus on your draconic heritage skill.
 
Okay, let's go with the Monk version.

Here's an Eval Script for that:

Phase: First, Priority: 510
Code:
perform hero.assign[TypeAndAug.tpDragon]

You'll add the sleep and paralysis immunities, the darkvision and low-light vision and the skill bonus from the feat, since it's adding only some of the Dragon type's effects.
 
The immunities and senses would just be bootstraps.

I'm not sure what "draconic heritage skill" means, so I can't tell you how to add that bonus yet.
 
That was part of the 3.5E feat. Basically, when you took the feat you chose a dragon that you were descended from. Each dragon type had a skill associated with it. The dragonwrought feat would give you a +2 bonus to the skill associated with your selected dragon type.

I don't have a clue how to script that, so for now I'm just using the "Adjust" tab to compensate.
 
There are many Traits (like Child of the Temple or Mathematical Prodigy) that offer a small list of skills to select from, and then grant a bonus to the skill that the user selects. Take a look at how they're set up, because the details of how to set that up don't differ from Traits to Feats.
 
Looking at the Mathematical Prodigy trait I see this:

#applybonus[BonTrait,hero.childfound[skKnowArca],1]
#applybonus[BonTrait,hero.childfound[skKnowEng],1]

perform field[usrChosen1].chosen.assign[Helper.ClassSkill]

I understand lines 1 and 2 give the +1 bonus to the two knowledge skills. But could someone please break down line 4 for me so I can understand what each thing does?

Also, I'm trying to create a script for an ability that lasts 1 round per 2 cleric levels. This is what I have, but it doesn't work. Can someone tell me why?

field[abSumm].text = "Inflicts a -2 penalty to attacks, skills and saving throws for " & (hero.child[cHelpClr].field[cCleric].value)/2 & " rounds."

I also want to say thanks again to everyone for all of your help.
 
Last edited:
Back
Top