Log in

View Full Version : [Tutorial] Adding damage types to 3.5e/PF1



Kelrugem
April 29th, 2021, 01:14
Forge link: https://forge.fantasygrounds.com/shop/items/46/view

Hi :)

I have seen the question about adding custom damage types here and there, and I also provided the following information as an answer in some thread. But I thought I may make a separate thread with a dummy extension for custom damage types such that you can add your own damage types to your game (well, at least I know of Dellanx who is doing that ;) ).

Download the dummy extension, rename .ext to .zip, unzip it, and go to /scripts/data_common2.lua. Then you see the following:


function onInit()
table.insert(DataCommon.dmgtypes, "ballistic");
table.insert(DataCommon.dmgtypes, "laser");
table.insert(DataCommon.dmgtypes, "electric");
table.insert(DataCommon.dmgtypes, "radiation");
end

You now probably see the structure; the four damage types were once requested on discord and I kept them in this extension as example, you can simply replace them and/or add additional lines with the same structure. Just replace the damage type of that new line then :) Then zip the extension again (inside its first layer of folder), then rename to .ext.

If you want to do some more extensive things, then you can add the damage types also to other groups than dmgtypes; I will now provide some list of groups of damage types, simply replace DataCommon.dmgtypes with any other group you want to use. For example group B, then you use table.insert(DataCommon.B, "blah") :) You can also add a damage type to more than one group if you want several properties provided by the groups :)

(parsing here is often about the parsing of NPC effects)

dmgtypes := All damage types should be added here if they should be recognized as damage type in damage die strings and damage actions, also used in many parsing stuff: DR, REGEN, IMMUNE, and spell damage actions (not for RESIST and VULN, for this you need to add it to energytypes)
energytypes := These are the damage types overcoming DR, also used for parsing RESIST and VULN effects for NPCs (that damage type will also be listed/used in the hardness parsing); the automatic parsing of such effects would otherwise ignore such damage types when not listed there.
immunetypes := (Mainly) for the automatic parsing of IMMUNE effects. Add it there when you want that the automatic parser recognizes that damage type for IMMUNE effects. Especially for informational effects of immunities against stuff which should not be recognized as damage type like charm (dmgtypes already covers this parsing for actual damage types)
basicdmgtypes := There you should only list damage types if they are fluid. A weapon with slashing and piercing damage type can overcome stuff like IMMUNE: slashing effects for example, because the weapon is then assumed to be piercing. In order to be immune against a basic damage type, one needs to be immune against all incoming basic damage types. When you do not need such a behaviour, then do not add your damage type to this group. (Similar argument for (H)RESIST and FORTIF if you use my overlay extension)
specialdmgtypes := These are damage types with certain special properties, the native ones are nonlethal, spell, critical, and precision. They have some special code (which then needs to be added to the scripts), but all of them have in common that they are added to existing damage types (for this you just need to add the damage type to this group). That means that e.g. DMGTYPE: precision and DMG: d6 precision will also use existing damage types of the damage roll (the d6 will then not only have precision as damage type, while for example DMG: d6 fire would be only fire damage). Also used for the parsing of IMMUNE effects

So, just use the extension as a template and add table.insert(DataCommon.[any of these lists], "[your damage type]"); in the function onInit() :)

If I have some information missing or some error, then please let me know :) (I wrote that list actually some time ago, https://www.fantasygrounds.com/forums/showthread.php?60798-Add-more-damage-types&p=533866&viewfull=1#post533866, I didn't check it again in the code :D I now just provide the dummy extension for an easier use :) )

Best wishes,

Kelrugem

PS: I wrote this extension in such a way that it should be very compatible with everything, as long as the damage type structure itself does not change :)

PPS: I should finally maybe extend the NPC parser, including SIMMUNE and stuff like that :D

New creature types:

If you want to have a new creature type, then use



table.insert(DataCommon.creaturetype, "new type");


(replace new type with your custom types)

You can also use creaturesubtype instead of creaturetype, but that is just for sorting purposes, the automation is the same https://www.fantasygrounds.com/forums/images/smilies/smile.png

dellanx
April 29th, 2021, 02:58
Hi :)

I have seen the question about adding custom damage types here and there, and I also provided the following information as an answer in some thread. But I thought I may make a separate thread with a dummy extension for custom damage types such that you can add your own damage types to your game (well, at least I know of Dellanx who is doing that ;) ).

Download the dummy extension, rename .ext to .zip, unzip it, and go to /scripts/data_common2.lua. Then you see the following:


function onInit()
table.insert(DataCommon.dmgtypes, "ballistic");
table.insert(DataCommon.dmgtypes, "laser");
table.insert(DataCommon.dmgtypes, "electric");
table.insert(DataCommon.dmgtypes, "radiation");
end

You now probably see the structure; the four damage types were once requested on discord and I kept them in this extension as example, you can simply replace them and/or add additional lines with the same structure. Just replace the damage type of that new line then :) Then zip the extension again (inside its first layer of folder), then rename to .ext.

If you want to do some more extensive things, then you can add the damage types also to other groups than dmgtypes; I will now provide some list of groups of damage types, simply replace DataCommon.dmgtypes with any other group you want to use. For example group B, then you use table.insert(DataCommon.B, "blah") :) You can also add a damage type to more than one group if you want several properties provided by the groups :)

(parsing here is often about the parsing of NPC effects)

dmgtypes := All damage types should be added here if they should be recognized as damage type in damage die strings and damage actions, also used in many parsing stuff: DR, REGEN, IMMUNE, and spell damage actions (not for RESIST and VULN, for this you need to add it to energytypes)
energytypes := These are the damage types overvoming DR, also used for parsing RESIST and VULN effects for NPCs (that damage type will also be listed/used in the hardness parsing); the automatic parsing of such effects would otherwise ignore such damage types when not listed there.
immunetypes := (Mainly) for the automatic parsing of IMMUNE effects. Add it there when you want that the automatic parser recognizes that damage type for IMMUNE effects. Especially for informational effects of immunities against stuff which should not be recognized as damage type like charm (dmgtypes already covers this parsing for actual damage types)
basicdmgtypes := There you should only list damage types if they are fluid. A weapon with slashing and piercing damage type can overcome stuff like IMMUNE: slashing effects for example, because the weapon is then assumed to be piercing. In order to be immune against a basic damage type, one needs to be immune against all incoming basic damage types. When you do not need such a behaviour, then do not add your damage type to this group. (Similar argument for (H)RESIST and FORTIF if you use my overlay extension)
specialdmgtypes := These are damage types with certain special properties, the native ones are nonlethal, spell, critical, and precision. They have some special code (which then needs to be added to the scripts), but all of them have in common that they are added to existing damage types (for this you just need to add the damage type to this group). That means that e.g. DMGTYPE: precision and DMG: d6 precision will also use existing damage types of the damage roll (the d6 will then not only have precision as damage type, while for example DMG: d6 fire would be only fire damage). Also used for the parsing of IMMUNE effects

So, just use the extension as a template and add table.insert(DataCommon.[any of these lists], "[your damage type]"); in the function onInit() :)

If I have some information missing or some error, then please let me know :) (I wrote that list actually some time ago, https://www.fantasygrounds.com/forums/showthread.php?60798-Add-more-damage-types&p=533866&viewfull=1#post533866, I didn't check it again in the code :D I now just provide the dummy extension for an easier use :) )

Best wishes,

Kelrugem

PS: I wrote this extension in such a way that it should be very compatible with everything, as long as the damage type structure itself does not change :)

PPS: I should finally maybe extend the NPC parser, including SIMMUNE and stuff like that :D

Thank you, I am not sure if custom creature types work.


table.insert(DataCommon.creaturesubtype, "mythic");

Kelrugem
April 29th, 2021, 12:47
Thank you, I am not sure if custom creature types work.

Yeah, should work, too :) Maybe I should extend the tutorial a bit how to do that, too; but you seemingly got already the idea and where to take the group names from :D

dellanx
April 29th, 2021, 21:48
Yeah, should work, too :) Maybe I should extend the tutorial a bit how to do that, too; but you seemingly got already the idea and where to take the group names from :D

I think I am figuring it out. Thank you!

Kelrugem
April 29th, 2021, 21:54
I think I am figuring it out.

p.s. what is the best way to add "ghost touch"?

ghost touch is already a damage type in my extension (for PF1) :) So, you already have that :)

Kelrugem
May 23rd, 2021, 16:07
I've added information about adding custom NPC types at the bottom of the first post, too :)

Kelrugem
July 20th, 2021, 00:03
Also this tutorial extension is now on the forge, see the link in the first post :) But: Only download it if you do not already use it to avoid that the forge overwrites your version :) The forge is then just for new users :) (or rename your file, but there is actually no reason that you need to download it again from the forge)

Morenu
March 15th, 2022, 17:30
EDIT * - Got it working (original post at the bottom)

I am trying to fully automate Ancestral Grudge (+1 attack against Elf and dwarf but not drow)... using PF1e

Wording:
[The enmity between the drow and elves and dwarves is long-standing and deeply entrenched. Drow with this racial trait gain a +1 bonus on attack rolls against humanoids with the dwarf or elf subtypes (with the exception of drow) because of their special training against these reviled foes.

This racial trait replaces poison use.]

To get this to work, I had the DM download this extension and add Drow to the ext file (directions are in forge and in the first post)

table.insert(DataCommon.creaturetype, "drow");

AND all drow NPCs would need drow AND elf listed in their type field, Its seems many do already (for characters I changed race to drow (elf) )

then I add these 2 lines in my combat tab as permanent effects

IFT: TYPE(dwarf,elf); ATK: 1
IFT: TYPE(drow); ATK: -1

so if drow is listed under type as well as elf, it cancels out the elf +1 bonus

Original question:
I did 2 if tags, 1 to add ATK 1 for elf or dwarf type and another to add ATK -1 for drow for a net zero on +1 elf -1 drow... did not work, is this possible with current commands?

IFT: TYPE(dwarf,elf); ATK: 1 (this works fine)

Tried both of these,. did not work

IFT: SUBTYPE(drow); ATK: -1 (this does a -1 to everything - tested orc, the attached drow, an elf character, a drow character defined as drow (elf) ) I assume SUBTYPE is not a command so it is applying the ATK-1 to everything due to the semicolon.

IFT: TYPE(drow); ATK: -1 (This does not work at all on either of the drow above)

52002

Moon Wizard
March 15th, 2022, 17:58
A few points to consider:

* SUBTYPE is not a valid operator; the 3.5E ruleset only supports ALIGN/SIZE/TYPE/CUSTOM. The TYPE operator will also check some subtypes.

* "drow" is not a valid creature type; nor one of the default creature subtypes in the creature manual. The valid types/subtypes are built into the ruleset; and would need to be changed via a mod.

* From the 3.5E SRD, the drow warrior is "Medium Humanoid (elf)". For the Pathfinder SRD, the drow is "CE Medium Humanoid (elf)".

The base ruleset and modules are not designed nor have the data to differentiate drow vs. any other elf. You're probably best off just fixing at the table when you need to.

Regards,
JPG

Morenu
March 15th, 2022, 18:58
Thx, I can have it check elf, dwarf and have a remove button to turn it off for drow OR make the dwarf, elf check permanent under the combat tab and make an on off for a -1 attack if I encounter drow.

Morenu
March 15th, 2022, 21:59
Edit... nope I was wrong DMGTYPE can't be check :(

original post below. (and is all wrong)

Hmm, so I added ws dmgtype to the extension so I can add [ws] to the damage type of a weapon I am specialized in and it will add the weapon specialization damage automatically. NICE

table.insert(DataCommon.dmgtypes, "ws");

added this to my combat tab:

WS; IFT: DMGTYPE(ws); DMG: 2
(the WS; lets me know it is for weapon specialization)

and then add ws to the damage box of the specialized weapon

same could be done for weapon focus, greater weapon specialization and so on.

Morenu
April 17th, 2022, 22:27
I am trying to figure out an automated way to apply added attack & damage to a weapon If the creature being attacked is Chaotic evil, but not add that damage to any other weapons the character is using against said Chaotic Evil creature. So I wanted to add a unique tag (CEBANE) to the weapon, then use something like this so it will only apply to a weapon with that tag. is this possible?

IFTAG: (CEBANE); IFT: ALIGN(Chaotic Evil); ATK: 2; DMG: 2

the fighter has a bludgeoning weapon and this magic greatsword. right now I can get the CE bonus to work but it adds the bonus to all weapons not just the greatsword.

Asgurgolas
April 18th, 2022, 01:10
I am trying to figure out an automated way to apply added attack & damage to a weapon If the creature being attacked is Chaotic evil, but not add that damage to any other weapons the character is using against said Chaotic Evil creature. So I wanted to add a unique tag (CEBANE) to the weapon, then use something like this so it will only apply to a weapon with that tag. is this possible?

IFTAG: (CEBANE); IFT: ALIGN(Chaotic Evil); ATK: 2; DMG: 2

the fighter has a bludgeoning weapon and this magic greatsword. right now I can get the CE bonus to work but it adds the bonus to all weapons not just the greatsword.

You cannot do that normally, but there's an extension for that (of which I forgot the name... advanced effects maybe?), where you can apply an effect on a weapon so it only triggers when you use said weapon

Morenu
April 18th, 2022, 02:27
Yes, that worked

WF & WS;ATK:1;DMG:2 (action only)

Only issue is each weapon adds this effect (2 weapon fighter and also a gloom blade option so 3 weapons with effects for each 1) which is a lot in the effect section of the CT. And if I ever hand off the weapon, I must remember to remove the effect.

I instead decided it was cleaner to go to the action tab and click the magnifying glass for each weapon and add +1 to each of the 4 attack modifiers and added 2 to the bonus damage. Then I added WF and WS to the weapon name so I remember why they are there. Bonuses work, labeled so I know why, less combat tracker effect lines and it doesn’t change the base weapon. Oh and when my bab increases I do not need to mess with anything and my character sheet bonuses are correct

Kelrugem
April 18th, 2022, 02:43
Yes, that worked

WF & WS;ATK:1;DMG:2 (action only)

Only issue is each weapon adds this effect (2 weapon fighter and also a gloom blade option so 3 weapons with effects for each 1) which is a lot in the effect section of the CT. And if I ever hand off the weapon, I must remember to remove the effect.

I instead decided it was cleaner to go to the action tab and click the magnifying glass for each weapon and add +1 to each of the 4 attack modifiers and added 2 to the bonus damage. Then I added WF and WS to the weapon name so I remember why they are there. Bonuses work, labeled so I know why, less combat tracker effect lines and it doesn’t change the base weapon. Oh and when my bab increases I do not need to mess with anything and my character sheet bonuses are correct

Indeed, as Asgurgolas said, one can currently not add tags to weapon entries as for the other type of actions :) I once suggested to add that but people were not so interested into it, especially because there is another extension (advanced effects as mentioned by Asgurgolas) which allows to enter weapon-specific effects :)

YamiVegeta
October 11th, 2025, 05:32
Hey

Sorry if I'm a bother. But I've added a few extra types to my games so this has been great but I have run into a hickup I can't seem to fix.
I'm trying to add damage to weapon rolls of one of my new types. The new type is shadow, I write out the effect, do a test roll and the extra damage doesn't roll.
My effect is "DMG: 1d12 shadow;" If I change shadow to fire it works fine. The shadow type works fine for VULN, spells ect.
This is how I have it entered into the Extension.

table.insert(DataCommon.energytypes, "shadow");
table.insert(DataCommon.dmgtypes, "shadow");
table.insert(DataCommon.specialdmgtypes, "shadow");

Is there something I'm doing wrong?

EDIT: I am dumb, I had the extension activated in my main games but this one it hadn't been turned on. It was my oversight. What happens when you run multiple games lol Sorry to bother you.

Kelrugem
October 11th, 2025, 11:50
HeyEDIT: I am dumb, I had the extension activated in my main games but this one it hadn't been turned on. It was my oversight. What happens when you run multiple games lol Sorry to bother you.

hehe, no worries, also happened to me in the past :D