View Single Post
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old April 1st, 2013, 10:02 AM
The first step in setting up a gizmo is to write the <entity>. Here's an example from Shadowrun:
Code:
 
<!-- An entity for the Possession adjustment -->
<entity
  id="adjPossess"
  form="poCustPoss">
  <bootstrap thing="PossHelper"/>
  </entity>
Here's the wiki page that gives more detail about the <entity> elements:
http://hlkitwiki.wolflair.com/index....Element_(Data)

Entities are placed in .str or .core files (wherever you're placing the component that will use them). They go after all the <component> and <compset> elements in that file, so they're usually going to be the very last thing in that file.

The next step is to add that entity you've just defined to a thing:

Code:
<child entity="adjPossess">
  <bootstrap thing="attrFor">
    <autotag group="Helper" tag="UserSpec"/>
    <autotag group="AttrSpec" tag="FreeFloat"/>
    </bootstrap>
  <bootstrap thing="resSpirPow"/>
  <bootstrap thing="cpImmNWeap"/>
  </child>
Note that you can add more bootstraps here, in addition to any you added to the <entity>. For example, in Shadowrun, almost all gear needs a selector for the user to decide whether that device has been built with wireless capability, so the pick that offers that choice is bootstrapped on the <entity>, but a particular weapon may have an integral mod - only this weapon has it, not every weapon, so only the <child> on that weapon gets that bootstrap. But, every weapon in Shadowrun still uses the same <entity>.

Here's the wiki page for the <thing> element, in case you want to look up the exact details of adding a <child> element to a <thing> element:
http://hlkitwiki.wolflair.com/index.php5/Thing_Element_(Data)

Since it's normal for everything in a compset to use the same entity, here's an example of an editor entry that offers a checkbox - if the user checks that box in the editor, that <child> will be added:


Code:
<inputthing
  name="Allows Modifications"
  helptext="Check this if this gear can be modified (unchecking this is rare)">
  <it_entitycheck entity="grCustom" default="yes" />
  </inputthing>
Note that in that case, default="yes" has been set, so that when the user creates a new item in the editor, that checkbox will start off checked.

If you don't even want to offer the editor user a choice of whether they're going to add a particular child, set that at the top:


Code:
<editthing
  compset="Melee"
  name="Weapon: Melee"
  prefix="wp"
  defchild="grCustWeap"
  description="Armor, vehicles, and simple equipment all have their own tabs for creating objects of those types."
  summary="Defines a melee weapon that can be selected on the Armory tab.">
With a defchild="" set, every new thing created on that editor tab will have that child.

If you have set a defchild="", you can use the target="child" option on tag and bootstrap options to set up bootstraps that will be within the gizmo, as opposed to normal bootstraps that will go inside the same container as the pick itself, or tags that are assigned to the gizmo (the container)(setting up tags in the gizmo is useful for prereqs, the same way setting up hero tags is useful for prereqs for things in the hero container):

Code:
 
<inputthing
  name="Armor Specials"
  helptext="Specify any special notes about this armor.">
  <it_taglist group="ArmorNote" tag="?" target="child"/>
  </inputthing>
<inputthing
  name="Integral Mods"
  helptext="Choose any integral mods this armor always comes with.">
  <it_bootcustom compset="Mods" target="child">
    <match><![CDATA[
      ModCat.Armor & !thing.showonly
      ]]></match>
    <inputthing
      name="Fixed Rating?"
      helptext="If this gear uses ratings, specify the minimum rating it can be set to.">
      <it_tagcheck group="Equipment" tag="FixRating"/>
      </inputthing>
    <inputthing
      name="Rating"
      helptext="If this gear is only available at a single rating, specify that here.">
      <it_field field="grUser"/>
      </inputthing>
    </it_bootcustom>
  </inputthing>
P.S. if you've already added some of these things using the editor, and you're now adding it_entitycheck or defchild, remember that you'll still need to go back to the things of that compset that you've already created, and add the correct <child> elements to them. defchild="" will only work on new items created in the editor - it won't automatically find all the existing things in that compset and add that <child> to them.
Mathias is offline   #2 Reply With Quote