Jump to content

SubtleMods: 5E Spellcasting Rules Conversion


Recommended Posts

Instead of ordering spells per level as 00 to 99, what about 00 to zz?  I'm unsure code-wise how this revised ordering would work to allow functioning with thousands of potential spells per spell level.

Also, I briefly checked the Shadow Magic repository's spells directory and found spells in the format of c0sa###.spl (c0 being the prefix, sa probably meaning 'Shadow Adept' or shadow spells, then 1 digit for the spell level, then 2 for the spell in that level, and sometimes one more character at the end).  There were other spell formats:  co8hla_ for high level abilities (0 through c, like in hexadecimal), c0saint (which may also be HLAs or subspells), and co8wis## (00 to 25) which are likely item or creature subspells.

I am eager for more compatibility with 5e Casting, Shadow Magic, and large installs.  I don't wanna wear you out.  Thankee anyway!

Link to comment

I found this delightfully and and yet hopeful interaction between Diablo II Kits' Necromancer and 5e Casting!  Seemingly, 5e Casting worked for this Cleric kit until the character rested and had to reset spells!

I mention this because looking briefly at the file names, the D2 kits don't use the SPL-----.SPL file naming convention.

Pweath check this, because I'd love for D2 kits and Shadow Magic to be able to fully benefit from the 5e Casting system.

Thankee!

Link to comment

No.

I long ago made a nice portable little function specifically for this purpose. It seems that nobody is using it, so I will try to make it more accessible in version 1.19.

I will reiterate how 5E casting collects spells to include in the system:

  • Any normal memorizable wizard and priest spells ("SPWI___" and "SPPR___")
  • Any wizard spells that can be learned from scrolls
  • Any priest spells in a Faiths & Powers sphere system
  • Any spells added by Olvyn's Spell Adding Tool Thing
  • Any spells added by "GA_" in any kit's ability table

If some mod adds more spells that are not added to the game using one of these methods, it can still be made compatible with 5E casting quite easily. As I say, I made a function explicitly for this purpose. It just takes a few a few simple steps:

  1. Put the provided compatibility .tpa file in the mod's /lib folder
  2. Make a list of spells that need including
  3. Run a simple one-line function on the list of spells

In Weidu it looks like this:

INCLUDE ~%MOD_FOLDER%/lib/add_semi_spells.tpa~

ACTION_FOR_EACH myspl IN 
  ~newspl_1~
  ~newspl_2~
  ~newspl_3~
  [etc.]
BEGIN
  LAF add_semi_spells STR_VAR new_spell = EVAL ~%myspl%~ cast_spell = EVAL ~%myspl%~ spell_type = ~[arcane/divine]~ END
END

(If the mod contains both arcane and divine spells, then the lists for each should be separate, and the function should be run on each list with the appropriate 'spell_type.')

That's it. This can easily be added that the end of any mod, and it will make it compatible with 5E Casting as long as 5E Casting is installed after it. If a modder doesn't want to, or has retired, then any enterprising third party can pretty easily make a little helper mod to be installed between the original and 5E casting. It just needs a list of spells.

The leg work is of course in step 2, compiling that list. A mod might have that information easily accessible, or not... but that is outside my control. Once that information is obtained, I've tried to make compatibility as easy as possible.

Edited by subtledoctor
Link to comment
Guest Sears

Hello,

Thank you for your mod. I installed the 1.19 version on a unmodded game and whenever I cast a spell, the feedback log shows doble actions, like:

S: CASTS HEAL:S

S: CASTS HEAL:S

I did a quick search and didn't find related posts. I guess it has something to do with the fact that your mod converts the original spells? because when I cast the Bhaalspawn abilities they don't show double.

And another small question: I always enable the show spell AOE option in the baldur.lua setting and your mod seems to have disabled that. I suppose it is also related to the spell conversion?

 

Link to comment
2 hours ago, Guest Sears said:

the feedback log shows doble actions

Yes. Earlier versions disabled this, but then when you mouse over the spell icon it would not show the spell name. I had to pick my poison, and I chose doubled entries in the combat log. There is no way to fix both. 

2 hours ago, Guest Sears said:

I always enable the show spell AOE option in the baldur.lua setting

It’s not that this mod disables the setting; rather, this mod casts all spells as subspells through opcode 148. The AoE marker gets its info from the projectile in the top-level spell. The only way this could work is if Beamdog enables that option at the engine level to detect projectiles in subspells. (Feel free to put in a feature request with Beamdog for this!)

Meantime you have to play like we played in the 90s. Sometimes you get singed by your own fireballs! (I feel like if I was transported to the Forgotten Realms and went to magic school, this would be a very real danger! :laugh2: )

Edited by subtledoctor
Link to comment

Doc, for adapting 5e casting code for Shadow Magic and using your above function, would this be the code?  Thankee!

INCLUDE ~%MOD_FOLDER%/lib/add_semi_spells.tpa~

ACTION_FOR_EACH myspl IN 
  ~spells/C0SA713.SPL~
  ~spells/C0SA806B.SPL~
  ~spells/C0SA814.SPL~
  ~spells/C0SA815.SPL~
  ~spells/C0SA910.SPL~
  ~spells/C0SA911.SPL~
  [and so on for the spells directory]
  ~alt-spell/c0sa207a.spl~
  ~alt-spell/c0sa407a.spl~
  ~alt-spell/c0sa706a.spl~
  ~alt-spell/c0sacon#.SPL~
  ~alt-spell/c0sacon0.spl~
  ~alt-spell/c0sacon1.spl~
  ~alt-spell/c0sacon2.spl~
  ~alt-spell/c0sacon3.spl~
  ~alt-spell/c0sacon4.spl~
  ~alt-spell/c0sacon5.spl~
  ~alt-spell/c0sacon6.spl~
  ~alt-spell/c0sacon7.spl~
  ~alt-spell/c0sacon8.spl~
  ~alt-spell/c0sacon9.spl~
  ~alt-spell/c0sacon_.SPL~
BEGIN
  LAF add_semi_spells STR_VAR new_spell = EVAL ~%myspl%~ cast_spell = EVAL ~%myspl%~ spell_type = ~arcane~ END
END
Link to comment
Guest Sears
30 minutes ago, subtledoctor said:

Yes. Earlier versions disabled this, but then when you mouse over the spell icon it would not show the spell name. I had to pick my poison, and I chose doubled entries in the combat log. There is no way to fix both. 

Understood. Thank you for the explanation!

Link to comment
1 hour ago, Endarire said:

would this be the code?

No - I'm not sure if it can work on spells in external mod directories. I think you would need to 1) let that mod install its spells, and then, when all those spell files are in /override, run the code you pasted but without any file or directory information. So:

ACTION_FOR_EACH myspl IN 
  ~C0SA713~
  ~C0SA806B~
  ~C0SA814~
  ~C0SA815~
  ~C0SA910~
[etc.]

Also, this only needs to be done for spells that you can actually memorize in your spellbook. That second one "C0SA806B" sounds from the filename like it might be some kind of subspell. Things like that should be omitted... it would not harm anything, but it would needlessly take up space in the 899 spells that the system can handle.

Link to comment

I feel like the below code from the semi_spontaneous.tpa appears to be wrong as mem_spell should be row 1 not row 0 which is the index, this code currently will never do anything I think as the index will clearly never match a spell Res.

Also, I may be wrong but shouldn't PATCH_IF (~%res%~ STRING_EQUAL_CASE ~%mem_spell%~) BEGIN

Be

PATCH_IF (~%res%~ STRING_EQUAL_CASE ~%cast_spell%~) BEGIN

In this case, as if there is already an innate spell that casts the real spell we want, we want to use that version, rather than make another innate spell? (I guess this mostly doesn't matter as it will apply primarily to arcane spells which will have the same mem and cast spells). EDIT- would this mess with cleric-mages?

I believe the way that the code is currently written will mess up for enhanced powergaming scripts as for any wizard spells that are also in a sphere system there will be two zclons spells, so this will mess with the way enhanced powergaming scripts handles 5e casting, or am I missing something? (At least arcane should be read first so it will only be fringe cases where it is an arcane spell given to a divine caster via the sphere system when it will not be cast by the scripts).

 

ACTION_PHP_EACH fnp_sphere_spells AS res => foc BEGIN

      OUTER_SET spl_ind = 0

   ACTION_IF (FILE_CONTAINS_EVALUATED (~d5zclons.2da~ ~%real_spell%~)) BEGIN

     COPY_EXISTING ~d5zclons.2da~ ~override~

       COUNT_2DA_COLS cols

       READ_2DA_ENTRIES_NOW ~r2en_zclons~ cols

       READ_2DA_ENTRY (r2en_zclons - 1) 0 cols last_ind

       FOR (row = 0; row < r2en_zclons; ++row) BEGIN

         READ_2DA_ENTRY_FORMER ~r2en_zclons~ row 0 prev_ind

         READ_2DA_ENTRY_FORMER ~r2en_zclons~ row 0 mem_spell

         READ_2DA_ENTRY_FORMER ~r2en_zclons~ row 2 cast_spell

         PATCH_IF (~%res%~ STRING_EQUAL_CASE ~%mem_spell%~) BEGIN

           SET spl_ind = prev_ind

         END 

       END

     BUT_ONLY

   END

Edited by Enigmajazz
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...