Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - d20 System

Notices

Reply
 
Thread Tools Display Modes
Illyahr
Senior Member
 
Join Date: Feb 2013
Posts: 357

Old November 16th, 2016, 01:04 PM
If you can select a skill to get a bonus to but have to have a certain number of ranks in the chosen skill, how would you code the prerequisites?
Illyahr is offline   #1 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,146

Old November 17th, 2016, 05:42 AM
Quote:
Originally Posted by Illyahr View Post
If you can select a skill to get a bonus to but have to have a certain number of ranks in the chosen skill, how would you code the prerequisites?
Pre-reqs are designed to prevent someone from selecting the thing in the first place. For something like this, I think it would make more sense to either restrict the options based on the number of ranks each skill has or create an eval rule which would pop an error if you select the wrong skill. In either case, you want to look at the field kUserRanks on each skill.

If this is for a feat, the eval rule would probably look something like this:

Code:
validif (field[fChosen].chosen.field[kUserRanks].value >= #)
I would prefer to restrict the choices, which would take a little more work. I think you'd have to run a foreach loop to search through the skills to see which ones have the required number of ranks and assign a new User tag to them. Then you can use the User tag as part of your equation to show the options. That would look something like this:

Code:
foreach pick in hero from BaseSkill
  if (eachpick.field[kUserRanks].value >= #) then
     perform each.assign[User.Tag]
  endif
nexteach
Then the choose's custom expression would be:

Code:
component.BaseSkill & User.Tag
I know Shadow isn't a fan of foreach loops, but I can't think of an alternative at the moment. I also haven't tested this, so no guarantees!
Sendric is offline   #2 Reply With Quote
ErinRigh
Senior Member
 
Join Date: Oct 2016
Posts: 621

Old November 17th, 2016, 06:09 AM
Hey Sendric, thanks for your quick answers, can you give me the complete eval rule to add this for a feat? Coding is only level 2 now.
ErinRigh is offline   #3 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,146

Old November 17th, 2016, 06:33 AM
Quote:
Originally Posted by ErinRigh View Post
Hey Sendric, thanks for your quick answers, can you give me the complete eval rule to add this for a feat? Coding is only level 2 now.
The first line of code I provided above should do the trick. Just replace # with the actual number of ranks required. If it doesn't work, let me know.
Sendric 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 02:58 AM.


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