Public Function TurnUndead() 'Set up some variables Clr = cr.GetClassLevel("Clr") Blk = cr.GetClassLevel("Blk") Pal = cr.GetClassLevel("Pal") 'Add levels to the Cleric level. if Blk > 2 then Clr = Clr + Blk - 2 elseif Pal > 3 then Clr = Clr + Pal - 3 end if 'Improved Turning = one extra level if cr.HasFeatName("Improved Turning") then Clr = Clr + 1 end if ChaMod = cr.ChaMod GloryBonus = 0 if cr.HasFeatName("domain (glory)") then GloryBonus = 2 end if ' SynergySkill = "Knowledge (undead)" SynergySkill = "Knowledge (religion)" K = func.GetSkillNum(cStr(SynergySkill)) KR = cr.SkillRanks(K) if KR > 4 then synergy = 2 else synergy = 0 end if ' make a turning check (d20 + CHA-mod + synergy) RollBonus = ChaMod + synergy + GloryBonus CheckRoll = "1d20" CheckRollDesc = "1d20 + " & ChaMod & " Cha mod" if synergy > 0 then CheckRollDesc = CheckRollDesc & " + " & synergy & " synergy bonus" end if if GloryBonus > 0 then CheckRollDesc = CheckRollDesc & " + 2 Glory domain bonus" end if TurnCheck = func.RollDice(CheckRoll) + RollBonus ' Confirm result TurnCheck = Inputbox("Roll a Turn Check (" & CheckRollDesc & ")", "Turn Check", TurnCheck) ' Determine the maximum # HD turned if TurnCheck < 1 then MaxHD = Clr - 4 elseif TurnCheck < 4 then MaxHD = Clr - 3 elseif TurnCheck < 7 then MaxHD = Clr - 2 elseif TurnCheck < 10 then MaxHD = Clr - 1 elseif TurnCheck < 13 then MaxHD = Clr elseif TurnCheck < 16 then MaxHD = Clr + 1 elseif TurnCheck < 19 then MaxHD = Clr + 2 elseif TurnCheck < 22 then MaxHD = Clr + 3 else MaxHD = Clr + 4 end if if MaxHD < 0 then MaxHD = 0 end if ' roll Turning Damage (2d6 + cleric level + CHA-mod) ' If the Cleric has the Glory domain, then they get a 3rd d6 for their damage roll. if cr.HasFeatName("domain (glory)") then DmgRoll = "3d6" else DmgRoll = "2d6" end if TurnDam = func.RollDice(DmgRoll) + Clr + ChaMod ' Confirm result TurnDam = Inputbox("Roll Turning Damage ("& DmgRoll & "+" & Clr & "+" & ChaMod & ")", "Turning Damage", TurnDam) ' format the message msg = "\b1 " & cr.Name & "\b0 makes a turning check: \cf1 " & TurnCheck & "\cf0 . Max HD turned \b1\cf1 " msg = msg & MaxHD & "\cf0\b0 . Total # of HD turned \b1\cf1 " & TurnDam & "\cf0\b0 . " msg = msg & "Those with \b1\cf1 " & Clr\2 & "\cf0\b0 HD and below are destroyed. " ' return the message TurnUndead = msg End Function