View Single Post
EightBitz
Senior Member
 
Join Date: May 2013
Posts: 1,458

Old October 10th, 2017, 11:24 PM
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
EightBitz is offline   #2 Reply With Quote