Okay so when I open the spell services menu and the vendor is selling certain spells I've been getting this error in the MWSE.log and the UI is just broken. If I buy these spells it fixes itself. [Magicka of the Third Era | main.lua | WARN] Effect ID 442 is not in the spell table. Effect cost will not be calculated. [Magicka of the Third Era | main.lua | WARN] Effect ID 2145 is not in the spell table. Effect cost will not be calculated. Error in event callback: .\Data Files\MWSE\mods\magicka of the third era\main.lua:2975: attempt to compare number with nil stack traceback: .\Data Files\MWSE\core\lib\event.lua:360: in function '__lt' .\Data Files\MWSE\mods\magicka of the third era\main.lua:2975: in function <.\Data Files\MWSE\mods\magicka of the third era\main.lua:2975> [C]: in function 'sort' .\Data Files\MWSE\mods\magicka of the third era\main.lua:2975: in function <.\Data Files\MWSE\mods\magicka of the third era\main.lua:2716> [C]: in function 'xpcall' .\Data Files\MWSE\core\lib\event.lua:380: in function <.\Data Files\MWSE\core\lib\event.lua:364>Now I've determined that these effect IDs are Bound Claymore and Conjure Palm Lightning from Magicka Expanded, and they show as having 0 gold cost on the vendors and don't correctly display cast chances or spell costs in the magic menu. The question is now why they would break the mod so. The spells work when I cast them, but Mot3E doesn't seem to know how to handle their existence.
This happens after I buy them: [Magicka of the Third Era | main.lua | WARN] Effect ID 2145 is not in the spell table. Effect cost will not be calculated. [Magicka of the Third Era | main.lua | WARN] Effect ID 442 is not in the spell table. Effect cost will not be calculated. [Magicka of the Third Era | main.lua | ERROR] Spell OJ_ME_ConjurePalmLightning should have been calculated but wasn't. This is an error, let me know the scenario how this did happen. [Magicka of the Third Era | main.lua | WARN] Spell OJ_ME_ConjurePalmLightning not found in database! Using simplified approach. Conjure Palm Lightning is in the Cortex Pack but Bound Claymore isn't.
Lua error encountered during UI after-event from uiElement MenuMagic: .\Data Files\MWSE\mods\magicka of the third era\main.lua:3176: attempt to perform arithmetic on a nil value stack traceback: .\Data Files\MWSE\mods\magicka of the third era\main.lua:3176: in function <.\Data Files\MWSE\mods\magicka of the third era\main.lua:3126> Lua error encountered during UI after-event from uiElement MenuMagic: .\Data Files\MWSE\mods\magicka of the third era\main.lua:3176: attempt to perform arithmetic on a nil value stack traceback:
i'm getting a lot of this looping in my mwse.log until i eventually crash.
few other lines as well:
Lua error encountered during UI after-event from uiElement MenuMagic: .\Data Files\MWSE\mods\magicka of the third era\main.lua:3176: attempt to perform arithmetic on a nil value stack traceback:
.\Data Files\MWSE\mods\magicka of the third era\main.lua:3176: attempt to perform arithmetic on a nil value stack traceback: .\Data Files\MWSE\mods\magicka of the third era\main.lua:3176: in function <.\Data Files\MWSE\mods\magicka of the third era\main.lua:3126> [C]: in function 'updateLayout' ...iles\MWSE\core\mwse\ui\tes3uielement\createtextinput.lua:307: in function <...iles\MWSE\core\mwse\ui\tes3uielement\createtextinput.lua:298> Morrowind has crashed! To help improve game stability, send MWSE_Minidump.dmp and mwse.log to the #mwse channel at the Morrowind Modding Community Discord: https://discord.me/mwmods MWSE version: 2.1.0-4459 Build date: 20250516 Memory usage: 2475687936 bytes. Lua traceback at time of crash: stack traceback: [C]: in function 'triggerEvent' .\Data Files\MWSE\mods\ui expansion\commonmagic.lua:34: in function <.\Data Files\MWSE\mods\ui expansion\commonmagic.lua:33> [C]: in function 'triggerEvent' .\Data Files\MWSE\mods\ui expansion\commonmagic.lua:143: in function 'searchSpellsList' .\Data Files\MWSE\mods\ui expansion\commonmagic.lua:173: in function 'onFilterChanged' .\Data Files\MWSE\mods\ui expansion\common.lua:438: in function 'setFiltersExact' .\Data Files\MWSE\mods\ui expansion\common.lua:445: in function 'setFilterText' .\Data Files\MWSE\mods\ui expansion\common.lua:729: in function 'onUpdate' .\Data Files\MWSE\mods\ui expansion\common.lua:294: in function <.\Data Files\MWSE\mods\ui expansion\common.lua:291> Game warnings: MiniDump creation successful.
This means that something at this stage goes wrong. Either the spell that has been saved is invalid, or for some reason you don't have a magic skill value. The former is more likely. I suspect some odd scripted spell, or an effect with no spell school. What you can try: 1) With an existing character, press "Reset Spell Storage" button in the MCM menu of a mod. This will cause all spells to be recalculated. If there has been some momentary bug, could help. 2) See whether this happens with a new character (assuming new character has only starter spells and no custom spells added via script or something). If it doesn't, then the problem is in some specific spell your current character possesses. Maybe it's some weird scripted spell with 0 effects? These could be a problem. 3) If none helps, add these lines before line 3176: for k=1, 6 do log:trace(string.format("Coefficient for skill %d: %.2f", k, magic_skill_table[k])) end log:trace(string.format("tes3.mobilePlayer.alteration.current: %.2f", tes3.mobilePlayer.alteration.current)) log:trace(string.format("tes3.mobilePlayer.conjuration.current: %.2f", tes3.mobilePlayer.conjuration.current)) log:trace(string.format("tes3.mobilePlayer.destruction.current: %.2f", tes3.mobilePlayer.destruction.current)) log:trace(string.format("tes3.mobilePlayer.illusion.current: %.2f", tes3.mobilePlayer.illusion.current)) log:trace(string.format("tes3.mobilePlayer.mysticism.current: %.2f", tes3.mobilePlayer.mysticism.current)) log:trace(string.format("tes3.mobilePlayer.restoration.current: %.2f", tes3.mobilePlayer.restoration.current)) Set the logging in the MCM menu of a mod into TRACE mode. Drop me the log once you've successfully encountered this bug.
It sounds very similar to the issue I was noticing a few weeks ago - you may want to take a look at my comment right below yours. I was also getting a "attempt to perform arithmetic on a nil value" error specifically for a line that included magic_skill_table[6] having a nil value for a mod-added always-succeed spell. I was able to fix this for myself locally, hopefully my explanation below is helpful to your case as well.
I also still see this "attempt to perform arithmetic on a nil value" popping up my my mwse.log, likely due to another edge case - but it doesn't seem to cause any real harm in game so I haven't bothered to hunt down what's causing it yet.
I notice an issue using this with a birthsign mod that adds a custom spell to the game (https://www.nexusmods.com/morrowind/mods/52456) - though I think this would happen with any similar mod.
Specifically, that mod adds a custom detect animal/enchant/key spell to the Tower, "sign_tower_sec_spell", with spellcost 10, always succeeds.
I was getting some CTD's in my game, and looking in MWSE.log I saw this spammed over and over (I turned TRACE on to debug):
[Magicka of the Third Era: TRACE] Spell sign_tower_sec_spell found in storage. Cost: 10.00. Lua error encountered during UI after-event from uiElement MenuMagic: .\Data Files\MWSE\mods\magicka of the third era\main.lua:3178: attempt to perform arithmetic on a nil value stack traceback: .\Data Files\MWSE\mods\magicka of the third era\main.lua:3178: in function <.\Data Files\MWSE\mods\magicka of the third era\main.lua:3126>
Some slight digging shows that the spell_data.skill_table for this spell is all empty, which is causing the error, but that's as far as I was able to get in figuring this out. Not sure if this was causing my CTD's, that could be entirely unrelated to this mod for all I know, but still, figured I should report this anyways.
It was specifically magic_skill_table[6] which was nil for this spell. That's because being an auto-succeed spell, it didn't hit the code for your hack where it copies over the magic_skill_table -> magic_skill_table2 before saving it to spell storage (line 3292ish). Once I copied over your workaround to this section of code as well, it works as expected :-)
Unfortunately for me, during this process I also learnt that this code only gets hit when you open the magic menu, and my original CTD was not during that at all, so I'm very sure now that its entirely unrelated. Still, happy to find and fix a bug, even if it is probably a harmless one (and I see now this spell does have its cost correctly modified, whereas before it remained at its base value)
I see, I might have forgotten about this workaround for the always succeed spells. Well, the worst case scenario is that the casting be handled by the vanilla game (this is what happens if you cast a spell which is unsupported for one or another reason). So yeah, highly unlikely it's relevant to your crashes.
Added the support for new effects (TR/PC and A Taste of Magic), but I don't play the game right now, so if something is broken, let me know.
Pierce and Quicken are implemented suboptimally, I had some beginning of an advanced 'modifier effect' system, but don't have the time/opportunity to implement it right now. This one is a quick and simple approach that treats them as just one more effect in a spell.
Initially I was hesitant to try out such radical changes, but after reading the whole description page I've been sold. When someone has such detailed vision, systematic and logical approach, actual full design for a mechanic, you've got to try it out. Especially after seeing how often you update the mod on request.
Anyway, playing with it around now and enjoying it so far. Thank you so much! And once again, I really respect your approach rethinking the core design and root mechanic instead of simply slapping some tweaks on top of the same system. It's a rare sight and I'll be looking forward to your next work <3
With the new Abecean Shores release, will Magicka of the Third Era be updated as well? The new spells may need patching - the Summon Guardian spell from the bookseller quest, for instance.
Interesting. Metamagic (I call these modifier effects) is something I've planned myself, might be a bit tricky to implement well, but I'll look into it once I have more time modding.
Hi, how can you tune the mana overflow feature? Currently it does not pay off to choose atronanch as birth sign if fireball costs 30 mana. Edit: apologize, fount the settings xD
Set it to 0 to disable it. But note that it should still be beneficial to have more mana (once you are at 100 magicka, fireball will cost the normal amount).
Updated. Just a couple of new supported effects, including Cortex pack (experimental, they might be on a pricey side). By default, my way of distributing spells is still on, as it is more reliable (you know where to find new effects).
194 comments
[Magicka of the Third Era | main.lua | WARN] Effect ID 442 is not in the spell table. Effect cost will not be calculated.
Now I've determined that these effect IDs are Bound Claymore and Conjure Palm Lightning from Magicka Expanded, and they show as having 0 gold cost on the vendors and don't correctly display cast chances or spell costs in the magic menu. The question is now why they would break the mod so. The spells work when I cast them, but Mot3E doesn't seem to know how to handle their existence.[Magicka of the Third Era | main.lua | WARN] Effect ID 2145 is not in the spell table. Effect cost will not be calculated.
Error in event callback: .\Data Files\MWSE\mods\magicka of the third era\main.lua:2975: attempt to compare number with nil
stack traceback:
.\Data Files\MWSE\core\lib\event.lua:360: in function '__lt'
.\Data Files\MWSE\mods\magicka of the third era\main.lua:2975: in function <.\Data Files\MWSE\mods\magicka of the third era\main.lua:2975>
[C]: in function 'sort'
.\Data Files\MWSE\mods\magicka of the third era\main.lua:2975: in function <.\Data Files\MWSE\mods\magicka of the third era\main.lua:2716>
[C]: in function 'xpcall'
.\Data Files\MWSE\core\lib\event.lua:380: in function <.\Data Files\MWSE\core\lib\event.lua:364>
This happens after I buy them:
[Magicka of the Third Era | main.lua | WARN] Effect ID 2145 is not in the spell table. Effect cost will not be calculated.
Conjure Palm Lightning is in the Cortex Pack but Bound Claymore isn't.[Magicka of the Third Era | main.lua | WARN] Effect ID 442 is not in the spell table. Effect cost will not be calculated.
[Magicka of the Third Era | main.lua | ERROR] Spell OJ_ME_ConjurePalmLightning should have been calculated but wasn't. This is an error, let me know the scenario how this did happen.
[Magicka of the Third Era | main.lua | WARN] Spell OJ_ME_ConjurePalmLightning not found in database! Using simplified approach.
In general, spells that are not supported will work as if they were vanilla, but will break the spell services UI until they're bought.
.\Data Files\MWSE\mods\magicka of the third era\main.lua:3176: attempt to perform arithmetic on a nil value
stack traceback:
.\Data Files\MWSE\mods\magicka of the third era\main.lua:3176: in function <.\Data Files\MWSE\mods\magicka of the third era\main.lua:3126>
Lua error encountered during UI after-event from uiElement MenuMagic:
.\Data Files\MWSE\mods\magicka of the third era\main.lua:3176: attempt to perform arithmetic on a nil value
stack traceback:
i'm getting a lot of this looping in my mwse.log until i eventually crash.
few other lines as well:
Lua error encountered during UI after-event from uiElement MenuMagic:
.\Data Files\MWSE\mods\magicka of the third era\main.lua:3176: attempt to perform arithmetic on a nil value
stack traceback:
.\Data Files\MWSE\mods\magicka of the third era\main.lua:3176: attempt to perform arithmetic on a nil value
stack traceback:
.\Data Files\MWSE\mods\magicka of the third era\main.lua:3176: in function <.\Data Files\MWSE\mods\magicka of the third era\main.lua:3126>
[C]: in function 'updateLayout'
...iles\MWSE\core\mwse\ui\tes3uielement\createtextinput.lua:307: in function <...iles\MWSE\core\mwse\ui\tes3uielement\createtextinput.lua:298>
Morrowind has crashed! To help improve game stability, send MWSE_Minidump.dmp and mwse.log to the #mwse channel at the Morrowind Modding Community Discord: https://discord.me/mwmods
MWSE version: 2.1.0-4459
Build date: 20250516
Memory usage: 2475687936 bytes.
Lua traceback at time of crash:
stack traceback:
[C]: in function 'triggerEvent'
.\Data Files\MWSE\mods\ui expansion\commonmagic.lua:34: in function <.\Data Files\MWSE\mods\ui expansion\commonmagic.lua:33>
[C]: in function 'triggerEvent'
.\Data Files\MWSE\mods\ui expansion\commonmagic.lua:143: in function 'searchSpellsList'
.\Data Files\MWSE\mods\ui expansion\commonmagic.lua:173: in function 'onFilterChanged'
.\Data Files\MWSE\mods\ui expansion\common.lua:438: in function 'setFiltersExact'
.\Data Files\MWSE\mods\ui expansion\common.lua:445: in function 'setFilterText'
.\Data Files\MWSE\mods\ui expansion\common.lua:729: in function 'onUpdate'
.\Data Files\MWSE\mods\ui expansion\common.lua:294: in function <.\Data Files\MWSE\mods\ui expansion\common.lua:291>
Game warnings:
MiniDump creation successful.
skill_for_spell = magic_skill_table[6] * tes3.mobilePlayer.alteration.current + magic_skill_table[1] * tes3.mobilePlayer.conjuration.current + magic_skill_table[2] * tes3.mobilePlayer.destruction.current +
magic_skill_table[3] * tes3.mobilePlayer.illusion.current + magic_skill_table[4] * tes3.mobilePlayer.mysticism.current + magic_skill_table[5] * tes3.mobilePlayer.restoration.current
This means that something at this stage goes wrong. Either the spell that has been saved is invalid, or for some reason you don't have a magic skill value. The former is more likely. I suspect some odd scripted spell, or an effect with no spell school.
What you can try:
1) With an existing character, press "Reset Spell Storage" button in the MCM menu of a mod. This will cause all spells to be recalculated. If there has been some momentary bug, could help.
2) See whether this happens with a new character (assuming new character has only starter spells and no custom spells added via script or something). If it doesn't, then the problem is in some specific spell your current character possesses. Maybe it's some weird scripted spell with 0 effects? These could be a problem.
3) If none helps, add these lines before line 3176:
for k=1, 6 do
log:trace(string.format("Coefficient for skill %d: %.2f", k, magic_skill_table[k]))
end
log:trace(string.format("tes3.mobilePlayer.alteration.current: %.2f", tes3.mobilePlayer.alteration.current))
log:trace(string.format("tes3.mobilePlayer.conjuration.current: %.2f", tes3.mobilePlayer.conjuration.current))
log:trace(string.format("tes3.mobilePlayer.destruction.current: %.2f", tes3.mobilePlayer.destruction.current))
log:trace(string.format("tes3.mobilePlayer.illusion.current: %.2f", tes3.mobilePlayer.illusion.current))
log:trace(string.format("tes3.mobilePlayer.mysticism.current: %.2f", tes3.mobilePlayer.mysticism.current))
log:trace(string.format("tes3.mobilePlayer.restoration.current: %.2f", tes3.mobilePlayer.restoration.current))
Set the logging in the MCM menu of a mod into TRACE mode. Drop me the log once you've successfully encountered this bug.
I also still see this "attempt to perform arithmetic on a nil value" popping up my my mwse.log, likely due to another edge case - but it doesn't seem to cause any real harm in game so I haven't bothered to hunt down what's causing it yet.
Specifically, that mod adds a custom detect animal/enchant/key spell to the Tower, "sign_tower_sec_spell", with spellcost 10, always succeeds.
I was getting some CTD's in my game, and looking in MWSE.log I saw this spammed over and over (I turned TRACE on to debug):
[Magicka of the Third Era: TRACE] Spell sign_tower_sec_spell found in storage. Cost: 10.00.
Lua error encountered during UI after-event from uiElement MenuMagic:
.\Data Files\MWSE\mods\magicka of the third era\main.lua:3178: attempt to perform arithmetic on a nil value
stack traceback:
.\Data Files\MWSE\mods\magicka of the third era\main.lua:3178: in function <.\Data Files\MWSE\mods\magicka of the third era\main.lua:3126>
Some slight digging shows that the spell_data.skill_table for this spell is all empty, which is causing the error, but that's as far as I was able to get in figuring this out. Not sure if this was causing my CTD's, that could be entirely unrelated to this mod for all I know, but still, figured I should report this anyways.
It was specifically magic_skill_table[6] which was nil for this spell. That's because being an auto-succeed spell, it didn't hit the code for your hack where it copies over the magic_skill_table -> magic_skill_table2 before saving it to spell storage (line 3292ish). Once I copied over your workaround to this section of code as well, it works as expected :-)
Unfortunately for me, during this process I also learnt that this code only gets hit when you open the magic menu, and my original CTD was not during that at all, so I'm very sure now that its entirely unrelated. Still, happy to find and fix a bug, even if it is probably a harmless one (and I see now this spell does have its cost correctly modified, whereas before it remained at its base value)
Pierce and Quicken are implemented suboptimally, I had some beginning of an advanced 'modifier effect' system, but don't have the time/opportunity to implement it right now. This one is a quick and simple approach that treats them as just one more effect in a spell.
Anyway, playing with it around now and enjoying it so far. Thank you so much! And once again, I really respect your approach rethinking the core design and root mechanic instead of simply slapping some tweaks on top of the same system. It's a rare sight and I'll be looking forward to your next work <3
By default, my way of distributing spells is still on, as it is more reliable (you know where to find new effects).