• 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 on item with situational/selective bonuses

welxo88

New member
Hey!

I'm helping our DM in creating item/gear with situational bonuses against certain creature type (this case undead). Bonuses should affect certain skill checks (knowledge religion, sense motive, stealth, perception) as well as attack and damage roll. It should work same as favored enemy for rangers, but without changes into the core classes of PCs.

So far, I understand that this should be accomplished somehow this way:

Code:
if (field[gIsEquip].value = 1) then
	hero.child[wpDmg].field[wpDmgBonus].value += 1
	#skillbonus[skReligion] += 2
endif

I've never did eval script before (although have experience with other coding), and I don't have previous knowledge of Hero Lab soul life, so any help is much appreciated!
 
Since it's situational, you don't want to actually add the bonus. It won't be relevant in every case, so it shouldn't be added to the total. What you want is similar to what's done with racial bonus for saving throws. For example, if you're a dwarf, your normal fortitude save might be +10, but you get a + 2 bonus vs. poison, and you'll see that as a little note on the character sheet. That's what you want to do here.

You can do that with a macro named #situational. See the code below, and if I got the details wrong, adapt it however you like.

When you're creating the text string, the signed function adds the + or - to the number, so it makes it appear as "+2" or "-2" appropriately.

The #situational macro takes three parameters. The variable you're adding the situational bonus to, the text you want to display, and the description of the bonus to display on the character sheet which, in this example, is the thingname of the item.

So, say the thingname is "Positive Energy Ring". On your character sheet, the Know: Religion skill will have a note that says, "Positive Energy Ring: +2 vs. undead", and your weapons will have a note that says, "Positive Energy Ring +1 vs. undead".

Code:
var bonus as number
var text as string
if (field[gIsEquip].value = 1) then
   bonus = 2
   text = signed(bonus) & " vs. undead"
   #situational[hero.childfound[skReligion],text,field[thingname].text
   
   bonus = 1
   text = signed(bonus) & " vs. undead"
   #situational[hero.childfound[wpDmg],text,field[thingname].text
endif
 
Without coding, the Shadow adjustments portion of the Community pack would allow this too.
Since it is the same as Favored Enemy, you can (on the adjust tab) and in the middle set of adjustments (Conferred Ability Adjustments), add Favored Enemy.

The second version is Shadow's, which then puts the option to select the type of creature the bonus applies towards, select amount of the bonus, and have a check box to enable it.
Rather than have situational text, you then have a check box, which when checked includes all the relevant bonuses to the assorted skills, attack/damage rolls, etc.
 
Back
Top