PDA

View Full Version : Data Library of Traits



pr6i6e6st
June 26th, 2020, 22:36
Hey guys. i'm looking at the data_library_5E.lua and wondering if i can have a record library for NPC traits/actions/legendary actions/lair actions and such, building them as a ref_ability class for easy drag-and-drop build.

how do i go about extending the parameters to search into each NPC and pull out their actions and such?
Edit:
I can see from my NPC merger extension that getting the database node of my dragdata from an npc shortcut that it returns something like “reference.npcdata.knight@MM_wotc” or whatever. But when looking for any children of “reference.npcdata”, I only get “.npcbyletter”, “.npcbycr”, and “.npcbytype”.

What am I missing? How do I go about creating a data library function that creates a record library of all existing npc traits/actions/reactions/innate spells/lair actions/legendary actions?



["ref_ability"] = {
aDataMap = { "npc.getChildren().actions", "reference.npcdata" },
aGMListButtons = { "button_npc_letter", "button_npc_cr", "button_npc_type" };
aCustomFilters = {
["CR"] = { sField = "cr", sType = "number", fSort = sortNPCCRValues },
["Type"] = { sField = "type", fGetValue = getNPCTypeValue },
},
},


the following code gives me a list of ref_abilities with the npc's detail text on the second tab. so that tells me i'm close? but that's definitely not what i'm looking for.


["ref_ability"] = {
aDataMap = { "npc.actions", "reference.npcdata" },
aGMListButtons = { "button_npc_letter", "button_npc_cr", "button_npc_type" };
aCustomFilters = {
["CR"] = { sField = "cr", sType = "number", fSort = sortNPCCRValues },
["Type"] = { sField = "type", fGetValue = getNPCTypeValue },
},
},

Moon Wizard
June 27th, 2020, 09:26
The campaign record lists are not designed to be used in that way; so I would expect that you will have issues. The campaign record types defined in LibraryData scripts are made to have a one or more paths to have an entire record; not as a way to index subrecords of other campaign records. (i.e. no overlapping paths with other record types)

If you wanted to create a new record type for NPC abilities to be full-fledged records that you could build out and use as drag and drop for NPC building, then you should pick a unique database path for them that does not overlap with existing record paths. Then, you would need to define any other custom buttons/filters related to NPC abilities. You won't be able to use the existing NPC filters or buttons, because they are specifically built for NPC full record formats.

Example:


["npcability"] = {
aDataMap = { "npcability", "reference.npcabilities" },
};


Regards,
JPG

pr6i6e6st
June 27th, 2020, 23:44
The campaign record lists are not designed to be used in that way; so I would expect that you will have issues. The campaign record types defined in LibraryData scripts are made to have a one or more paths to have an entire record; not as a way to index subrecords of other campaign records. (i.e. no overlapping paths with other record types)

If you wanted to create a new record type for NPC abilities to be full-fledged records that you could build out and use as drag and drop for NPC building, then you should pick a unique database path for them that does not overlap with existing record paths. Then, you would need to define any other custom buttons/filters related to NPC abilities. You won't be able to use the existing NPC filters or buttons, because they are specifically built for NPC full record formats.

Example:


["npcability"] = {
aDataMap = { "npcability", "reference.npcabilities" },
};


Regards,
JPG

alright. so failing that then, what about this?

what if i were to create a window like the party sheet, and got a list of npc traits/actions etc. etc. to display in that window, then allow me to drag-and-drop the text from that?

am i going to run into the same problem as the library idea? or can i use something similar to the buildPartyInventory() function in the manager_ps_loot.lua of CoreRPG?

edit:
alternatively, is there a way that i could make it so a user could type in the monster they are looking for, and populate a list with their actions/traits/reactions yadda yadda that way?

edit2: it actually looks like that last option is indeed possible. awesome.