View Single Post
RavenX
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2011
Location: Nowhere, Virginia
Posts: 3,633

Old March 15th, 2018, 01:42 PM
Here is the field I added to the category helper component

Code:
    <field
      id="cpriority"
      name="Priority"
      type="derived"
      persistence="full">
      </field>
Here is one of the two buttons that swaps the primary/secondary attributes or skills. All it does is increase the priority index of the one being lowered, then it lowers both indexes based on which one is currently in the lower position. It doesn't rely on the dot values at all, just the priority field. It's nothing elaborate, just a brute force mathematical method that does the job.

Code:
    <portal
      id="swapPS"
      style="actSwap"
      tiptext="Click here to Swap Prioritization categories.">
      <action
        action="trigger">
        <trigger><![CDATA[
          ~We need to swap our Primary and Secondary category dots

          if (hero.child[cTalent].field[cpriority].value = 1) then
            hero.child[cTalent].field[cpriority].value += 3
            if (hero.child[cSkill].field[cpriority].value = 2) then
              hero.child[cSkill].field[cpriority].value -= 1
              hero.child[cTalent].field[cpriority].value -= 2
            elseif (hero.child[cKnowledge].field[cpriority].value = 2) then
              hero.child[cKnowledge].field[cpriority].value -= 1
              hero.child[cTalent].field[cpriority].value -= 2
              endif
    
           elseif (hero.child[cSkill].field[cpriority].value = 1) then
            hero.child[cSkill].field[cpriority].value += 3
            if (hero.child[cTalent].field[cpriority].value = 2) then
              hero.child[cTalent].field[cpriority].value -= 1
              hero.child[cSkill].field[cpriority].value -= 2
            elseif (hero.child[cKnowledge].field[cpriority].value = 2) then
              hero.child[cKnowledge].field[cpriority].value -= 1
              hero.child[cSkill].field[cpriority].value -= 2
              endif

           elseif (hero.child[cKnowledge].field[cpriority].value = 1) then
            hero.child[cKnowledge].field[cpriority].value += 3
            if (hero.child[cTalent].field[cpriority].value = 2) then
              hero.child[cTalent].field[cpriority].value -= 1
              hero.child[cKnowledge].field[cpriority].value -= 2
            elseif (hero.child[cSkill].field[cpriority].value = 2) then
              hero.child[cSkill].field[cpriority].value -= 1
              hero.child[cKnowledge].field[cpriority].value -= 2
              endif

            endif

          
          ]]></trigger>
        </action>
      </portal>

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