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)
-   -   Chooser Table (menu_things?) that dictates the values of two selections in form (http://forums.wolflair.com/showthread.php?t=60078)

Duggan January 31st, 2018 07:47 PM

Chooser Table (menu_things?) that dictates the values of two selections in form
 
I'm still wrapping my head around a lot of things. In Planet Mercenary, each player has three fireteam members, basically a squad that follows him and takes orders. Each fireteam member has a role, something like "Specialist" or "Officer-in-Training" and five skills, Combat, Physical, Mental, Social, and Damage. The role is partly cosmetic and partly determines which skills can be chosen for that fireteam member (for example, a Specialist gets +1 Mental and +1 to another skill that isn't Damage). The skills chose can be doubled up, so a Specialist might have +2 Mental, or an Officer-in-Training might have +2 Social.

Currently, each fireteam member has fields that contain the values for those five skills, and a field for their name. I would like to be able to edit those Fireteam members to set a role, and then the two skills that they can pick based on that role (although I'm currently ignoring the role and working toward letting the user select two skills. I figure I can then refine it to the role setup), and then be able to edit additional details for players who want more info on their Fireteam members (race, biography, etc).

First off, I'm finding myself going back and forth on how to handle the skill bonuses. Since they're user-selected, I'm considering setting each member up with a Gizmo, creating a component/compset for the skills, and then "things" for each of the five skills, and letting a Chooser Table add them to the Fireteam member, either on the Fireteam Tab (which would show the aggregate value of adding up the skill values for each of the team members, then have individual entries below) or using a separate Form (so that the user would use the name and skill values in a table, then could click on a Configure button to actually set details).

Right now, my approach is to set up an FTSkill component/autocompset, and then have "thing" entries for the five skills which have an "eval" to increment the relevant fields on their parent, if present. I'm still trying to set that up, so I don't have code. But that seems kind of ugly and hacky for something working on a set list of skills, which also exist as fields on another thing. I also find myself trying to think through how to set things up so that a particular role has two sets of choices that can be set up.

*wry grin* And, I guess, after that, the user interface for it? Long story short, my brain is just not twisting the direction I need on this. Does it make sense to just add instances onto that Fireteam member representing the Skill Bonus and then total them up instead of storing a Field? Or should the field do that count maybe?

Under assumptions that I feel are safe:
  • The list of skills won't change for the Fireteam members
  • It's reasonably safe to go with there only ever being a fixed number of Fireteam members (in the game, it is possible to have more of them with certain cards, or for some of them to be "Probies" that offer no bonus)
  • Every "role" only offers the ability to boost two skills, and the two skills don't inter-connect such that we need to worry about them being distinct from each other, although they might have different rules

Anyhow, I'm going to keep plugging away, and I'll provide what code I have as I refine my idea, but I want to put it out here.

Code:

<component
  id="FTMember"
  name="Fireteam Member"
  autocompset="no"
  panellink="ftPanel">
 
  <!-- In-play bonuses applied to the trait -->
  <field
    id="ftName"
    name="Fireteam member name"
    type="user"
    maxlength="200">
    </field>
 
  <field
    id="ftPhysical"
    name="Fireteam physical skill"
    type="derived">
    </field>
 
  <field
    id="ftMental"
    name="Fireteam mental skill"
    type="derived">
    </field>
   
  <field
    id="ftSocial"
    name="Fireteam social skill"
    type="derived">
    </field>
   
  <field
    id="ftCombat"
    name="Fireteam combat skill"
    type="derived">
    </field>
 
  <field
    id="ftDamage"
    name="Fireteam damage"
    type="derived"
    defvalue="1">
    </field>
   
  <field
    id="ftComDam"
    name="Combat and Damage"
    type="static"
    maxfinal="10">
    <finalize><![CDATA[
      ~Displays name
      @text = field[ftCombat].value & " (" & field[ftDamage].value & "d6)"
      ]]></finalize>
    </field>
 
  <field
    id="ftNotes"
    name="Fireteam notes"
    type="user">
    </field>   
  </component>

Code:

<!-- Fireteam -->
<compset
  id="FTMember">
  <compref component="FTMember"/>
  </compset>

Code:

<!-- Fireteam Thing -->
<thing
  id="Fireteam"
  name="Fireteam member"
  compset="FTMember"
  isunique="no"
  description="This is a fireteam entry.">
  <child entity="ftDetails"/>
  </thing>


Duggan February 3rd, 2018 11:54 AM

OK... I think I understand this a little better. I made my Fireteam thing a UserSelect to get the two menus (I'll figure out the Role later) and added some FTSkill things to pull the list from.

Code:

<thing
  id="Fireteam"
  name="Fireteam member"
  compset="FTMember"
  isunique="no"
  description="This is a fireteam entry.">
 
  <fieldval field="usrCandid1" value=" "/>
  <fieldval field="usrCandid2" value=" "/>
 
  <eval index="1" phase="PreTraits" priority="4900">
    <before name="Calc trtFinal"/><![CDATA[
    debug field[usrChosen1].chosen.field[name].text & ", " & field[usrChosen2].chosen.field[name].text
    ]]>
    </eval>
 
  <child entity="ftDetails"/>
  </thing>

<thing
  id="ftPhysical"
  name="Physical"
  compset="FTSkill"/>
 
<thing
  id="ftMental"
  name="Mental"
  compset="FTSkill"/>

<thing
  id="ftSocial"
  name="Social"
  compset="FTSkill"/>

<thing
  id="ftCombat"
  name="Combat"
  compset="FTSkill"/>

<thing
  id="ftDamage"
  name="Damage"
  compset="FTSkill"/>

That lets me select skills off of the list, but now I need to use that to modify the relevant fields. Or perhaps I need to address this differently... I want to have those settings change the relevant values for each Fireteam members (so that, for example, selecting Physical and Physical on one Fireteam member will set the ftPhysical field to 2 while setting Physical and Damage on another will result in ftPhysical being 1 and ftDamage being 1. I was trying to use "if/elseif" statements to basically set up a switch statement, but it keeps saying that the righthand side is not valid if I try something like the following in the eval:
Code:

if (field[usrChosen1].chosen.field[name].text = "Physical") then
  debug "It's physical"
  endif

Can one not compare strings?

Duggan February 3rd, 2018 12:01 PM

I'm actually wondering if it would make more sense to be using tags here instead of field values... if I can get the menus to set the relevant tags, then I could assign them to the fireteam members, propagate them to the hero, and then do the counts on each.

Duggan February 3rd, 2018 02:25 PM

Right. And it's the "compare" function to compare strings. Setting up the if/elseif. :)

ShadowChemosh February 3rd, 2018 02:51 PM

Quote:

Originally Posted by Duggan (Post 262604)
Right. And it's the "compare" function to compare strings. Setting up the if/elseif. :)

Comparing strings is really dangerous in any language but especially for HL because is CPU intensive. I mean you sure the name is never ever going to change in any way including capitalization? Can't you add a Tag to look at instead?

Duggan February 3rd, 2018 06:18 PM

What's the best way to set the tag from the menu_thing?

ShadowChemosh February 3rd, 2018 08:37 PM

Quote:

Originally Posted by Duggan (Post 262614)
What's the best way to set the tag from the menu_thing?

If I am following you wouldn't set it on the menu_thing you would set it on the Pick that "field[usrChosen1].chosen." is pointing too.

For example if field[usrChosen1].chosen. was a list of attributes and you had tags of Attr.Physical or Attr.Mental you could have then:
Code:

if (field[usrChosen1].chosen.tagis[Attr.Physical] = 1) then
  debug "It's physical"
endif


Duggan February 4th, 2018 05:03 AM

You're absolutely right. I was overthinking it. Thank you.

Duggan February 8th, 2018 01:54 PM

I'm learning more and more about how to make this all work... among other things, I finally understand how to roll my own menuthings instead of hamfisting UserSelect into everything.

I'm trying to get the Fireteam roles working for proscribing what skills can be picked. It seemed like the easiest way to do that would be to set tags on them for what skills can be picked, and it seems to be working. The part which I'm still a bit hazy on is how to make it so that changing the Role also changes the chosen skills in the menus. Ideally, I'd like to make it so that, if there's just one choice, it sets it. If there are more, it keeps the current value if it's valid, and sets it to either the first valid choice or not defined if the new role doesn't support that skill.

Code:

<thing
  id="ftrDiplo"
  name="Diplomat"
  compset="FTRole">
  <tag group="FTSkChc1" tag="ftSocial"/>
  <tag group="FTSkChc2" tag="ftPhysical"/>
  <tag group="FTSkChc2" tag="ftMental"/>
  <tag group="FTSkChc2" tag="ftSocial"/>
  <tag group="FTSkChc2" tag="ftCombat"/>
  </thing>

The relevant code for setting the menuthing expressions:
Code:

<eval index="1" phase="PreTraits" priority="4500">
  <before name="Calc trtFinal"/><![CDATA[
  var skChoices1 as string
  var skChoices2 as string
  skChoices1 = field[FTRole].chosen.tagids[FTSkChc1.?, " | "]
  skChoices2 = field[FTRole].chosen.tagids[FTSkChc2.?, " | "]
 
  field[availSk1].text = skChoices1
  field[availSk2].text = skChoices2
   
  ]]>
  </eval>

Side note, I think I need to figure out pushtags and pulltags and how to use them.

ShadowChemosh February 9th, 2018 10:10 AM

Quote:

Originally Posted by Duggan (Post 262817)
Side note, I think I need to figure out pushtags and pulltags and how to use them.

Basically these should be called "copy" tag function. And then push/pull is saying which way to copy the tags.

Some examples. Assume these scripts are running on a thing called 'Shadow1'. :) In addition Shadow1 has been set with a tag of Helper.Food.
Code:

~ Copy tag UseAttr.aDEX from aDEX Pick to ourself
perform hero.child[aDEX].pulltags[UseAttr.aDEX]

After doing this the Thing Shadow1 will have a tag called UseAttr.aDEX on itself.

Code:

~ Copy any Helper tags from our self to the Hero container
perform hero.pushtags[Helper.?]

After running this command the Helper.Food tag would get copied and applied to the Hero. If any other Helper tags where on Shadow1 they to would get copied to the hero.

Hope that helps. :)


All times are GMT -8. The time now is 07:37 AM.

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