PDA

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