• 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

Required ranks for chosen skill.

Illyahr

Well-known member
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?
 
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!
 
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.
 
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.
 
Back
Top