Skip to content

[Tool] UI-based Spell Learning for Sorcerers/Shamans

13

Comments

  • [Deleted User][Deleted User] Posts: 0
    edited November 2019
    The user and all related content has been deleted.
    Post edited by [Deleted User] on
  • kjeronkjeron Member Posts: 2,367
    I mean, the function has a "class" variable... I was wondering if that determines which spellbook is checked.
    It determines which spells it will look for when auto-filling the spell lists (at install), but in-game, it will always check both cleric and mage spells for "known" spells.
    If your using a preset list of spells, it will still determine which spells known progression table you use (unless using a custom one of these as well).
    As for #2, I have the 'L' spells actually applying feats' effects to the character. I think I can reasonably just overwrite them every time I run the function. I just copy my feat spell to the 'L' spell's name, and add a 171 effect adding the spellbook spell to avoid duplication.
    I think in general it would be better to patch, than overwrite.
    If one of the "Feat" effects has a resource field either unused or with a custom resref, you can check for that with weidu's "UNLESS" so it doesn't duplicate.
    COPY_EXISTING ~SPWI101L.SPL~ override
    	LPF ADD_SPELL_EFFECT ... STR_VAR	resource = ~D5FEAT12~ END
    UNLESS ~D5FEAT12~
    
  • The user and all related content has been deleted.
  • [Deleted User][Deleted User] Posts: 0
    edited November 2019
    The user and all related content has been deleted.
  • kjeronkjeron Member Posts: 2,367
    When it's not using a preset spell-list, the "exclude" variable, set to 0x8000000 (the druid/ranger/shaman bit) in that example, matches against the 4-byte offset at 0x1e, to exclude spells not available to Shamans.
    In addition to that, it also skips spells listed in HIDESPL.2da, of which the SPPRx50.SPL are listed. These spells will not count against the known limit when using this method.

    If you've removed the exclusion flags, then a preset list would become a necessity.

    If included in a preset spell-list, the SPPRx50.SPL spells will count against the known limit (for that kit).
    If not included in the preset list, but granted through the CLAB (as they are normally), they would not count against the limit.

    The optional code for free spells is for spells that have alternative means of acquisition (not counting against the known limit), but can still be chosen through the spell selection system.
  • AquadrizztAquadrizzt Member Posts: 1,065
    Forgive me if this is a stupid question, but could this system be used for things other than learning spells? Could it be adapted to serve as a much more flexible HLA screen, or like IWD2's Feat screen?
  • [Deleted User][Deleted User] Posts: 0
    edited November 2019
    The user and all related content has been deleted.
  • AquadrizztAquadrizzt Member Posts: 1,065
    @subtledoctor , oh that's actually excellent news. I am finally getting geared up to get IWD:5E set up, and the dialog menus really kill it. Prepare for a barrage of questions about getting it working.
  • kjeronkjeron Member Posts: 2,367
    Aquadrizzt wrote: »
    Prepare for a barrage of questions about getting it working.
    It's not ideal for IWD "as is". The UI in IWD hasn't implemented scrolling through spells for sequencers, as addressed here. It's not a hardcoded issue though, it can be fixed.

    Aside from that, I'll be gone for almost 2 weeks starting Friday, so I can't offer much help right now.
  • [Deleted User][Deleted User] Posts: 0
    edited November 2019
    The user and all related content has been deleted.
  • [Deleted User][Deleted User] Posts: 0
    edited November 2019
    The user and all related content has been deleted.
  • kjeronkjeron Member Posts: 2,367
    @subtledoctor
    While valid "custom" variable could result in the list of known spells, it would not be the suffixed -L version, but instead a list of the original spells that a normal sequencer/contingency would use. It would not create any spell files either, as it's designed to only make the minimum UI-modifications, so it's not likely that it was your cause, but is a possible approach:

    The following would use known spells (wizard and priest - I think they could sorted if necessary), while still swapping for a suffixed version. However, on it's own it won't create ANY of the necessary -L suffixed files, or even the base sequencer "filename.spl".
    LAF	CREATE_SEQUENCER_MENU
    	INT_VAR	maxlevel = 9	tip = RESOLVE_STR_REF	(~description~)
    	STR_VAR	resref = ~filename~	icon = ~icon~	title = ~String~	action = ~string~
    	custom = ~~~~~	function()
    				local temp = {}
    				for k,v in pairs (bookSpells) do
    					if v.level == currentSpellLevel - 1 then
    						table.insert(temp, v)
    					end
    				end
    				for k,v in ipairs (temp) do
    					v.resref = v.resref .. "L"  -- suffix of choice
    				end
    				bookSpells = temp
    			end
    			~~~~~
    END
    
    As for scrolls, no, they do not support multiple ability headers in the quick-item slots.
  • EndarireEndarire Member Posts: 1,512
    I've not tried it yet, but is kjeron's UI in the newest Tome & Blood mod version? How EET-compatible is it?
  • [Deleted User][Deleted User] Posts: 0
    edited November 2019
    The user and all related content has been deleted.
  • [Deleted User][Deleted User] Posts: 0
    edited December 2019
    The user and all related content has been deleted.
    Post edited by [Deleted User] on
  • kjeronkjeron Member Posts: 2,367
    The UI seems to know that they don’t count: after I choose 3 spells, it shows “3/5” in the spell learning screen, implying that I can choose two more. But I can’t actually choose any more, because my spellbook has 5/5.
    The UI not allow learning more, despite showing 3/5 at selection, but where is it showing 5/5?
    I'm not sure I fully understand.
  • The user and all related content has been deleted.
  • kjeronkjeron Member Posts: 2,367
    Sorry, meant: there are 5 spells in my spellbook at spell level 1 - and 5 is the max I can know. The spell learning screen says “3/5” which suggests that I can pick two more. In other words the spell learning screen is hinting that it knows two of my spells are ‘free.’ But it still doesn’t let me pick them.
    Not sure, the displayed 3/5 should directly correspond with whether more spells can be chosen for that level, they use the same variables.
    I’m experimenting now with adding the exceptions to BGEE.lua, and I’m getting this error:
    [string “BGEE.lua”]:4562: attempt to index field ‘d5mear0X’ (a nil value)
    
    ...where “d5mear0” is the %resref% in this instance.
    BGEE.lua is loaded before any mod-LUA files, so any references to the mod won't be initialized yet. The mod has 3 LUA files:
    • M_SQLIST.lua: stores the string references needed to avoid crashing for each mod and the initializing table for the tool.
    • M_SQTOOL.lua: stores generic/shared functions for the tool and version#
    • M_SQMENU.lua: stores each mods specific functions, if you needed to add something, this would be the file to append.
  • [Deleted User][Deleted User] Posts: 0
    edited December 2019
    The user and all related content has been deleted.
  • kjeronkjeron Member Posts: 2,367
    edited December 2019
    Sorry, that section got outdated, I'll fix the comments. M_SQLIST.lua is the file to append for that.
    For the EFF file - each spell will need it's own file, I should have explained that better. Currently they are just overwriting each other, as %learn_res% doesn't change between spells.
    Still not sure that fully explains why it's blocking spells from being learned though.
  • [Deleted User][Deleted User] Posts: 0
    edited December 2019
    The user and all related content has been deleted.
    Post edited by [Deleted User] on
  • kjeronkjeron Member Posts: 2,367
    edited December 2019
    M_SQLIST.lua should exist once the tool has run at least once, you may need to update the tool, or I may have a version conflict (old breaking the new) that I need to fix.
    That line only needs to be added once for %learn_res% (multiple entries are harmless though), only the EFF file needs to exist per spell.
    Spell filename doesn't matter.
  • The user and all related content has been deleted.
  • kjeronkjeron Member Posts: 2,367
    Same error?, try this line instead:
    mageBookStrings['D5MYEA0']= {title = mageBookStrings['D5MYEA0X'].title}
    
  • The user and all related content has been deleted.
  • kjeronkjeron Member Posts: 2,367
    False alarm, I think.
    There were definitely some errors on my end.
    It's also not making 'L' spells for those cloned spells. (Which is probably why the UI is blank for them...)
    Subspells are only created for SPWI/SPPR spells and only when using the automated list, not custom lists.
  • The user and all related content has been deleted.
  • [Deleted User][Deleted User] Posts: 0
    edited December 2019
    The user and all related content has been deleted.
  • kjeronkjeron Member Posts: 2,367
    edited December 2019
    ugh, it's been too long since I've worked on this, having trouble remembering my own work.

    "d5myeaz.2da" is the 2da file supplied to the function, copied over as is, but the function isn't looking for a 2da setup like those for op214 (select spell), but as such:
    • column 0: RESREF or SPELL_LABEL (from SPELL.IDS)
    • column 1+: 1 (yes) or 0(no)
    • function defaults to using column 1, but can specify any column, and will create suffix-spells in the process, regardless of filename (provided < 8 char).
    • This was so multiple kits could share the same file, specifying different columns.
    Since you already have a 2da file with all the spells setup for op214, I would suggest either:
    • Copy "d5myeaz.2da" over "d5myeazX.2da" after running the function. Simple and easy, but it doesn't create any suffix-spells.
    • switch the first 2 columns and replace the 3 with 1, and specify "column = 2" to the function.:
      (Life d5pl212 3) -> (d5pl212 LIFE 1)
      You can then add and specify additional columns for other kits to use. This only adds spells to the list that exist in-game (*.spl file exists) at the time of running it, but it does create suffix-spells for each spell.
    Post edited by kjeron on
  • [Deleted User][Deleted User] Posts: 0
    edited December 2019
    The user and all related content has been deleted.
    Post edited by [Deleted User] on
Sign In or Register to comment.