PDA

View Full Version : Can Library Objects be Renamed in an Extension?



kronovan
May 19th, 2020, 17:49
I'll start by saying I've only ever created simple FGC extensions for the Savage Worlds ruleset. I've been adapting the Adventure in Middle Earth setting for D&D5e, so that I can run a campaign for my kids. The challenge with that setting is that Races are called "Cultures" and Feats are called "Virtues". While I can make it work with the existing names of Races and Feats in the Library, it'd be much preferable if they were changed, as some of what I'm adding makes reference to them - i.e. Human cultures that have a feature named "Starting Virtue" which grants a free Cultural Virtue.

I'm not sure how modifiable the D&D 5e ruleset is and have these questions...

I see a 5E.PAK file in the \rulesets folder, is that the D&D 5e ruleset?
If so, do I just extract its contents into it's own \rulesets\5E\ folder as I did for the SavageWorlds.PAK?
Does anyone know which XML file controls the naming of the "Races" and "Feats" for the Library, and which controls those names on the Player Character sheet?
Does any LUA code need to be changed to support this?
Is there other locations in the ruleset where I'd need to change those names as well?

Any answers to those questions would be much appreciated.

Talyn
May 19th, 2020, 18:57
Yes, extract the 5E.pak into a folder.

Sounds like all you need to do is write a very short extension that would replace a few strings. See the /strings/strings_5e.xml file. Search for whatever you need such as "race" or "feat" and see the string elements that are used in various places within the ruleset. Simply change those to the strings you need.

Trenloe
May 19th, 2020, 19:07
I'd recommend you do as Talyn mentions - just replace the strings.

If you look to rename the underlying database nodes then you'll need to go through all of the ruleset to see where the previous named entries might be used. In theory, as top level object, this wouldn't be much - but you'd still need to do that. And then you'd have to work out how to do that in an extension - because you don't want to keep using a modified ruleset, otherwise you'll not get future updates.

kronovan
May 19th, 2020, 22:20
Many thanks for the info. Yes I had hoped it would be as simple as changing a top-level string and my hopes are that I can create an extension that's loaded each time with the campaign.

I find these 2 string assignments in the strings_5e.xml file:

<string name="library_recordtype_label_feat">Feats</string>
<string name="library_recordtype_label_race">Races</string>

I also find these 2 strings and wonder if I should be concerned about them.

<string name="library_recordtype_empty_feat">« New Feat »</string>
<string name="library_recordtype_empty_race">« New Race »</string>

For the SavageWorlds ruleset, I removed the defaults strings and assigned my own for the Arcane Backgrounds drop-down menu, which was something similar. For that I needed to unregister the defaults and then reassign my own via a function call. It wasn't hard to find the LUA script that contained the correct function and a forum member gave me the syntax for calling it.

I'm having a hard time finding something equivalent for the 5e ruleset. I've browsed the data_library_5E.LUA script and I see this OnInit function:


function onInit()
LibraryData.setCustomFilterHandler("item_isidentified", getItemIsIdentified);
for kDefSidebar,vDefSidebar in pairs(aDefaultSidebarState) do
DesktopManager.setDefaultSidebarState(kDefSidebar, vDefSidebar);
end
for kRecordType,vRecordType in pairs(aRecordOverrides) do
LibraryData.overrideRecordTypeInfo(kRecordType, vRecordType);
end
for kRecordType,vRecordListViews in pairs(aListViews) do
for kListView, vListView in pairs(vRecordListViews) do
LibraryData.setListView(kRecordType, kListView, vListView);
end
end
LibraryData.setRecordTypeInfo("vehicle", nil);
end

But I don't know if anything there is of use to me? Otherwise I don't see any other LUA script in the main \Scripts folder that would involve the Library objects. I do see these entries in a lengthy chunk of code in data_library_5E.LUA which overides the CoreRPG records:


["feat"] = {
bExport = true,
aDataMap = { "feat", "reference.featdata" },
aDisplayIcon = { "button_feats", "button_feats_down" },
sRecordDisplayClass = "reference_feat",
},

and


["race"] = {
bExport = true,
aDataMap = { "race", "reference.racedata" },
aDisplayIcon = { "button_races", "button_races_down" },
sRecordDisplayClass = "reference_race",
},

Once again a fine puzzle to puzzle through. ;) If anyone has any suggestions I'm keen to hear about them.

Talyn
May 19th, 2020, 23:00
That's why I suggested simply changing the string. Nothing more. That way "Race" will be "Culture" and whatever other purely textual alterations the Middle Earth thing changes, but your data won't break...

I'm not seeing a need for any Lua whatsoever for this. Yes, adding/removing Arcane Backgrounds in Savage Worlds requires (for now) some Lua scripting but all you've mentioned in your original post was changing text.

kronovan
May 20th, 2020, 00:15
That's why I suggested simply changing the string. Nothing more. That way "Race" will be "Culture" and whatever other purely textual alterations the Middle Earth thing changes, but your data won't break...

I'm not seeing a need for any Lua whatsoever for this. Yes, adding/removing Arcane Backgrounds in Savage Worlds requires (for now) some Lua scripting but all you've mentioned in your original post was changing text.

Yes, I seemed to have done a brain fart above and over-complicated something that's simple. I've now created a simple Extension.xml that has a single include statement for my custom replacement_strings.xml file. That custom XML file just contains the 4 library master index strings of:

<string name="library_recordtype_label_feat">Virtues</string>
<string name="library_recordtype_empty_feat">« New Virtue »</string>
<string name="library_recordtype_label_race">Cultures</string>
<string name="library_recordtype_empty_race">« New Culture »</string>

It works perfect with both objects correctly renamed in the Library and a new object appearing as <<New Virtue>> and <<New Culture>>. The entries of course are still Feats and Races on the PC sheet, but I'm thinking I just need to find those string settings and also include them in my custom strings file.

[Edit] OK so I added the strings from Character Main, Character Abilities and the Party Sheet and all appears to be working fine with correct labeling.