PDA

View Full Version : Adding custom feat metadata to filters



darrenan
December 11th, 2020, 18:00
I'm trying to figure out what the logic is for populating the four filter drop-down controls in the Feats window with custom archetypes and traits. I'm creating a module that will contain new custom feats that have new archetypes and traits, and I would like the players to be able to filter on the archetypes and traits in those new feats. Just creating the feats and then exporting the feats doesn't seem to do the trick by itself.

Trenloe
December 11th, 2020, 18:18
From the data_library_pfrpg2.lua feats record setup:


aCustomFilters = {
["Trait"] = { sField = "traits", fGetValue = getFeatTraitValue },
["Class Level"] = { sField = "level", sType = "number", fGetValue = getFeatLevelValue },
["Feat Level"] = { sField = "level", sType = "number" },
["Archetype"] = { sField = "archetype", sType = "string" },

So the "Archetype" filter just uses the "archetype" string field in the feat record.

"Trait" uses custom code to setup the trait filters - these are set in GameSystem.traitTypeFilter and also have the names of ancestry and class records added at the start of the campaign or when a module is opened/closed. Basically, any custom ancestries or classes manually added won't be in the filter until a campaign restart or a module is loaded (which triggers the trait filter refresh code).

darrenan
December 11th, 2020, 18:27
So here's what the start of my feats section looks like in my module's client.xml after exporting:



<feat>
<category name="Zeitgeist Player's Guide" baseicon="0" decalicon="0">
<id-00001>
<effectsbenefits type="formattedtext">
<p>You gain negative resistance equal to half your level (minimum 1) and you gain a +1 circumstance bonus to saves against death, fear and negative effects.</p>
</effectsbenefits>
<level type="number">1</level>
<level_applied type="number">0</level_applied>
<locked type="number">0</locked>
<name type="string">Deathless Calm</name>
<shortbenefits type="string">Negative resistance and bonus to saves</shortbenefits>
<special type="formattedtext">
<p></p>
</special>
<traits type="string">DEVA</traits>
</id-00001>


This particular feat is not an archetype, so just considering traits for this example. When I start up the campaign that has this module open, I do not see Deva (or DEVA, not sure which is correct) show up in the drop down list of traits.

darrenan
December 11th, 2020, 18:32
Does my module need to actually modify GameSystem.traitTypeFilter? I didn't think modules could execute scripts.

darrenan
December 11th, 2020, 18:36
More info, in this case Deva is a heritage only, it is not an ancestry. So there isn't a corresponding entry under <race> or <reference.races>. That's probably the issue? Let me try creating a new race and see if that fixes things.

Trenloe
December 11th, 2020, 18:38
The ruleset is specifically coded *not* to display every single possible trait in the trait filter, this would take forever and no one would use it because the list would be too long.

Trenloe
December 11th, 2020, 18:46
More info, in this case Deva is a heritage only, it is not an ancestry. So there isn't a corresponding entry under <race> or <reference.races>. That's probably the issue? Let me try creating a new race and see if that fixes things.
Most feats in standard PF2 don't have a heritage name as a trait, unless it's a versatile heritage. Versatile heritages have to be added to GameSystem.traitTypeFilter which can only be done through code - i.e. an extension.

darrenan
December 11th, 2020, 18:54
It is a versatile heritage which probably doesn't merit an extension for just that little bit of functionality.
Filling in the archetype field for all the archetype feats was what was missing there, so problems (mostly) solved. Thanks.