Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Authoring Kit (http://forums.wolflair.com/forumdisplay.php?f=58)
-   -   Prioritization of Attributes and Skills (http://forums.wolflair.com/showthread.php?t=60360)

RavenX March 13th, 2018 06:06 PM

Prioritization of Attributes and Skills
 
Mathias,

Can I please see the portal script for the action buttons in the World of Darkness code that swaps categories? I am referring to the buttons that switch the category dots.

I have done this as a chooser menu but I really would rather setup a couple of those buttons to do the switcheroo on the categories instead. I just can't figure out how the button does the swapping.

RavenX March 13th, 2018 06:08 PM

1 Attachment(s)
This picture shows what I am asking to see, the button with the two arrows that swaps one category for another.

RavenX March 14th, 2018 07:51 PM

I think I may have finally found a way to get this working... after months of scratching my head at it.

Duggan March 15th, 2018 08:12 AM

^_^ When you do, can you share the code so that others looking in the future will know?

Mathias March 15th, 2018 08:36 AM

Sorry I didn't get a chance to respond before now. My recommendation would be to store a user field on the component that's used for the picks that are storing the number of points available to each option. Then, when building the three picks in the editor, set the value of this field to 0, 1, and 2 on diferent picks.

Then, your first button would run a script that looks at the current value of pick A, stores that value in a variable, then copies the current value on B to A, then sets the stored value in the variable to be B's order value. The other button would run a very similar script, but instead, would swap the values on B and C.

Then, the picks would have a component script that said "if my order value is 0, I'm worth X points to my category, if my order value is 1, I'm worth Y, etc."

Mathias March 15th, 2018 08:58 AM

Thinking about it, I would not recreate the button system from our WoD files if I were doing them from scratch today - I'd use a user-sortable table to define the priorities and allow the user to control their relative order, the way Shadowrun does.

That just needs a fixed table with allowuserorder="yes", and make sure the component="" of that table is set to a component that has a orderfield="priOrder". Then, a component script on that component will look up the orderfield and convert that into the number of points. And like my previous suggestion, in the editor, you'd set default order values for each of the three picks.

You'll also need a showsortset="" on the table, that uses the orderfield on that component:
Code:

  <!-- The priorities table is a user-ordered table -->
  <sortset
    id="PriorTable"
    name="User-Assigned Priority Order">
    <sortkey isfield="yes" id="priOrder" isascend="yes"/>
    </sortset>


Mathias March 15th, 2018 10:32 AM

With enough work, you might be able to set things up so that the user doesn't even need to set the priorities themselves. What you can do is to total up the number of points the user has spent in each category, put those in order, and put the number of points available in each category into the same order. There's some default ordering pre-set, so that if physical and mental currently have the same amount spent, then you've already worked out that physical will get sorted first, or whatever default you want. That will also be the case on a newly created character, where all the attributes are still at their default.

RavenX March 15th, 2018 01:36 PM

I haven't checked on all of the systems yet, I just finished up V20. The table idea is nice, I ended up adding prioritization field with persistence="full" to each category thing and then had the swap buttons modify those values when used, which causes the dot swap. It's a bit of a brute force method but it works exactly the same way you did the WoD file. I know with oWoD I needed the prioritizations because they are not always going to be the same number.

A Vampire gets 7/5/3 on attributes, a Ghoul gets 6/4/3 and though I haven't seen it there is a possibility that two categories could get an equal number of dots. I managed to make the data work though last night.

RavenX 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 March 15th, 2018 01:59 PM

To be honest, the way shadowrun 5 does it is cool, but I'd still need to see lines of code for the drag and drop table you rigged up. And that might be easier to do. It took me a long time to finally find a method that works like the old WoD code.


All times are GMT -8. The time now is 09:00 PM.

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