Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - D&D 5th Edition SRD

Notices

Reply
 
Thread Tools Display Modes
jjashley
Senior Member
 
Join Date: Jan 2017
Posts: 139

Old February 14th, 2018, 11:17 AM
I'm sure you fine folks are as tired of hearing from me as I am asking. I found the below script on how to calculate half character level.

~ Calculate half character level minimum 1
field[abValue].value += maximum(round(field[xTotalLev].value/2,0,-1),1)

I'd like to actually figure this for class level, I tried the following but I find that the penalty gets set to the last digit in the string. The above was written for pathfinder and the fields found there. For those wondering this is for figuring the mutation score of a Blood Hunter. I'd like to add the mutagens as adjustments to the character and a number of them require figuring the mutation score which is class level divided by 4 rounded down with a minimum of 1. I have tried a couple of different variations but always come up with it giving a penalty of 0. Any ideas on what I'm doing wrong or a better way to figure the mutation score and use it to determine the penalty or bonus depending on the mutagen?

hero.child[Initiative].field[Penalty].value -= maximum(round(hero.child[Totals].field[tTotLevel].value/4,0,-1),3)

J
jjashley is offline   #1 Reply With Quote
dungeonguru
Senior Member
 
Join Date: May 2016
Posts: 608

Old February 14th, 2018, 12:22 PM
Make sure you're running the script post-levels and here's one that is working, you just need to swap out the class (minimum of -1 penalty, maximum is determined by dividing the level count by 4).

hero.child[Initiative].field[Penalty].value -= maximum(round(#levelcount[Fighter]/4,0,-1),1)
dungeonguru is offline   #2 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old February 14th, 2018, 12:51 PM
Quote:
Originally Posted by dungeonguru View Post
hero.child[Initiative].field[Penalty].value -= maximum(round(#levelcount[Fighter]/4,0,-1),1)
Honestly for any Class Ability should never hard-code a specific class as it prevents the ability from being used by other classes.

Class Abilities have a field called xTotalLev that should be used to get total class level. In addition its easy to apply "effective class increases" by using the above field.

If it was me building a class ability I would always store the value that increases/decreases into abValue to allow outside scripts to affect the ability.

Meaning I end up with the following logic:
Code:
field[abValue].value += -1 * maximum(round(field[xTotalLev].value/4,0,-1),1) 

hero.child[Initiative].field[Penalty].value += field[abValue].value

Hero Lab Resources:
Pathfinder - d20pfsrd and Pathfinder Pack Setup
3.5 D&D (d20) - Community Server Setup
5E D&D - Community Server Setup
Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources.
Created by the community for the community
- Realm Works kickstarter backer (Alpha Wolf) and Beta tester.
- d20 HL package volunteer editor.

Last edited by ShadowChemosh; February 14th, 2018 at 12:53 PM.
ShadowChemosh is offline   #3 Reply With Quote
jjashley
Senior Member
 
Join Date: Jan 2017
Posts: 139

Old February 14th, 2018, 12:58 PM
Quote:
Originally Posted by dungeonguru View Post
Make sure you're running the script post-levels and here's one that is working, you just need to swap out the class (minimum of -1 penalty, maximum is determined by dividing the level count by 4).

hero.child[Initiative].field[Penalty].value -= maximum(round(#levelcount[Fighter]/4,0,-1),1)
Once again I thank you very much. I appreciate your patience with me to no end.

J
jjashley is offline   #4 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 12:03 AM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.