Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Authoring Kit

Notices

Reply
 
Thread Tools Display Modes
Duggan
Senior Member
Volunteer Data File Contributor
 
Join Date: Nov 2009
Posts: 1,502

Old September 13th, 2017, 07:06 PM
So, I'm working on a more flexible way to set up the skill bonuses and penalties for the various backgrounds. This is what I've wound up with so far:

thing_miscellanous.dat (The names aren't great, I know, but fRPlusSk gives the person who picked that background a set of choices from which they pick one to apply the bonus or penalty to. fRPlusSk2 applies the same bonus or penalty to a bunch of skills that fit the list)
Code:
  <thing
    id="fRPlusSk"
    name="Skill Bonus"
    compset="cmpsetSB"
    description="Gives a bonus to the selected skill.">
    <fieldval field="usrCandid1" value="component.Skill"/>
    <tag group="Hide" tag="Special"/>
    <eval index="1" phase="PreTraits" priority="4900">
      <before name="Calc trtFinal"/><![CDATA[
      var bonus as number
      var penalty as number
      bonus = tagvalue[Bonus.?]
      penalty = tagvalue[Penalty.?]
      if (bonus = 0) then
        if (penalty = 0) then
          bonus = 2
        else
          bonus = penalty
        endif
      endif
      
      if (bonus > 0) then
        field[livename].text = "+" & bonus & " " & livename
      else
        field[livename].text = bonus & " " & livename
      endif
      
      ~build the candidate expression out of our Skill and Skills tags
      var skills as string
      skills = tagids[Skill.?, " | "]
      var skilltypes as string
      skilltypes = tagids[Skills.?, " | "]

      var combined as string
      if (tagis[Skills.?] <> 0) then
        if (tagis[Skill.?] <> 0) then
          combined = skills & " | " & skilltypes
        else
          combined = skilltypes
        endif
      else
        combined = skills
      endif
      
      ~ debug combined & ", " & empty(combined)
      if (empty(combined) = 0) then
        field[usrCandid1].text &= " & (" & combined & ")"
      endif
        
      perform field[usrChosen1].chosen.field[trtBG].modify[+,bonus,"Background"]
      ]]></eval>
    </thing>
        
  <thing
    id="fRPlusSk2"
    name="Multiple Skill Bonuses"
    compset="cmpsetSB"
    description="Gives a bonus to the selected skills.">
    <tag group="Hide" tag="Special"/>
    <eval index="1" phase="PreTraits" priority="4900">
      <before name="Calc trtFinal"/><![CDATA[
      var bonus as number
      var penalty as number
      bonus = tagvalue[Bonus.?]
      penalty = tagvalue[Penalty.?]
      if (bonus = 0) then
        if (penalty = 0) then
          bonus = 2
        endif
      endif
      
      field[usrCandid1].text = ""
      
      ~build the candidate expression out of our Skill and Skills tags
      var skills as string
      skills = tagids[Skill.?, " | "]
      var skilltypes as string
      skilltypes = tagids[Skills.?, " | "]

      if (bonus > 0) then
        field[livename].text = "+" & bonus & " to Multiple"
        
        foreach pick in hero from Skill where skills
          perform eachpick.field[trtBG].modify[+,bonus,"Background"]
        nexteach
      
        foreach pick in hero from Skill where skilltypes
          perform eachpick.field[trtBG].modify[+,bonus,"Background"]
        nexteach
      elseif (penalty > 0) then
        field[livename].text = "-" & penalty & " to Multiple"
        
        
        foreach pick in hero from Skill where skills
          perform eachpick.field[trtBonus].modify[-,penalty,"Background"]
        nexteach
      
        foreach pick in hero from Skill where skilltypes
          perform eachpick.field[trtBonus].modify[-,penalty,"Background"]
        nexteach
      endif
      
      ]]></eval>
    </thing>
Here's an example of applying it from thing_races.dat involving a (made up for this example) race which gets a +2 to Athletics and Perception, takes a -1 to Social skills, and can get a +3 to any one Mental skill, or Carbines:

Code:
    <bootstrap thing="fRPlusSk2">
      <autotag group="Skill" tag="skPercept"/>
      <autotag group="Skill" tag="skAthlete"/>
      <autotag group="Bonus" tag="Plus2"/>
      </bootstrap>
    
    <bootstrap thing="fRPlusSk2">
      <autotag group="Skills" tag="Social"/>
      <autotag group="Penalty" tag="Minus1"/>
      </bootstrap>
    
    <bootstrap thing="fRPlusSk">
      <autotag group="Skills" tag="Mental"/>
      <autotag group="Skill" tag="skCarbine"/>
      <autotag group="Bonus" tag="Plus3"/>
      </bootstrap>
That produces three SkillBonus picks which I can display in a table. I have code in the pick to suppress the dropdown menu if there is no choice (aka fRPlusSk), but I'm not certain how to display what the bonus applies to. This is what it currently does:


I'm not certain if it would make more sense to modify the text to list the items (say, "-1 Skill Penalty (Social and Carbine)" and "+2 Skill Bonus (Perception and Athletics)") or if it would be possible to make it add one for each distinct entry, so that I have 5 entries:
"+2 Skill Bonus (Perception)", "+2 Skill Bonus (Athletics)", "+3 Skill Bonus [Experimental Sciences]", "-1 Skill Penalty (Social)", and "-1 Skill Penalty (Carbines)". Or, if the latter is even feasible.
Attached Images
File Type: png Skill Bonuses.png (51.1 KB, 45 views)
Duggan is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old September 14th, 2017, 08:34 AM
I'm sorry, but something about your writing style makes your questions hard for me to follow, and I can't figure out what question you're asking here.

One thing is that you're throwing around giant blocks of code that have minimal commenting, and you're not adding information before posting each section of code to say what a person should be looking for in them.
Mathias is online now   #2 Reply With Quote
Duggan
Senior Member
Volunteer Data File Contributor
 
Join Date: Nov 2009
Posts: 1,502

Old September 14th, 2017, 11:45 AM
Ah. Sorry. I am somewhat obtuse in my writing style. I blame it on reading beyond my grade level as a child, which left me with peculiar ideas of how words should hook together. I started out doing skill bonuses in Eval blocks, but I knew that eventually, I'd need to be able to allow the person creating the character to make decisions (since some of the background bonuses offer a choice, like "+2 to Athletics or History" or "+2 to any Combat skill." So I initially cribbed some code from the 4E files, doing the choice items with fRPlusSk (I think the "R" stood for Race in that case) and SkillBonus (a tag, or at least, I think it was always a tag), which offered a straight +2 to a given skill. As I got into more esoteric cases, I realized that I needed a wider range of bonuses (they range from +1 to +2, and -1 to -2, but I went from -3 to +3 to allow later users to more readily customize their own cases), and I wanted to do all of the skill bonuses in the same type of structure (so no mixing of tags and things).

Thus, I eventually wound up with fRPlusSk, which allows the user to specify a set of Skills, a set of Skill Categories, and either a Bonus or a Penalty value (the latter doesn't show up in any of the canonical backgrounds, but it was just as easy to include it). It works like I want it, creating a single thing, which corresponds to an entry in the Skill Bonuses table, with the bonus (or penalty), and dropdown list box, which lets the user pick which skill gets the bonus (or penalty).

After that, I wanted a way to specify a more static set of bonuses and penalties so, that, for example the Neophant gets a +2 to Endurance and +1 to Athletics and Perception. I tried making each one its own bootstrap, but it's a bit of a pain in practice, at least the way I've got the editor set up now. You click on the button to edit the relevant bootstrap, it pops up the form that lets you add a bootstrap, then you select the (one possible) bootstrap and then fill in the value. So I tried streamlining it so that you could list a single bonus and multiple skills that received that bonus (assume that "penalty" is available there as well) and that's how I got fRPlusSk2, which takes in a bonus (or penalty) and a set of skill or skill types, and applies the bonuses (or penalties) to each. That basically covers the first code box. The second code box is a hypothetical implementation for a given Race, Command Package, or Background (actual blocks are generally not that complicated, capping out at three skills for a Race, four for a Command Package, and three for a Background).

The problem I currently face is that I would like to list all of the bonuses in a nice manner in the Basics tab, but my current method has one thing with multiple skills. Is there a way to make one bootstrap create multiple things? Right now, it's creating a cmpsetSB (Skill Bonus compset), which includes a SkillBonus and a UserSelect (and this might be tying into me still being a bit confused about how to make visual elements because I notice that the table has holds SkillBonus items with the pick using UserSelect).

And... I'm probably making this confusing again. Base question, if I have a single bootstrap element with multiple autotags, how do I get one item in the table for each tag that corresponds to a Skill or a SkillType? Or is it just not possible?
Duggan is offline   #3 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old September 14th, 2017, 11:58 AM
Quote:
Originally Posted by Duggan View Post
And... I'm probably making this confusing again. Base question, if I have a single bootstrap element with multiple autotags, how do I get one item in the table for each tag that corresponds to a Skill or a SkillType? Or is it just not possible?
Add a separate bootstrap for each choice, each with the autotags that apply only to that choice. There isn't a way to have HL auto-create the right number of bootstraps.
Mathias is online now   #4 Reply With Quote
Duggan
Senior Member
Volunteer Data File Contributor
 
Join Date: Nov 2009
Posts: 1,502

Old September 17th, 2017, 03:12 PM
So, if I do this as tags, what's the easiest way to set up values? My prior code depending on Identity tags on the skills, and assuming +2, like the following:

Code:
if (tagis[SkillBon?.?] <> 0) then
  expr = tagids[SkillBon?.?, " | "]
  foreach pick in hero from Skill where expr
    val = tagmax[SkillBon?.?]
    perform eachpick.field[trtBG].modify[+,2,""]
  nexteach
endif
Should I just replace that with a series of "foreach" groups with the individual skill choices (SkillBon1, SkillBon2, SkillBon3)? Or is there a way to use tagvalue to extract the value involved?
Duggan is offline   #5 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old September 17th, 2017, 03:20 PM
At this point, it doesn't sound like tags are the best solution. Please describe the game rules you're trying to implement.
Mathias is online now   #6 Reply With Quote
Duggan
Senior Member
Volunteer Data File Contributor
 
Join Date: Nov 2009
Posts: 1,502

Old September 17th, 2017, 03:28 PM
For every Background, Command Package, or Race, there's a series of bonuses from +1 to +2 on various skills (which get counted as skill ranks bought against the maximum allowed at character creation) and -1 to -2 penalties on the skills (which only count against the final value). Adding a tag (as per my earlier implementation of SkillBonus) is easy to do via the Editor and basically allows you to select a series of skills that get a +2 via the implementation of their base component, which cycles through all tags that match the tags present, e.g. SkillBonus.skIntim, SkillBonus.skCarbines, and SkillBonus.skEcon. The races offer +1 bonuses in a variety of skills, as well as some more esoteric possibilities, like "+1 to all Combat skills".

You know what, I think the easiest thing to do is set up the boostrap as I mentioned above, and simply offer a "(Multiple)" addendum for the skill bonus where there's a variety of skills that get a particular bonus. Once I get other things working, I'll add mouse-over text to indicate what bonus is being added, and maybe from where.
Duggan is offline   #7 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 10:59 AM.


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