PDA

View Full Version : Where does the NPC field "Saving Throw" hook into? (5e)



jonesdaadi
February 16th, 2023, 15:05
I created a custom saving throw in 5e. I have managed to make it show on the character sheet, the NPC sheet, the Party sheet and it is working in relation to modifiers and effects for advantage and disadvantage. I have proficiency working on the PC sheet, but for the NPCs I am having trouble.

In the field "Saving Throws" on the NPC sheet, I am not understanding where those values are parsed. I cant seem to figure out how these values trigger the bonus to normal saves, so I'm not sure how to make it find my custom save.

Any ideas where this data is?

Moon Wizard
February 16th, 2023, 20:26
In 5E, the parsing of saving throws is explicitly tied to the list of ability scores, as that is how the base 5E rules work. The parsing of NPC saving throw actions is done in a function called ActorManager5E.getSave(ActorVar, SaveName).

Regards,
JPG

jonesdaadi
February 16th, 2023, 21:40
Thanks moon wizard for the hints. I am still not figuring out how to get a modifier added to my custom save on NPCs. All other aspects of this custom save seem to be working fine. I added the ability to the data_common.lua like so:
abilities = {
"strength",
"dexterity",
"constitution",
"intelligence",
"wisdom",
"charisma",
"armor",
};

ability_ltos = {
["strength"] = "STR",
["dexterity"] = "DEX",
["constitution"] = "CON",
["intelligence"] = "INT",
["wisdom"] = "WIS",
["charisma"] = "CHA",
["armor"] = "ARM",
};

ability_stol = {
["STR"] = "strength",
["DEX"] = "dexterity",
["CON"] = "constitution",
["INT"] = "intelligence",
["WIS"] = "wisdom",
["CHA"] = "charisma",
["ARM"] = "armor",
};

psabilitydata = {
Interface.getString("strength"),
Interface.getString("dexterity"),
Interface.getString("constitution"),
Interface.getString("intelligence"),
Interface.getString("wisdom"),
Interface.getString("charisma"),
Interface.getString("armor"),
};

and then added this armor save to the PC and NPC sheet. and if i create an effect in the combat tracker like this:

SAVE: 4 armor
That works fine, as does advantage and disadvantage. But when i try something like Arm +4 in the NPC saving throw field, i do not get that bonus. I cant seem to understand what i am missing. Any other hints?

Moon Wizard
February 17th, 2023, 04:13
How are you rolling the check?

As far as I know, when you click the (S) button next to the ability field in the NPC record, the following call logic is followed to get to that point:
button_npcabilitysave:onButtonPress
button_npcabilitysave:action
ActionSave.performRoll
ActionSave.getRoll
ActorManager5E.getSave

The last function is the one that calculates and returns the numerical value assigned to the roll, and the default just does an expression match to the short/long version of an ability in DataCommon and returns the number if it finds a match.

If that's not working, I suggest unzipping a copy of CoreRPG and 5E so that you can inject Debug.chat calls into the various scripts to see where things might not be working for you.
(i.e. Debug.chat("TEST ABILITY VAR", sAbility, DataCommon.ability_stol[sAbility:upper()], DataCommon.ability_ltos[sAbility:lower()]); )

If you're clicking elsewhere, you'll need to follow the logic for the control that is clicked to see what it is calling. You can use "/debug on" command in command line to review the names of windows/controls you are hovering over.

Make sure to use a good multi-file search text editor (like Sublime Test or Notepad++).

Regards,
JPG

jonesdaadi
February 18th, 2023, 13:00
Thanks Moon wizard, I got it working perfect now. It was simpler than I was making it. I just needed to push those new abilities to the datacommon package.


DataCommon.abilities = abilities;
DataCommon.ability_ltos = ability_ltos;
DataCommon.ability_stol = ability_stol;

Once I did that, it started working. And to answer your question, in case this information is helpful to someone else; Yes I am making the save from the little "S" next to the ability.