PDA

View Full Version : Adding Resistance Values to a modified DnD 5.0



Gestosad
February 12th, 2019, 22:42
Hey, so as the title says I am currently trying my hand at modifying the resistance of DnD 5.0 for the system I am building, I need several layers rather than the flat 50% reduction

I think I might be drawing close to having figured out all the things required to add more fields, but then it hit me - when I am creating NPCs within the program itself, as I am using the DnD 5.0 as a base, the tab only shows ''Resistance'', would anyone be so incredibly kind as to guide me in the right direction to what/how i should do here?

I am familiar with the concept of changing the .XML files, have done it for icons and the like, I'm thinking maybe I have to find where the NPC sheet is generated from and add in several more values, but then I'm not certain if the roll-automation in game will pick my new resistances up (as in if there is a different file then just manager_action_damage.lua which comes into play)

Or possibly making the Resistances a drop down menu? tho I would have no idea how to do that, I'm sure I could experiment my way with slicing and dicing XML code together from other similar libraries

Been at this for a few hours now and hoping someone has any advice

LordEntrails
February 12th, 2019, 22:59
I don't know :) But I do know that 3.x/PF has a value for Resistance (i.e. Fire 10). So I would take a look at both how its handled on the character sheet and in the code. See if that gets you where you want to go :)

LordEntrails
February 12th, 2019, 23:00
Oh, I think Celestian's AD&D ruleset which is based off of the 5E ruleset also does it, so you could look there too.
www.fantasygrounds.com/forums/showthread.php?37777-Project-AD-amp-D-Core-Ruleset

Trenloe
February 12th, 2019, 23:04
The first step is you need to decide how you're going to represent the base custom resistance data - for NPCs and for PCs. As you say, you may need a few fields - or you may just need one and change the format of how the resistance data is stored. e.g. Resistance fire 25% or Resistance fire 70% etc.. You need to make these decisions now to minimise wasted work.

Keeping in mind that the way resistance works is that when a NPC is added to the combat tracker, the resistance data is parsed and a RESIST effect added to the CT - it is this effect that is used by the damage action manager. See 5E effect modifiers here: https://www.fantasygrounds.com/wiki/index.php/5E_Effects#Modifiers

Then, depending on what you decide, you will have to add the fields to the NPC sheet, then write the code to parse out any effects when the NPC is added to the CT, and then change the damage action manager to read the effect/s and take the relevant action.

Not knowing exactly how the custom layered resistance works, I can't make much of a detailed recommendation. Except - keep it as simple as possible. If you can stick without adding new fields to the NPC record, great. If you can modify the current RESIST effect slightly to make it do what you want, fantastic. This will minimise the amount of code you need to write and also, very importantly, will reduce the amount of re-coding you need to do when there is an update to the 5E ruleset. Every time the 5E ruleset is updated you will need to check that your custom code (created as an extension, not directly modifying the 5E ruleset) is compatible with the updated 5E ruleset and update as necessary - otherwise you will soon be stuck with a custom ruleset based on an old 5E version and might miss out on bugfixes and new functionality.

Yes, it's a lot of work. But if you want to automate custom functionality, this is what you'll have to do.

Good luck! :)

damned
February 12th, 2019, 23:08
Hey, so as the title says I am currently trying my hand at modifying the resistance of DnD 5.0 for the system I am building, I need several layers rather than the flat 50% reduction

I think I might be drawing close to having figured out all the things required to add more fields, but then it hit me - when I am creating NPCs within the program itself, as I am using the DnD 5.0 as a base, the tab only shows ''Resistance'', would anyone be so incredibly kind as to guide me in the right direction to what/how i should do here?

I am familiar with the concept of changing the .XML files, have done it for icons and the like, I'm thinking maybe I have to find where the NPC sheet is generated from and add in several more values, but then I'm not certain if the roll-automation in game will pick my new resistances up (as in if there is a different file then just manager_action_damage.lua which comes into play)

Or possibly making the Resistances a drop down menu? tho I would have no idea how to do that, I'm sure I could experiment my way with slicing and dicing XML code together from other similar libraries

Been at this for a few hours now and hoping someone has any advice

Its going to take you more than "a few hours" to make changes like this.
You need to find everywhere that these are referenced, XML and Lua and work out how they interact, how they are populated, how they are read.
Its trivial for a human brain to convert "Partial Resistance", "Resistance" and "Immunity" to 25%, 50% and 100% on the fly, and then to add in another layer or three.
A computer needs to be programmed to know all of this stuff, when to apply, where to apply it, how to apply it, how to display it etc

You are going to have to really dive into the code and spend hours just learning what the existing code does and how it references various files/sources to do something.

Here are some videos on Fantasy Grounds coding. https://www.youtube.com/watch?v=R_CulFJYs-M&list=PLsgd1zJLdiKVbJg6KJv668LyJXmfk25Yv
None of them cover what you want to do but they will give you a better understanding of how to approach and how to find things.