PDA

View Full Version : DCC Question: How to add a new spell?



Jaume
January 27th, 2020, 12:30
To be more precise, I know already how to add a new spell in the DCC spell book.
I would like to know how to add the table of different spell effects, and get on the chat the spell effect according to the caster's roll.
Already existing spells show the effects in a table, but simply adding a table in the new spell or even copy/paste an existing table is not working

It feels like some black magic is needed, something needs to be parsed? some xml tag?

Sorry if the topic has discussed somewhere else, I haven't been able to find it.

leozelig
February 1st, 2020, 12:00
Currently these results are referenced from a data file in the ruleset, not read from the text table in the spell record - that's just a visual reference for the judge/player. I can create an extension for you. You will need to open the 'scripts/data_spell_custom.lua' file and add the casting table results, but it will work.

In theory, spell and class records can be coded so that this information can be pulled for chat messages or auto-populating the character sheet, but it would be a big project for me. Classes would be especially complicated. Maybe I will get to it at some point, but for now, perhaps the extension can provide what you need.

leozelig
February 1st, 2020, 14:11
Here is a template for a custom spells extension - download the file to your 'extensions' data folder. To enter a custom spell, open the 'scripts/data_spell_custom.lua' file, and enter the casting table results for your spells. The "example spell" shows you the format in which to code these. If you have any trouble, let me know...

EDIT: The custom spells extension is obsolete. The current ruleset version allows users to enter the results table directly into the spell record. Disable the extension to avoid script errors.

Jaume
February 2nd, 2020, 17:48
oh! WOW! thanks a lot Leozelig, this is great!
I really appreciate this!
I understand the logic of the script but I failed at make it work properly
I followed your instructions and got something like this

castingtable = {
["Flamebrand"] = {
{ roll = 12, result = "Hello world" },
{ roll = 14, result = "not bad roll" },
{ roll = 18, result = "closer to crit but..." },
{ roll = 20, result = "Rock & Roll" },

I have created a new Spell called Flamebrand, added to a pc sheet, but when casting there is no message on the chat. Either cast alone or to a target

I tried to read the code in manager_action_power.lua but my coding is not that good to get all the stuff in there.

I made a several test by removing " from different places and repeating the test to see where i get a lua error
I would say the file is loaded properly when launching FG, and the table is also read properly (a lua error triggers after rolling when I remove " from a specific result)
maybe sSpellResult gets lost somewhere before printing in the chat? as said my coding skills fall too short :-(

leozelig
February 4th, 2020, 18:15
Ah, simple fix I think. The spell names should be lower case. Otherwise, it looks good.

Just change ["Flamebrand"] to ["flamebrand"]...

Jaume
February 4th, 2020, 20:37
Brilliant!!!! works perfectly!!!
Thanks a lot Leozelig!!

ScottEdwardNash
April 6th, 2020, 23:10
This IS Awesome, thank you!

RaSepReTep
December 5th, 2020, 21:11
... To enter a custom spell, open the 'scripts/data_spell_custom.lua' file, ...

I'm having trouble finding the location of this in Unity version. Would anyone be able to provide me a hint?

Update:
I have figured it out. I did not realize that the .lua file was in the extension itself (I'm new to this)
If anyone else comes along, here is what you do.
Make a copy of the Custom Spell extension.
Rename the .ext to .zip
Unzip it, then find the 'scripts/data_spell_custom.lua' file and open with notepad++

leozelig
December 6th, 2020, 10:35
I'm having trouble finding the location of this in Unity version. Would anyone be able to provide me a hint?

Update:
I have figured it out. I did not realize that the .lua file was in the extension itself (I'm new to this)
If anyone else comes along, here is what you do.
Make a copy of the Custom Spell extension.
Rename the .ext to .zip
Unzip it, then find the 'scripts/data_spell_custom.lua' file and open with notepad++

Hi RaSepReTep... Thanks for your question.

The current version of the DCC ruleset can parse the casting table results from the spell description. Follow the format used for the spells from the core rules when making the casting table. Some useful shortcuts for tables are CTRL-6 (create table), CTRL-TAB (create column), and CTRL-PLUS (increase column width). The custom spells extension should still work if you prefer to do it that way.

Let us know if you have any problems!

Jaume
December 6th, 2020, 13:33
is the DCC ruleset available for Unity already?

Tabarkus
December 7th, 2020, 03:53
Jaume, yes it is, and working well.