Lone Wolf Development Forums  

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

Notices

Reply
 
Thread Tools Display Modes
RavenX
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2011
Location: Nowhere, Virginia
Posts: 3,633

Old June 27th, 2017, 03:12 AM
How do you get the Karma costs to lock down the value of the attribute to be increased? I notice that when you increase an attribute, on the form that pops up, the cost is shown as X + (X x 5) Karma = X + 1. How does hero lab know to take that X value and not increase it as you add additional increases?

RavenX Pronouns: She/Her

Please do not PM me to inquire about datafiles I coded "for personal use" such as Exalted, World of Darkness, AD&D, or Warhammer 40K Roleplaying. I appreciate your interest, but I do not own the Intellectual Property rights to these game systems. Nor do I have permission from any of the Publishers to distribute the data files. As such, I cannot distribute the work I have done with community on these files. They are "for personal use" only. Thank you.

I am far too busy these days to answer emails. If you message me here there is no guarantee I will get back to you at all.
RavenX is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old June 27th, 2017, 09:14 AM
Timing - the bonus added by each advancement and the cost paid for that advancement are both calculated in the same script (Calc Advance). Because the advancements have an order, that script is processed in order from oldest advancement to newest advancement, so as each pick gets to that script, it sees the bonus added by the last script, leaving the total value of whatever's being advanced at the value it last got advanced to, so this script calculates its cost based on that current value, and then adds its own bonus, and the next thing to add an advancement to the same thing sees that new value.
Mathias is offline   #2 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old June 27th, 2017, 09:17 AM
For the thing templates, that's probably easier to show you:

Code:
  <!-- advBoost template -->
  <template
    id="advBoost"
    name="Boost Existing Ability"
    compset="CanAdvance">

    <portal
      id="value"
      style="lblDisable">
      <label>
        <labeltext><![CDATA[
          var basevalue as number
          if (tagis[component.SkillIndiv] <> 0) then
            basevalue = maximum(field[sklGroup].value, field[trtUser].uservalue + field[trtAdvMod].value + field[trtBonus].value + field[trtInitial].value) + field[trtBase].value - tagis[thing.selected]
          else
            basevalue = field[trtUser].uservalue + field[trtAdvMod].value + field[trtBonus].value + field[trtInitial].value + field[trtBase].value - tagis[thing.selected]
            endif

          var oldvalue as number
          var oldtext as string
          if (tagis[component.Ability] <> 0) then
            if (empty(field[abRatDesc].arraytext[basevalue - 1]) = 0) then
              oldtext = field[abRatDesc].arraytext[basevalue - 1]
              @text = oldtext
            else
              oldvalue = basevalue
              @text = "(" & oldvalue & ")"
              endif
          else
            oldvalue = basevalue
            @text = oldvalue
            endif
          ]]></labeltext>
        </label>
      </portal>

    <portal
      id="next"
      style="lblDisable">
      <label>
        <labeltext><![CDATA[
          var basevalue as number
          if (tagis[component.SkillIndiv] <> 0) then
            basevalue = maximum(field[sklGroup].value, field[trtUser].uservalue + field[trtAdvMod].value + field[trtBonus].value + field[trtInitial].value) + field[trtBase].value - tagis[thing.selected]
          else
            basevalue = field[trtUser].uservalue + field[trtAdvMod].value + field[trtBonus].value + field[trtInitial].value + field[trtBase].value - tagis[thing.selected]
            endif

          var newvalue as number
          var newtext as string
          if (tagis[component.Ability] <> 0) then
            if (empty(field[abRatDesc].arraytext[basevalue]) = 0) then
              newtext = field[abRatDesc].arraytext[basevalue]
              @text = newtext
            else
              newvalue = basevalue + 1
              @text = "(" & newvalue & ")"
              endif
          else
            newvalue = basevalue + 1
            @text = newvalue
            endif
          ]]></labeltext>
        </label>
      </portal>

    <portal
      id="name"
      style="lblLeft">
      <label>
        <labeltext><![CDATA[
          @text = field[livename].text
          if (tagis[SkillHelp.UsingGroup] <> 0) then
            @text &= " {size 30}{text clrsklgrp}(" & tagnames[SkillGroup.?] & ")"
            endif
          ]]></labeltext>
        </label>
      <mouseinfo><![CDATA[
        if (tagis[SkillHelp.UsingGroup] <> 0) then
          @text = "This skill is currently part of a skill group.  Adding points to it will break up the skill group.  This cannot be undone."
        else
          @text = ""
          endif
        ]]></mouseinfo>
      </portal>

    <portal
      id="cost"
      style="lblDisable">
      <label>
        <labeltext><![CDATA[
          var basevalue as number
          if (tagis[component.SkillIndiv] <> 0) then
            basevalue = maximum(field[sklGroup].value, field[trtUser].uservalue + field[trtAdvMod].value + field[trtBonus].value + field[trtInitial].value) + field[trtBase].value - tagis[thing.selected]
          else
            basevalue = field[trtUser].uservalue + field[trtAdvMod].value + field[trtBonus].value + field[trtInitial].value + field[trtBase].value - tagis[thing.selected]
            endif

          var cost as number
          if (tagis[component.SkillIndiv] <> 0) then
            cost = basevalue + 1
          elseif (tagis[component.Quality] <> 0) then
            if (tagis[QualityCat.Positive] <> 0) then
              cost = field[abRating].arrayvalue[basevalue] - field[abRating].arrayvalue[basevalue - 1]
            else
              cost = 0
              endif
          elseif (tagis[component.AdeptPower] <> 0) then
            cost = field[abRating].arrayvalue[basevalue] - field[abRating].arrayvalue[basevalue - 1]
          elseif (tagis[Advance.MultNew] <> 0) then
            cost = basevalue + 1
          else
            cost = 1
            endif

          cost *= field[trtAdvCost].value * field[trtAdvMult].value
          cost += field[trtAdvBon].value

          if (tagis[component.AdeptPower] <> 0) then
            @text = "+ " & cost & " PP ="
          else
            @text = "+ " & cost & " Karma ="
            endif
          ]]></labeltext>
      </label>
      </portal>

    <position><![CDATA[
      ~ Set up our width and height
      height = maximum(portal[name].height,portal[next].height)

      width = 300

      ~if we've being sized, there's nothing more to do
      doneif (issizing <> 0)

      ~position the next value portal on the right edge
      perform portal[next].alignedge[right,0]

       ~position the cost portal next to it
       perform portal[cost].alignrel[rtol,next,-5]

      ~Place the value next to the cost
      perform portal[value].alignrel[rtol,cost,-5]

      ~ Position our name on the left
      portal[name].left = 0
      portal[name].width = minimum(portal[name].width, portal[value].left - 10)
      perform portal[name].sizetofit[20]
      perform portal[name].autosize
      perform portal[name].centervert
      perform portal[cost].centervert
      perform portal[value].centervert
      perform portal[next].centervert
      ]]></position>
    </template>
Mathias is offline   #3 Reply With Quote
RavenX
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2011
Location: Nowhere, Virginia
Posts: 3,633

Old June 27th, 2017, 07:51 PM
Considering how familiar I am with templates now, its much easier for me to study and learn from the code you did. Thank you for showing me this, I should be able hammer this out in my files now.

RavenX Pronouns: She/Her

Please do not PM me to inquire about datafiles I coded "for personal use" such as Exalted, World of Darkness, AD&D, or Warhammer 40K Roleplaying. I appreciate your interest, but I do not own the Intellectual Property rights to these game systems. Nor do I have permission from any of the Publishers to distribute the data files. As such, I cannot distribute the work I have done with community on these files. They are "for personal use" only. Thank you.

I am far too busy these days to answer emails. If you message me here there is no guarantee I will get back to you at all.
RavenX is offline   #4 Reply With Quote
RavenX
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2011
Location: Nowhere, Virginia
Posts: 3,633

Old June 27th, 2017, 10:04 PM
When you say "timing" I'm guessing you mean after trtFinal is calculated in Traits 3000 but before the derived component recalculates it in Traits 6000 in the skeleton files?

RavenX Pronouns: She/Her

Please do not PM me to inquire about datafiles I coded "for personal use" such as Exalted, World of Darkness, AD&D, or Warhammer 40K Roleplaying. I appreciate your interest, but I do not own the Intellectual Property rights to these game systems. Nor do I have permission from any of the Publishers to distribute the data files. As such, I cannot distribute the work I have done with community on these files. They are "for personal use" only. Thank you.

I am far too busy these days to answer emails. If you message me here there is no guarantee I will get back to you at all.
RavenX is offline   #5 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old June 28th, 2017, 07:38 AM
Shadowrun needed to expand that "multiple calculations of trtFinal" concept, because of the number of times one attribute's value is used to calculate some bonus or limit on a thing used on another attribute, which then affects the calculation of some other bonus - it actually does it 4 times, all within the traits component.

The script on advances happens between Bound trtUser and the first of those trtFinal calculations. That script manually calculates the portion of trtFinal that comes from fields that will be counted towards advancement costs, like trtUser and the field used for racial bonuses, calculating a "base value" from those fields, that it uses in its own calculations.

Do you want that whole script?

Last edited by Mathias; June 28th, 2017 at 07:46 AM.
Mathias is offline   #6 Reply With Quote
RavenX
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2011
Location: Nowhere, Virginia
Posts: 3,633

Old June 28th, 2017, 06:33 PM
Quote:
Originally Posted by Mathias View Post
Shadowrun needed to expand that "multiple calculations of trtFinal" concept, because of the number of times one attribute's value is used to calculate some bonus or limit on a thing used on another attribute, which then affects the calculation of some other bonus - it actually does it 4 times, all within the traits component.

The script on advances happens between Bound trtUser and the first of those trtFinal calculations. That script manually calculates the portion of trtFinal that comes from fields that will be counted towards advancement costs, like trtUser and the field used for racial bonuses, calculating a "base value" from those fields, that it uses in its own calculations.

Do you want that whole script?
It might help me, yes. I need to figure out how it works so I know how to implement the advances in my datafile.

RavenX Pronouns: She/Her

Please do not PM me to inquire about datafiles I coded "for personal use" such as Exalted, World of Darkness, AD&D, or Warhammer 40K Roleplaying. I appreciate your interest, but I do not own the Intellectual Property rights to these game systems. Nor do I have permission from any of the Publishers to distribute the data files. As such, I cannot distribute the work I have done with community on these files. They are "for personal use" only. Thank you.

I am far too busy these days to answer emails. If you message me here there is no guarantee I will get back to you at all.
RavenX is offline   #7 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old June 29th, 2017, 09:11 AM
It's a long script, but here you go;

Code:
    <!-- If this is an increase, add one to the trait, and subtract one for a decrease -->
    <eval index="4" phase="Traits" priority="2000" name="Calc Advance"><![CDATA[
      ~we only worry about this on actual advances - not traits added at creation
      doneif (tagis[Advance.Gizmo] = 0)

      var basevalue as number

      ~if we're one of the shifter attribute advancements, we'll establish a
      ~focus to the version of ourselves that exists inside the shift power's
      ~gizmo.  If not, we'll set the focus to linkage[basis]
      if (origin.parent.tagis[Advance.ShiftAttr] <> 0) then
        doneif (hero.childlives[cpShiftSha] = 0)
        perform hero.child[cpShiftSha].gizmo.findchild[Attribute,"thingid." & linkage[basis].idstring].setfocus
      elseif (origin.parent.tagexpr[Advance.Increase | Advance.Decrease] <> 0) then
        perform linkage[basis].setfocus
        endif
      if (origin.parent.tagexpr[Advance.Increase | Advance.Decrease] <> 0) then
        doneif (state.isfocus = 0)
        endif

      ~increase and decrease advancements often need to look up the base value of the thing they're working with
      if (origin.parent.tagis[Advance.Increase] + origin.parent.tagis[Advance.Decrease] <> 0) then
        if (tagis[component.SkillIndiv] <> 0) then
          basevalue = maximum(focus.field[trtUser].value, focus.field[sklGroup].value) + focus.field[trtAdvMod].value + focus.field[trtBase].value + focus.field[trtBonus].value + focus.field[trtInitial].value
        else
          basevalue = focus.field[trtUser].value + focus.field[trtAdvMod].value + focus.field[trtBase].value + focus.field[trtBonus].value + focus.field[trtInitial].value
          endif
        endif

      ~apply any appropriate increase or decrease for the linked trait
      ~Note: This pick is a child of the gizmo and our parent pick is the actual "Advance"
      ~       pick that contains the appopriate "Advance" tag, so be sure to check there.
      ~Note: Since the advancement is displaced to the hero, it's "parent" is *not* the
      ~       gizmo, so we must explicitly reference through the "origin" container.
      if (origin.parent.tagis[Advance.Increase] > 0) then
        perform focus.field[trtBase].modify[+,1,"Advancement"]
        if (origin.parent.tagis[Advance.MaximumToo] <> 0) then
          focus.field[trtNatMax].value += 1
          endif
        if (tagis[component.Quality] + tagis[component.AdeptPower] <> 0) then
          origin.parent.field[advCost].value = (focus.field[abRating].arrayvalue[basevalue] - focus.field[abRating].arrayvalue[basevalue - 1]) * focus.field[trtAdvCost].value
        else
          if (tagis[Advance.MultNew] <> 0) then
            origin.parent.field[advCost].value += focus.field[trtAdvCost].value * (basevalue + 1)
          else
            origin.parent.field[advCost].value += focus.field[trtAdvCost].value
            endif
          endif
      elseif (origin.parent.tagis[Advance.Decrease] > 0) then
        perform focus.field[trtBase].modify[-,1,"Advancement"]
        if (origin.parent.tagis[Advance.MaximumToo] <> 0) then
          focus.field[trtNatMax].value -= 1
          endif
        if (tagis[component.Ability] <> 0) then
          if (basevalue <= 1) then
            if (focus.field[trtBPCost].value <> 0) then
              origin.parent.field[advCost].value = - focus.field[trtBPCost].value * focus.field[trtAdvCost].value
            else
              origin.parent.field[advCost].value = - focus.field[abRating].arrayvalue[0] * focus.field[trtAdvCost].value
              endif
          else
            origin.parent.field[advCost].value = (focus.field[abRating].arrayvalue[basevalue - 2] - focus.field[abRating].arrayvalue[basevalue - 1]) * focus.field[trtAdvCost].value
            endif
        else
          if (tagis[Advance.MultNew] <> 0) then
            origin.parent.field[advCost].value += focus.field[trtAdvCost].value * (basevalue)
          else
            origin.parent.field[advCost].value += focus.field[trtAdvCost].value
            endif
          endif
      elseif (origin.parent.tagis[Advance.AddNew] <> 0) then
        ~abilities don't get the rating point.  They handle the initial point
        ~with their minimum values.
        if (tagis[component.Ability] = 0) then
          if (tagis[component.Skill] <> 0) then
            if (hero.tagis[Hero.AllySpirit] = 0) then
              perform field[trtBase].modify[+,1,"Advancement"]
              endif
          else
            perform field[trtBase].modify[+,1,"Advancement"]
            endif
          endif
        if (origin.parent.gizmo.findchild[none,"Advance.Gizmo"].tagexpr[component.Power | component.ProgEcho] <> 0) then
          origin.parent.field[advCost].value += field[trtAdvCost].value
        elseif (origin.parent.gizmo.findchild[none,"Advance.Gizmo"].tagis[component.Ability] <> 0) then
          if (origin.parent.gizmo.findchild[none,"Advance.Gizmo"].field[abRating].arrayvalue[0] <> 0) then
            origin.parent.field[advCost].value += origin.parent.gizmo.findchild[none,"Advance.Gizmo"].field[abRating].arrayvalue[0] * field[trtAdvCost].value
          else
            origin.parent.field[advCost].value += origin.parent.gizmo.findchild[none,"Advance.Gizmo"].field[trtBPCost].value * field[trtAdvCost].value
            endif
          endif
        endif

      if (origin.parent.tagis[Advance.NoCost] <> 0) then
        origin.parent.field[advCost].value  = 0
        endif
      ]]></eval>
Mathias is offline   #8 Reply With Quote
RavenX
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2011
Location: Nowhere, Virginia
Posts: 3,633

Old June 29th, 2017, 06:22 PM
Thanks, Mathias. Long scripts don't bother me anymore. I expect some scripts I may need to get long as the files develop. This is the only part that I have left to really hammer out now so I need to figure out how it all works.

RavenX Pronouns: She/Her

Please do not PM me to inquire about datafiles I coded "for personal use" such as Exalted, World of Darkness, AD&D, or Warhammer 40K Roleplaying. I appreciate your interest, but I do not own the Intellectual Property rights to these game systems. Nor do I have permission from any of the Publishers to distribute the data files. As such, I cannot distribute the work I have done with community on these files. They are "for personal use" only. Thank you.

I am far too busy these days to answer emails. If you message me here there is no guarantee I will get back to you at all.
RavenX is offline   #9 Reply With Quote
RavenX
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2011
Location: Nowhere, Virginia
Posts: 3,633

Old July 6th, 2017, 11:40 PM
The long script has indeed helped me greatly, thank you. I have implemented the increase/decrease advancement script successfully and it is running as it should be.

RavenX Pronouns: She/Her

Please do not PM me to inquire about datafiles I coded "for personal use" such as Exalted, World of Darkness, AD&D, or Warhammer 40K Roleplaying. I appreciate your interest, but I do not own the Intellectual Property rights to these game systems. Nor do I have permission from any of the Publishers to distribute the data files. As such, I cannot distribute the work I have done with community on these files. They are "for personal use" only. Thank you.

I am far too busy these days to answer emails. If you message me here there is no guarantee I will get back to you at all.
RavenX is offline   #10 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 01:07 PM.


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