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)
-   -   Bootstrapping a gizmo pick from the editor (http://forums.wolflair.com/showthread.php?t=59267)

Duggan October 3rd, 2017 07:01 AM

Bootstrapping a gizmo pick from the editor
 
Another one of those things I just can't seem to wrap my head around despite looking at the examples. A given Race or Command Package can give the player a free skill Specialty. When I had skill Specialties be something that was on the hero itself, rather than a pick on the child entity attached to the Skill, so this was as simple as a bootstrap entry on the Race or Command Package, and an it_bootcustom in the editor entry. Well, that no longer works and I can't quite figure out how to make it work.

A given Specialty has a tag to indicate which skill it's matched up to, e.g.
Code:

<!-- Thermal Skill Specialty -->
<thing
  id="spPercThrm"
  name="Thermal"
  compset="Specialty"
  isunique="yes"
  description="Apply this specialty when using an organ or apparatus that senses temperature. If you can “see” in infrared, then your Sight specialty applies instead, and you should lord that up over lesser creatures by talking about how lovely everything looks.">
  <tag group="Skill" tag="skPercept"/>
</thing>

The specialty is attached via an entity (in traits.str)
Code:

<entity
  id="entSpec"
  form="frmSpec">
  <bootstrap thing="SpecHelp"/>
</entity>

SpecHelp and Specialty are, of course, defined earlier in the file:
Code:

<component
  id="Specialty"
  name="Specialization"
  autocompset="no"
  panellink="skills">
 
  <!-- Display Name for use on Specialties Tab -->
  <field
    id="spcTabName"
    name="Display Name (Tab)"
    type="static"
    maxlength="50"
    maxfinal="50">
    <finalize><![CDATA[
      ~Displays name
      @text = field[name].text & " (" & this.tagnames[Skill.?," "]  & ")"
      ]]></finalize>
    </field>
 
  <identity group="Specialty"/>
 
  <tag group="SpecialTab" tag="Specialty"/>

  <!-- Track the ability on the actor -->
  <eval index="1" phase="Setup" priority="5000"><![CDATA[
    perform forward[Specialty.?]
    perform parent.assign[User.HasSpec]
    ]]></eval>
   
  <!-- Each specialty that is allocated by the user costs 2 CP -->
  <eval index="2" phase="Traits" priority="10000">
    <before name="Calc resLeft"/>
    <after name="Bound trtUser"/><![CDATA[
    ~if this speciality wasn't added by the user (as with a Background trait), skip it entirely
    doneif (isuser = 0)

    ~adjust the resource appropriately
    hero.child[resCP].field[resSpent].value += 2
  ]]></eval>
</component>   

<!-- Specialty Helper component
      Each Specialty Gizmo derives from this component
-->

<component
  id="SpecHelp"
  name="Specialty Helper">

  <!-- Selection Tag Expressions -->
  <field
    id="SpecExpr"
    name="Specialization Tag Expression"
    type="derived"
    maxlength="500">
    </field>

  </component>

It all works well enough from the UI, with users able to add and remove specialties, but I'm uncertain as to how to a) bootstrap it from the Thing that is the Command Package or the Race and b) how to add it to the editor so that a user can create a Command Package and pick what Specialties get automatically added.

Duggan October 5th, 2017 05:55 AM

Looks like it's here that explains how to do this, but I can't check until I get home.

Duggan October 5th, 2017 06:17 PM

Hmm... and no, no luck with that. However, I am 90% of the way there. I am currently instead adding a tag to the BGTrait and using the following script to find the relevant Skill and modify it. But I am still figuring out how to actually bootstrap the pick:

Code:

<eval index="2" phase="Setup" priority="3001" name="Add BG Specializations">
  <![CDATA[
  var myId as string
  myId = tagids[Specialty.?," & "]
  debug "myID: " & myId
 
  foreach thing in Specialty where myId
    var indID as string
    indID = eachthing.idstring
    var skillIDs as string
    debug "indID: " & indID
   
    skillIDs = eachthing.tagids[Skill.?, " & "]
    debug "skillIDs: " & skillIDs
    foreach thing in Skill where skillIDs
      debug "Add " & indID & " to skill " & eachthing.idstring
      ~Add a pick for the Specialization to the Skill.
      nexteach
    nexteach
    ]]></eval>


Duggan October 11th, 2017 06:38 PM

And... somewhere between posting that and now, I managed to lose it such that the bootstrap is no longer showing up in the BGTrait. Still plugging away at ways of getting at this.

Duggan October 28th, 2017 05:17 AM

1 Attachment(s)
Coming back to this, I'm all the way up to adding the pick to the Gizmo via the script... and I don't know how to go about it. Here are the Gizmo picks for a skill that has a Specialty:
http://forums.wolflair.com/attachmen...1&d=1509196582

The SpecHelper is something that lets me constrain the choices of which Specialties can be picked for that skill and then there's the Beam specialty. How can I add a new one from a script? Or is that something that is possible?

Duggan November 3rd, 2017 04:27 PM

Following the current pattern, I'd think something like "addChild" to parallel "findChild" but no luck there. If all else fails, I guess I could start by bootstrapping everything and then instead deciding whether to enable it? But, then again, I don't know how that will interact with adding things by tables, plus it seems like that would require adding everything explicitly.

Mathias November 3rd, 2017 09:50 PM

Wait, bootstrapping by script? I'm sorry I didn't notice that earlier to keep you from spending time on that. You cannot use a script to create something that needs to run its own scripts, because HL sets up a list of scripts and the order to run them in before running any of them, so it can't add new scripts to that list later on, so it can't have a pick added by a script.

Mathias November 3rd, 2017 09:52 PM

Forms don't have to show picks within the gizmo - you can press a button on one pick that opens up a list of picks on the hero - like all the specialties. That's how Shadowrun handles it. And then just build a text list of the specialties for that skill for display on that skill.

That way, the advancements for specialties add them to the hero, like everything else, and then the skills figure out what specialties they've got.

Duggan November 4th, 2017 05:22 AM

OK. So no script.

Am I handling it the wrong way above, by making it an entity? That seemed like the only way I could set it up so that the form accessible off of the Skill entry restricted the Specialties to those associated with the skill.

Mathias November 4th, 2017 07:34 AM

If you make it an entity, you cannot use an advancement to add picks within that gizmo, because the displacement used by advancements can only be to the hero, not to a different container.

Duggan November 26th, 2017 11:21 AM

I finally got the opportunity to get back to this, and I am hitting a wall again. Currently Skill Specialties added via the form accessed from the Skill add a pick to the skill, and a tag on the Skill. The Eval statement on Specialty also forwards the tag down so that it reaches the Hero. Similarly, Specialties added via the Background, Command Package, and Sophont items add a tag to the Hero and a pick. Now the catch is, I'm really not certain how to get the two to mesh together.

When all of the Specialties were being pulled from the Skills and their gizmos, the code to display a list of them on the Skill Summary space went like this:
Code:

var skillText as string
foreach pick in hero from Skill
  foreach pick in eachpick.gizmo from Specialty
    ~ debug eachpick.field[spcTabName].text
    skillText = skillText & eachpick.field[spcTabName].text & "{br}"
    nexteach
  nexteach
 
@text = skillText

To instead display the items added from the background traits, it's the following:
Code:

var skillText as string
     
foreach pick in hero from Specialty
  debug "Specialty for summary: " & eachpick.field[spcTabName].text
  skillText = skillText & eachpick.field[spcTabName].text & "{br}"
  nexteach
 
@text = skillText

Yes, I could probably do both and just concatenate the text, but it's maddening that all of the tags are in one place (on the Hero), plus that doesn't fix how to get the form off of the Skill to pull in the items already on the player when deciding what Specialties can be added.

Worse comes to worse, I can go back to the way I was initially doing things where Specialties were picked out of a big table of all of the Specialties, not off of the Skills, which worked well enough, but that's not aesthetically pleasing to say the least.

Duggan November 26th, 2017 03:24 PM

Ah. I found a solution for creating the list of Specialties. Now, to figure out how to build that table up...

Code:

var skillText as string
var specIds as string

specIds = hero.tagids[Specialty.?, " | "]
debug "Hero Specialty tags: " & specIds

foreach thing in Specialty where specIds
  debug "Specialty for summary: " & eachthing.field[spcTabName].text
  skillText = skillText & eachthing.field[spcTabName].text & "{br}"
  nexteach
 
@text = skillText


Duggan November 26th, 2017 03:39 PM

1 Attachment(s)
Quote:

Originally Posted by Mathias (Post 258263)
Forms don't have to show picks within the gizmo - you can press a button on one pick that opens up a list of picks on the hero - like all the specialties. That's how Shadowrun handles it. And then just build a text list of the specialties for that skill for display on that skill.

That way, the advancements for specialties add them to the hero, like everything else, and then the skills figure out what specialties they've got.

I think this is the way I'm probably going to have to do this. Is there any way to be able to add a button to the skills, something like the following, that will allow me to restrict the list to items related to that skill on the hero?

http://forums.wolflair.com/attachmen...1&d=1511743093

And would I be using the "form" action rather than "edit" since it would not be in a gizmo?

Farling November 27th, 2017 12:04 AM

Quote:

Originally Posted by Duggan (Post 259373)
I think this is the way I'm probably going to have to do this. Is there any way to be able to add a button to the skills, something like the following, that will allow me to restrict the list to items related to that skill on the hero?

http://forums.wolflair.com/attachmen...1&d=1511743093

And would I be using the "form" action rather than "edit" since it would not be in a gizmo?

Would something like is done with Pathfinder Knowledge skills useful? They have a "Knowledge (other)" skill where there is some "free text" that appears on the skill line which can be set to anything the user likes.

Duggan November 27th, 2017 02:17 AM

Unfortunately, probably not. That's more like what's done with the Domain of skills, which funnily enough I do use for some Specializations...

Duggan November 27th, 2017 04:49 AM

Quote:

Originally Posted by Mathias (Post 258262)
Wait, bootstrapping by script? I'm sorry I didn't notice that earlier to keep you from spending time on that. You cannot use a script to create something that needs to run its own scripts, because HL sets up a list of scripts and the order to run them in before running any of them, so it can't add new scripts to that list later on, so it can't have a pick added by a script.

Hmm... related to this, I was recently given some third-party content for the game which allows for a choice of Specialization (things like a Law Enforcement Officer Background granting a single Non-Lethal proficiency). Setting up an entry with a drop-down, as I do with the skills, is pretty easy, but then to add it... although maybe I could find a way to hook into the Advance mechanics?

Duggan December 7th, 2017 08:55 AM

Quote:

Originally Posted by Mathias (Post 258278)
If you make it an entity, you cannot use an advancement to add picks within that gizmo, because the displacement used by advancements can only be to the hero, not to a different container.

Coming back to this, I reread the section on displacement and how it can allow a pick on a gizmo to be accessible on the main hero. This sounds very much like something I would like to have. :)

Looking at the code for advancements, it looks like defining the displacement might be as simple as <autotag group="Helper" tag="Displace"/>. I'm guessing something else picks that up.

The wiki mentions a displace element, but I have not located code for that yet. ^_^ But that's leading me down a rabbit hole of wiki entries, so hopefully something will come up there.

In a semi-related side-note, as mentioned above, I'm also trying to figure out a way to implement a choice of Specialization, which would require a way to add an option among various picks. I'm thinking that this might wind up kind of like Advances with a construct for "SpecPick" or something like that that gets attached to the player, and gets locked down after character creation.

Duggan December 8th, 2017 08:48 AM

Bingo! I modified Specialty to include a "<displace target="hero">TRUE</displace>" line and now everything chosen from the Specialty table in the skills shows up! I now see that the tag is used to indicate whether a given item should be displaced. Now, I just need to get the table reached by the button by the skills to realize that it should only display the items the hero doesn't already have...

After that, I plan to build something like an Advance to hold the various bonus abilities from Sophont type, Background, Command Package, etc to allow for things like a choice of Specialization (the code I have works for skills, but that's because it just needs to adjust ranks, not add a pick), which may have the happy side effect of also cleaning up my code a little.


All times are GMT -8. The time now is 05:22 PM.

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