PDA

View Full Version : Help with new damage types in 5e



Pentazer
December 13th, 2019, 20:49
So my campaign setting has a bunch of new damage types to it (kinetic, thermal, quantum, explosive, cosmic). I've added them in an extension which does load with no errors in FG but... they don't seem to parse on NPCs.
30832

I've got the following two code pieces:
in data_common.lua:


-- Damage types supported
dmgtypes = {
"acid", -- ENERGY TYPES
"cold",
"fire",
"force",
"lightning",
"necrotic",
"poison",
"psychic",
"radiant",
"thunder",
"adamantine", -- WEAPON PROPERTY DAMAGE TYPES
"bludgeoning",
"cold-forged iron",
"magic",
"piercing",
"silver",
"slashing",
"kinetic",
"thermal",
"quantum",
"cosmic",
"explosive",
"critical", -- SPECIAL DAMAGE TYPES
};


and in manager_power.lua



-- SET MAGIC DAMAGE IF PHYSICAL DAMAGE SPECIFIED AND GENERATED BY SPELL
if bMagic then
for _,rDamage in ipairs(damages) do
for _, rClause in ipairs(rDamage.clauses) do
if (rClause.dmgtype or "") ~= "" then
local aDmgType = StringManager.split(rClause.dmgtype, ",", true);
if StringManager.contains(aDmgType, "bludgeoning") or StringManager.contains(aDmgType, "piercing") or StringManager.contains(aDmgType, "slashing") or StringManager.contains(aDmgType, "kinetic") or StringManager.contains(aDmgType, "thermal") or StringManager.contains(aDmgType, "quantum") or StringManager.contains(aDmgType, "explosive") then
bMagicAttack = true;
break;
end
end
end
end
end


Am I missing something somewhere else to get these to parse properly?

Trenloe
December 13th, 2019, 21:13
The section of code you've listed is just for setting the bMagicAttack flag if there is physical damage generated by a spell (as mentioned in the comment on the top line of the code snippet), this does nothing for damage entry parsing.

How are you loading the new dmgtypes LUA table? This has to have exactly the same global script reference as the original - DataCommon.dmgtypes

Trenloe
December 13th, 2019, 21:23
30832
And make sure this is is exactly (and I mean *exactly*) the same format as weapon attacks from existing monsters that work correctly.

For example, from the Shortbow attack for a goblin:

Ranged Weapon Attack: +4 to hit, range 80/320 ft., one target. Hit: 5 (1d6 + 2) piercing damage.

This is different to the format you're using in this example screenshot. Your best way of testing is to take an existing monster, make a copy of it and then just change the damage type in an attack entry - that is, take an attack that is known to parse correctly, and make a minimal change to that attack string.

Pentazer
December 13th, 2019, 21:48
Hmmm so I changed the entry to copy yours exactly but change it to a new damage type.


Ranged Weapon Attack: +4 to hit, range 80/320 ft., one target. Hit: 5 (1d6 + 2) explosive damage.

But it looks like it didn't work.

I removed the manager_power.lua entirely since it looks like it's not needed but for the loading of the damage type table I don't understand what you're asking.
30833
it's from data_common.lua and on line 280 of that block.

is this being loaded wrong?

Trenloe
December 13th, 2019, 21:57
... but for the loading of the damage type table I don't understand what you're asking.
30833
it's from data_common.lua and on line 280 of that block.

is this being loaded wrong?
What line of XML do you have in your extension.xml that loads that data_common.lua extension file? It will probably be easier if you ZIP up your extension and attach it here.

Pentazer
December 13th, 2019, 22:13
Oh, okay, sorry, I didn't think of that!

I've attached the zip.

Trenloe
December 13th, 2019, 23:10
That works fine for me with a Goblin modified as follows:

https://www.fantasygrounds.com/forums/attachment.php?attachmentid=30837

Trenloe
December 13th, 2019, 23:12
I've also made the extension so that it just overrides the DataCommon.dmgtypes data not the whole DataCommon script package. This will reduce the chances of clashes with future updates to the 5E ruleset and that file.

EDIT: I've included a Debug.console statement after the dmgtypes have been overridden - so that you can check that the actual values have been stored correctly. To view this open the console before you \reload the ruleset.

Pentazer
December 14th, 2019, 15:12
Hey, thanks so much for your help!
I'll look over the extension you put together and see how I can improve my own work moving forward!

Pentazer
March 27th, 2020, 17:38
Hey, so this actually worked great up until a recent update to FG happened. Now I'm getting this error:



Ruleset Error: windowclass: Defined with a merge attribute, but the name attribute (imagepanelwindow_toolbar) does not match an existing windowclass. Skipped. File (campaign/record_image.xml)
Runtime Notice: s'DataCommon.dmgtypes = ' | { #1 = s'acid', #2 = s'cold', #3 = s'fire', #4 = s'force', #5 = s'lightning', #6 = s'necrotic', #7 = s'poison', #8 = s'psychic', #9 = s'radiant', #10 = s'thunder', #11 = s'adamantine', #12 = s'bludgeoning', #13 = s'cold-forged iron', #14 = s'magic', #15 = s'piercing', #16 = s'silver', #17 = s'slashing', #18 = s'kinetic', #19 = s'thermal', #20 = s'quantum', #21 = s'cosmic', #22 = s'explosive', #23 = s'critical' }

But as you can see it does parse and is recognized.
32653


I've attached the latest version of the extension. Anyone know what this error is referring to and why it's happening?

Trenloe
March 27th, 2020, 20:54
[CODE]
Ruleset Error: windowclass: Defined with a merge attribute, but the name attribute (imagepanelwindow_toolbar) does not match an existing windowclass. Skipped. File (campaign/record_image.xml)
The error specifically refers to a file that is not in your extension. So this is either in another extension or you're running a version of the 5E ruleset that is not compatible with the CoreRPG ruleset. Both versions reported in the chat window (for both 5E and CoreRPG) should be v3.3.10. Do you have an older 5E ruleset unzipped in the rulesets directory?

Pentazer
March 27th, 2020, 22:29
Hmmm I don't think so. I unzipped the 5E folder today and updated this mod using it today since that's what I thought happened. However even when I updated the files inside the mod using the ones from the new 5E the error didn't change. Just to be sure I did also run the updater before unzipping. I checked the unzipped base.xml for the 5e folder and this is it:


<root version="3.0" release="8" logo="logo.png">
<announcement text="5E ruleset v3.3.10 for Fantasy Grounds\rCopyright 2019 Smiteworks USA, LLC" font="emotefont" icon="rulesetlogo_5E" />


Could this be related from my extension.xml?


<importruleset source="5E" />
<script name="NV5eDataCommon" file="scripts/NV5e_data_common.lua" />

Trenloe
March 27th, 2020, 22:52
The best way to check what versions your running is start a 5E campaign and look at the version numbers in the chat window after the campaign loads.

Also, remove the importruleset from your extension.

Pentazer
March 27th, 2020, 22:55
Oh wait, it looks like it may not be my extension, I think it's someone else's. I just disabled everything except for the extensions I made and I have no errors.

Pentazer
March 27th, 2020, 22:56
Remove that line? Okay I'll do that anyway since I want a clean extension.

Trenloe
March 27th, 2020, 22:57
Oh wait, it looks like it may not be my extension, I think it's someone else's. I just disabled everything except for the extensions I made and I have no errors.

Yep, always check other extensions and the ruleset versions - as I mentioned above.

Pentazer
March 27th, 2020, 23:00
Thanks!

Rhuarc
June 4th, 2020, 16:41
Hey there, sorry for hijacking this thread but I wanted to ask a question. My campaign would require a similar change, just different damage types. Is it possible for me (someone who has no real experience with coding) to simply use the files created/updated by you two (in the .zip), change the 'my_data_common' file with my preferred damage types, and drop that in the Fantasy Ground folder? If so, where exactly would I need to put the new script file?

Thanks a lot!