Jump to content


Photo

Adding mod scrolls to the scroll scribing component


  • Please log in to reply
7 replies to this topic

#1 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Modder
  • 1505 posts

Posted 05 February 2022 - 05:28 PM

One of my favorite bits of aTweaks is the Scroll Scribing component, and I was bummed that it didn't cover the stuff we added for IWDification. So I made a fork, coded it up, and am awaiting it being merged and released. It was coded to be extensible, so other modders can easily add their own spells.

 

Essentially, aTweaks will process the cd_mod_scrolls array which is comprised of entries like so:

scroll item file name, level of spell, strref of name => spell file name

The file names are sans extensions, e.g. spwi225 not spwi225.spl. You can generate these however you want; for IWDification the array is built on the fly by an item regexp since all of its scrolls are named CDIAxxx.itm. You can see the added code; I foist the array generation for IWDification into a separate library which gets included if the mod is detected, and then all of this gets processed at the end.

 

At any rate, I mainly wanted to raise awareness of this so that other mods can add their spell scrolls.


Why is this Hypnotoad video so popu... ALL GLORY TO THE HYPNOTOAD.
____
The Gibberlings Three - Home of IE Mods

The BG2 Fixpack - All the fixes of Baldurdash, plus a few hundred more. Now available, with more fixes being added in every release.


#2 jastey

jastey
  • Administrator
  • 3219 posts

Posted 06 February 2022 - 01:05 AM

Thank you for this update. I have a mage that will learn to write own book page kind of pages. Prepare yourself for questions how I steal use the example of aTweak's code to detect his current learned spells into a spellscroll ability. (No ETA, but I will come back to this. Because when I looked at it last year, I didn't get how it's done.)

 

I fear, adding his pages with your template into aTweaks would make it so any mage would be able to write them.

 

Plus, they are dependent on conditions (he needs to learn something else before he can write them.)

 

If it's feasible to extend your template with e.g. a condition variable and an NPC's scriptname to make some scrolls only available for certain NPCs/conditions that would be great, but I have no idea how much work that would be and my mage is probably the only one needing the restrictions.



#3 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5155 posts

Posted 06 February 2022 - 01:51 AM

his current learned spells


You do realize this is an install time tweak, not a savegame one... or in-game script.


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#4 jastey

jastey
  • Administrator
  • 3219 posts

Posted 06 February 2022 - 05:05 AM

Yes, I'm aware how the tweak works, thankyou. The tweak enables the mage to make scrolls of any spells they have learned = "current spells".



#5 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Modder
  • 1505 posts

Posted 06 February 2022 - 09:56 AM

Spell scribing is done via dialogue, so you can apply all of the normal triggers to restrict it (variables, DV checks, &c.). However, the code as I've written it doesn't support adding triggers, but it should be easy to adapt.

 

If there's interest, I can certainly generalize the code to support custom triggers.


Edited by CamDawg, 06 February 2022 - 09:57 AM.

Why is this Hypnotoad video so popu... ALL GLORY TO THE HYPNOTOAD.
____
The Gibberlings Three - Home of IE Mods

The BG2 Fixpack - All the fixes of Baldurdash, plus a few hundred more. Now available, with more fixes being added in every release.


#6 Galactygon

Galactygon

    Modding since 2002

  • Member
  • 938 posts

Posted 12 February 2022 - 06:42 AM

Wouldn't it be more robust to REGEXP GLOB map all scrolls connected to spells in the game rather than do it manually?


Posted Image

#7 Endarire

Endarire
  • Member
  • 216 posts

Posted 12 February 2022 - 03:07 PM

GrammarSalad has been working on a crafting mod to automatically parse what spells a caster knows for purposes of item creation, and can dynamically create scrolls, potions, and wands based on that.

GrammarSalad has been active on the Gibberlings3 forum and Discord lately.



#8 jastey

jastey
  • Administrator
  • 3219 posts

Posted 15 February 2022 - 01:40 AM

Wouldn't it be more robust to REGEXP GLOB map all scrolls connected to spells in the game rather than do it manually?


Then we need lists to exclude scrolls that should not be available for all spell casters, like the "new scroll" types (with known spells) my mage would learn to write.

 

 

If there's interest, I can certainly generalize the code to support custom triggers.


@CamDawg I would be interested, but I don't have time to look into this in the near future to see how much sense it makes to include these special scrolls into the scroll scribing component in general. There might be a drawback I'm not thinking about currently so I'm hesistant to request work input from you.