View Full Version : Extension for custom damage types
Kelrugem
February 5th, 2021, 15:16
Forge link: https://forge.fantasygrounds.com/shop/items/45/view
Hi :)
After some request on Discord I wanted to outline how to inbuild your own custom damage types (and creature types) :) You will see here some dummy extension which you can modify to add your own damage types; you may want to see that also as a first mini-mini-mini step towards extension building :) No worries, it is really not complicated, I just did that in a minute or so :) So, it is quick with some exercise
Download the dummy extension, 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 are the ones requested on discord, 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 :)
Have fun :)
Best,
Kelrugem
PS: Written like that it is very compatible with everything as long as nothing drastic with the data structure of 5e's damage types happens :)
PPS:
You want more?
Of course this only works for the standard damage types; there is also the critical damage type with some special properties. Such things are of course a little bit more complicated to code, but one thing is easy to add: The critical damage added as an effect as in DMG: d6 critical does not only trigger on crits but the d6 will also carry all the other native damage types from your weapon, it won't just have the type critical. If you want that your custom damage type behaves similarly, i.e. if used in such effects the native damage types shall be inherited and additionally added, then additionally add the following line in the code above:
table.insert(DataCommon.specialdmgtypes, "ballistic");
(ballistic is just an example of course)
That extra should work, but I did not test it separately, I just looked at the code :) (and it is similar in 3.5e/PF1)
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 :)
Nathrak
February 7th, 2021, 21:53
Haha, this was actually a question I had asked a friend and he posed it in the Discord, those are even the damage types I needed for a 5e scifi module I am doing. Thank you for putting this out there, I am fairly new to FG.
Kelrugem
February 7th, 2021, 23:08
Haha, this was actually a question I had asked a friend and he posed it in the Discord, those are even the damage types I needed for a 5e scifi module I am doing. Thank you for putting this out there, I am fairly new to FG.
If you or your friend asked DmDomination, then, yeah, you are probably the person why I made this initially :D
Nathrak
February 8th, 2021, 01:57
Yep, my friend is DmDomination. :D
Kelevraa
April 8th, 2021, 23:06
You, my friend. Are awesome. It's amazing how much more helpful a simple example is than trying to slog thru any wiki. You have allowed me to add the level of depth and RP to the damage system I have been thinking about for years. I've always wanted a system where "only a weapon tied with a red ribbon can kill the beast" or "a weapon wrapped in the cloth a corpse was buried in" or 100 other interesting RP situations that reflect real mythology outside "silver". I now have salt damage. I love it. And with a "unique" damage type I can make anything happen and just call it "unique". Not to mention add all (the ones I want?) the special materials that have been published and aren't coded in.
Thank you x100
Kelrugem
April 8th, 2021, 23:25
You, my friend. Are awesome. It's amazing how much more helpful a simple example is than trying to slog thru any wiki. You have allowed me to add the level of depth and RP to the damage system I have been thinking about for years. I've always wanted a system where "only a weapon tied with a red ribbon can kill the beast" or "a weapon wrapped in the cloth a corpse was buried in" or 100 other interesting RP situations that reflect real mythology outside "silver". I now have salt damage. I love it. And with a "unique" damage type I can make anything happen and just call it "unique". Not to mention add all (the ones I want?) the special materials that have been published and aren't coded in.
Thank you x100
Cool, I am glad that my small tutorial helps you so much :)
Kelrugem
May 18th, 2021, 13:05
At the end of my first post I now also added how you can add your own creature types :) It is very similar :)
Kelrugem
July 20th, 2021, 00:04
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)
GEONE
July 22nd, 2021, 15:32
Is it possible to create a separate HP-like stat that only custom damage types affect? How involved would that be? I want to create a sanity stat that functions like a second HP that is only affected by sanity damage.
LordEntrails
July 22nd, 2021, 19:43
Is it possible to create a separate HP-like stat that only custom damage types affect? How involved would that be? I want to create a sanity stat that functions like a second HP that is only affected by sanity damage.
Sure, but maybe the Sanity and Honor extension already does what you want?
https://www.fantasygrounds.com/forums/showthread.php?45467-5E-Add-on-Sanity-amp-Honor
GEONE
July 22nd, 2021, 20:07
Sure, but maybe the Sanity and Honor extension already does what you want?
https://www.fantasygrounds.com/forums/showthread.php?45467-5E-Add-on-Sanity-amp-Honor
That adds sanity as a ability score, I was hoping to add it more as a pool, like hp. That way I could add a sanity damage type that certain attacks could do and drain the sanity pool.
LordEntrails
July 22nd, 2021, 20:28
Got it.
In that case you would have to write an extension. You can use it to learn how to add a value to a character that is tracked. Then you can also see how they use it to add that attribute to a character sheet and to the combat tracker (several versions of the extension are in that thread and the threads that thread links too). There really isn't a difference int he data base between an ability score and a hit point value. Both are integers :)
GEONE
July 22nd, 2021, 20:30
Alright, thanks!
Kelrugem
July 22nd, 2021, 22:55
Yeah, this sadly requires a bigger extensions :) This tutorial extension is just for adding new data to existing ones, while your HP stuff needs new functionality and so on :)
GlassGEO
September 18th, 2021, 22:32
I followed all of the instructions, and have the extension in my folder. But it doesnt populate as an extension in the "load game" window nor one I see later.
It just occurred to me though, that this is likely for unity as opposed to classic?
--
I guess I wasnt zipping on the correct layer, because its working now.
But, it does pop up a lua script error when i load my campaign. It still works though
Kelrugem
September 19th, 2021, 10:05
I followed all of the instructions, and have the extension in my folder. But it doesnt populate as an extension in the "load game" window nor one I see later.
It just occurred to me though, that this is likely for unity as opposed to classic?
--
I guess I wasnt zipping on the correct layer, because its working now.
But, it does pop up a lua script error when i load my campaign. It still works though
Yes, indeed, it should work for FG classic, too :)
What type of lua error do you get? If you want, you can upload your version here, and I take a look :)
Raddu
October 1st, 2021, 06:01
I'm trying to use this for Dark Sun, with damage types of metal, bone, stone, obsidian, wood. I want some creatures to have immunity to everything but metal.
If I put, "bludgeoning, piercing, and slashing damage from nonmetal attacks", using weapons with only the metal tag works. However, if a weapon "slashing, metal" it does 0 damage. I think I need something like "magic" for "metal" to overcome immunities?
I tried to use the 3e inserts of energytype and basicdmgtypes, but those don't seem to do anything.
Any idea about what I need to do?
Kelrugem
October 1st, 2021, 10:14
I'm trying to use this for Dark Sun, with damage types of metal, bone, stone, obsidian, wood. I want some creatures to have immunity to everything but metal.
If I put, "bludgeoning, piercing, and slashing damage from nonmetal attacks", using weapons with only the metal tag works. However, if a weapon "slashing, metal" it does 0 damage. I think I need something like "magic" for "metal" to overcome immunities?
I tried to use the 3e inserts of energytype and basicdmgtypes, but those don't seem to do anything.
Any idea about what I need to do?
The 3.5e/PF1 groups of such damage types are sadly only for these rulesets, there is nothing like this in the current 5e code sadly :)
As far as I know the 5e code only allows magic as exception (plus some other damage type, I think). So, these exceptions are hard-coded. To allow other damage types for the parsers etc. as exception, one needs a more elaborated extension :) (not that difficult actually, but someone needs to do and maintain it :D)
Raddu
October 1st, 2021, 15:47
That's what I was afraid of, but thanks for confirming.
Morenu
April 17th, 2022, 22:09
ignore... wrong forum
WLV
January 11th, 2026, 14:57
Hello, for your Custom Damage Tutorial. https://forge.fantasygrounds.com/shop/items/45/view.
Either I am not understanding correctly or I got a bug. So I followed the instructions up to where it says "Then zip the extension again (inside its first layer of folder), then rename to .ext.". I re-zip the unzipped extension folder, and I get a zip file that does not change to an .ext file even when I rename the file as Custom Damage Type.ext, so I am just doing it wrong or is this a bug?
Kelrugem
January 11th, 2026, 20:09
Hello, for your Custom Damage Tutorial. https://forge.fantasygrounds.com/shop/items/45/view.
Either I am not understanding correctly or I got a bug. So I followed the instructions up to where it says "Then zip the extension again (inside its first layer of folder), then rename to .ext.". I re-zip the unzipped extension folder, and I get a zip file that does not change to an .ext file even when I rename the file as Custom Damage Type.ext, so I am just doing it wrong or is this a bug?
I am not sure, you should be able to just rename file to an .ext file. Is there any error message from Windows or so? Do you use the native Windows zipping or any other programme for doing so? :)
Trenloe
January 11th, 2026, 20:48
I re-zip the unzipped extension folder, and I get a zip file that does not change to an .ext file even when I rename the file as Custom Damage Type.ext, so I am just doing it wrong or is this a bug?
You probably have the default setting of hide file extensions. Turn on View -> File Name Extensions in file explorer.
WLV
January 12th, 2026, 23:13
66195
As you can see, the when I rename it. The file type does not change but only the name. So renaming the file doesn't change it from a zip to an .ext, instead it just name the folder that instead. I hope this image helps. I am hoping you can see what I am not.
Trenloe
January 12th, 2026, 23:55
1) ZIP from within the "Custom Damage Types" directory - FG won't read an extension if it's not compressed that way. You can then move the file to the /extensions directory.
2) If ZIPping that way doesn't allow you to change the .zip extension to .ext, right-click and select properties - then post a screenshot of the properties window here.
Kelrugem
January 13th, 2026, 06:54
Additionally to what Trenloe said: You can also upload the folder and the failed ext file here, and then we can check it out directly :)
WLV
January 13th, 2026, 18:53
I do not know how one zip a folder from within the folder.
So I just upload an attachment of the failed ext as asked. I hope it can help.
Trenloe
January 13th, 2026, 19:15
Thanks for providing the extension - as you can see from the attachment the file has .ext.zip - which is caused by Windows not showing the full file extension - which is what I was eluding to earlier in post #3. Search the Internet for something like windows show file extensions for more information.
But, even in this case, you need to ZIP from within the folder - go into your "Custom Damage Types" folder and select all of the files there (CTRL+A) so that extension.xml and the scripts folder are selected, right-click and select Send To -> Compressed (zipped) folder.
See the attached file which addresses these two issues.
WLV
January 15th, 2026, 00:23
Thanks for providing the extension - as you can see from the attachment the file has .ext.zip - which is caused by Windows not showing the full file extension - which is what I was eluding to earlier in post #3. Search the Internet for something like windows show file extensions for more information.
But, even in this case, you need to ZIP from within the folder - go into your "Custom Damage Types" folder and select all of the files there (CTRL+A) so that extension.xml and the scripts folder are selected, right-click and select Send To -> Compressed (zipped) folder.
See the attached file which addresses these two issues.
IT WORKS!!! *tears of joy* I see what you mean now. I keep forgetting you can access files online if you have the file path.
Drage Enzeru
January 27th, 2026, 15:45
I've edited in all my damage and creature types, made sure to convert it back into an .ext file, selected the extention for my campaign. Yet I don't see the creature type when picking the type to search for, and it doesn't register my custom damage type as a damage type when making an attack using it.
Edit: Nvm. Apparently the data_common.lau2 file reset or didn't save correctly.
Kelace
May 7th, 2026, 17:57
Did the most recent update May 5th/6th make this extension unusable? or will it just take time to get it working with the new patch?
Kelrugem
May 7th, 2026, 18:50
Did the most recent update May 5th/6th make this extension unusable? or will it just take time to get it working with the new patch?
Good question; I do not think it will, but just guessing :) I hope I can soon update my extensions, probably starting with those due to their size. So, if you are okay with waiting a bit, then I could soon check whether or not the extensions still works :) (and that one may be easy to fix, if I need to do something)
Kelace
May 7th, 2026, 18:52
Good question; I do not think it will, but just guessing :) I hope I can soon update my extensions, probably starting with those due to their size. So, if you are okay with waiting a bit, then I could soon check whether or not the extensions still works :) (and that one may be easy to fix, if I need to do something)
I appreciate you looking into it. I was having some problems and tried to work around it, but I still cannot get it to work, and this was with only that extension enabled.
Kelrugem
May 7th, 2026, 19:50
I appreciate you looking into it. I was having some problems and tried to work around it, but I still cannot get it to work, and this was with only that extension enabled.
I see! Thanks for the report then :) Yeah, then I will try to update them this weekend or so; should not be too difficult, just had not much time for looking into the new patch yet :)
Moon Wizard
May 7th, 2026, 20:19
There's a new helper function to add a damage type.
ActionCore.addDamageType(<string>)
ActionCore.addDamageType(<table of strings>)
Regards,
JPG
Kelrugem
May 7th, 2026, 20:41
There's a new helper function to add a damage type.
ActionCore.addDamageType(<string>)
ActionCore.addDamageType(<table of strings>)
Regards,
JPG
Cool, thanks! That should make it easy to convert the extension :)
Kelrugem
May 17th, 2026, 00:23
I appreciate you looking into it. I was having some problems and tried to work around it, but I still cannot get it to work, and this was with only that extension enabled.
Hi :)
I had now time to look at it, and for me the extension still works. I can certainly improve the extension by what Moon Wizard wrote above, but the old version should and still works :)
How do you try to use the extension? What is the error, or why do you think it does not work? Can you describe what you were doing? :)
EDIT: Beware, it is not a classical extension. One has to open the extension and edit it for adding damage types. Important to follow the steps from the forge page and make sure you zip the extension correctly :) (the idea: the extension shall highlight a bit how one can edit the ruleset for modding :) )
Rhydion
May 18th, 2026, 12:04
Hi :)
I had now time to look at it, and for me the extension still works. I can certainly improve the extension by what Moon Wizard wrote above, but the old version should and still works :)
How do you try to use the extension? What is the error, or why do you think it does not work? Can you describe what you were doing? :)
EDIT: Beware, it is not a classical extension. One has to open the extension and edit it for adding damage types. Important to follow the steps from the forge page and make sure you zip the extension correctly :) (the idea: the extension shall highlight a bit how one can edit the ruleset for modding :) )
Hey Kel. I also had issues with the old file. However, I thought I would save you some time and so some investigating myself, using moons suggestions and powershell I can confirm the following structure now works:
function onInit()
local tAlluriaEnergyDamageTypes = {
"wind",
"water",
"earth",
"holy",
"shadow",
};
ActionCore.addEnergyDamageType(tAlluriaEnergyDamag eTypes);
ActionCore.addSpecialDamageType(tAlluriaEnergyDama geTypes);
end
=================================
addDamageType = valid damage tag.
addBasicDamageType = valid normal damage type without making it “energy.”
addEnergyDamageType = valid normal damage type and exempt from normal DR handling.
addSpecialDamageType = probably for tags like magic, silver, precision, etc., not necessarily your elemental damage families.
Your old files don't include local definitions for whatever is being added, so the system just doesn't process the string lines on their own like the old method.
The above works completely for me. Though I didn't do much testing on special damage types, so thought I should include it in mine "just in case".
As a side note, I will probably look into adding an additional part to this file minimally for myself, as in pathfinder, untyped DR can't be overcome, but currently damage types available don't take that into account for certain combinations (high level weapon attacks with overcomes like alignment based damage properties WILL overcome untyped DR). I'm playing around with correcting this with some custom code keeping it AS LIGHT as possible. I'm not much of a coder, I can mostly understand what things are trying to reference and accomplish, but I do lean on AI for general writing.
If you like, I can share whatever I come up with and pop it here or anywhere to see if it's of any use/could be made better. Let me know! Hope you are doing well, looking forward to strain injury updates eventually! Don't stress about mods :)
EDIT UPDATE:
I located the DR issue and from what I can work out, something like this should resolve DR being bypassed if energy damage is on weapon so long as DR is untyped:
local bHasEnergyType = false;
local bHasSpellType = false;
local bHasWeaponDamageType = false;
for _,s in ipairs(tDamageTypes) do
if s == "spell" then
bHasSpellType = true;
elseif ActionCore.isEnergyDamageType(s) then
bHasEnergyType = true;
elseif StringManager.contains({ "bludgeoning", "blunt", "crushing", "piercing", "ballistic", "slashing", "kinetic", "physical" }, s) then
bHasWeaponDamageType = true;
end
end
local bSkipDR = bHasSpellType or (bHasEnergyType and not bHasWeaponDamageType);
if not bSkipDR and (v + nClauseDmgAdj) > 0 then
--------------------
I'll see if I can fork it in and test it.
Rhydion
May 18th, 2026, 13:05
There's a new helper function to add a damage type.
ActionCore.addDamageType(<string>)
ActionCore.addDamageType(<table of strings>)
Regards,
JPG
So after some testing, the new block added seems to work.
This block:
local bHasEnergyType = false;
for _,s in ipairs(tDamageTypes) do
if not bHasEnergyType and (ActionCore.isEnergyDamageType(s) or (s == "spell")) then
bHasEnergyType = true;
break;
end
end
if not bHasEnergyType and (v + nClauseDmgAdj) > 0 then
Is replaced with this block:
local bHasEnergyType = false;
local bHasSpellType = false;
local bHasWeaponDamageType = false;
for _,s in ipairs(tDamageTypes) do
if s == "spell" then
bHasSpellType = true;
elseif ActionCore.isEnergyDamageType(s) then
bHasEnergyType = true;
elseif StringManager.contains({ "bludgeoning", "blunt", "crushing", "piercing", "ballistic", "slashing", "kinetic", "physical" }, s) then
bHasWeaponDamageType = true;
end
end
local bSkipDR = bHasSpellType or (bHasEnergyType and not bHasWeaponDamageType);
if not bSkipDR and (v + nClauseDmgAdj) > 0 then
======================
This ensures energy types added to weapons via spells / custom items or whatever don't auto trigger the whole weapon to bypass DR.
If this is useful and appropriate Moon has permission to incorporate this into CORERPG. Tiny QOL for PFRPG.
Hope this was helpful.
Kelace
May 18th, 2026, 20:17
So I had a chance to look at it again, I literally did nothing different than what I did last time, and now its working. I did pull the custom damage types and redownload and follow steps again, but it is identical to what it was before. There could have been a removed letter, or punctuation somewhere and that could have caused my issue. I'm not sure, I'm just glad its working again.
Sorry for any possible extra work you had to do.
To answer your question: I run this in 5e, (don't know if I mentioned that last time), but I did nothing but update during the May 5th update, removed all extensions to find out which ones were working, and which ones weren't. There was no specific error, it just wasn't working tried custom damage vs resistances and without, and what WAS happening, was if I had any custom damage type listed in either a weapon or spell, it just would not roll the damage at all. I don't know if that was intended or not. If I had say shadow damage and slashing damage in a weapon, it would roll the damage, but only apply the slashing, if I only had shadow damage as the damage, it would not roll anything.
Again, its working now.
Rhydion
May 18th, 2026, 20:26
So I had a chance to look at it again, I literally did nothing different than what I did last time, and now its working. I did pull the custom damage types and redownload and follow steps again, but it is identical to what it was before. There could have been a removed letter, or punctuation somewhere and that could have caused my issue. I'm not sure, I'm just glad its working again.
Sorry for any possible extra work you had to do.
To answer your question: I run this in 5e, (don't know if I mentioned that last time), but I did nothing but update during the May 5th update, removed all extensions to find out which ones were working, and which ones weren't. There was no specific error, it just wasn't working tried custom damage vs resistances and without, and what WAS happening, was if I had any custom damage type listed in either a weapon or spell, it just would not roll the damage at all. I don't know if that was intended or not. If I had say shadow damage and slashing damage in a weapon, it would roll the damage, but only apply the slashing, if I only had shadow damage as the damage, it would not roll anything.
Again, its working now.
Glad it's working for you. I did help another friend who was having issues in 5e with "Resistance to <XDamageType> from nonmagical weapons".
If you find this isn't working for you, update it to this version:
function onInit()
local tYOURDamageTypes = {
"Damagetype1",
"Damagetype2",
"Damagetype3",
"etc",
};
ActionCore.addBasicDamageType(tYOURDamageTypes);
end
=======
This is because as I found out, in the 5E ruleset the resistance parsing cares about basic damage types down the code pipeline.
Obviously, if everything is working and stable, don't fix it. But if you want a little future proofing using correct helpers to prevent silliness if things change later somewhere else in the pipeline, update to the above.
Though I am very confused as to how the old version is still functioning for some people, since the way it seems to handle damage inputs downstream seems notably different. Weird.
Kelace
May 19th, 2026, 06:05
Glad it's working for you. I did help another friend who was having issues in 5e with "Resistance to <XDamageType> from nonmagical weapons".
If you find this isn't working for you, update it to this version:
function onInit()
local tYOURDamageTypes = {
"Damagetype1",
"Damagetype2",
"Damagetype3",
"etc",
};
ActionCore.addBasicDamageType(tYOURDamageTypes);
end
=======
This is because as I found out, in the 5E ruleset the resistance parsing cares about basic damage types down the code pipeline.
Obviously, if everything is working and stable, don't fix it. But if you want a little future proofing using correct helpers to prevent silliness if things change later somewhere else in the pipeline, update to the above.
Though I am very confused as to how the old version is still functioning for some people, since the way it seems to handle damage inputs downstream seems notably different. Weird.
I really have no clue, I just redownloaded the extension, and placed everything back in that needed to be there, and did some testing with and without other extensions and its all working nicely. I did a test with RESIST: 5 bludgeoning if that is what you were referring to on Resisitance to <XDamageType> and it worked fine, if that is in reference to another way to show resistance then I don't know about that.
Rhydion
May 19th, 2026, 12:48
I really have no clue, I just redownloaded the extension, and placed everything back in that needed to be there, and did some testing with and without other extensions and its all working nicely. I did a test with RESIST: 5 bludgeoning if that is what you were referring to on Resisitance to <XDamageType> and it worked fine, if that is in reference to another way to show resistance then I don't know about that.
Right ok. Well resist is just a flat way to lower damage against a type. But sometimes in 5e you have resistances only apply to nonmagical weapons, which is what I was talking about previously.
But if its working its working I guess XD
Kelrugem
May 24th, 2026, 16:04
Hi :)
Sorry for the late reply :) But it works now, right? Otherwise let me know again :)
@Rhydion: Indeed, there is now a more elegant way to do it, but the old way should still work :) (the new functions one can use are basically doing the table.insert stuff what my extension suggests, so should still work :) )
Rhydion
May 24th, 2026, 16:18
Hi :)
Sorry for the late reply :) But it works now, right? Otherwise let me know again :)
@Rhydion: Indeed, there is now a more elegant way to do it, but the old way should still work :) (the new functions one can use are basically doing the table.insert stuff what my extension suggests, so should still work :) )
Yea it was super weird on my end. I couldn't get it to resolve on my end and had to force the new way. Frankly, as long as something works for people its fine I think XD
Kelrugem
May 24th, 2026, 16:24
But I will still insert the new approach in time :) Thanks again!
(Because the new code does indeed at one point more than a table.insert; may be needed for certain cases)
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.