This seems to no longer be working for me and I am not sure why. I have checked my other mods and I don't believe any should be overriding the category of staves as BluntTwoWide.
Works perfectly fine for me, with about 57 or or so mods installed. You're not using this mod on OpenMW, are you? Don't think it would be compatible, as it has Morrowind Code Patch requirement (which only works with vanilla game).
I got mine to work by removing the period from the folder name "Staff Casting 2.0". It was causing MWSE to be unable to find the file, so the script could not run.
EDIT: I found a solution! The mod was not functioning because of the "." in the folder name. After all that messing around trying to fix the code, MWSE simply wasn't able to find the file because of a misplaced period. I fixed it by renaming the folder "Staff Casting 2" instead of "Staff Casting 2.0".
Like a couple of the other recent commenters, I can't seem to get this to work.
I have tried both files available, I have tried replacing the code with the error fix here in the comments, I have tried cutting the code down to its bare basics (removing the features for updating tooltips and menus, leaving only the multiplier calculation and application) and it just won't function. I am failing to cast 50-chance spells holding a Daedric staff, which should not be happening if this mod is functioning. The mod seems to be having no effect at all, which makes me think there's some error in the code that is simply stopping it from running - but I can't find it.
If anybody is able to get this working or recreate this effect in a new script, PLEASE let me know. This mod (just with a few number tweaks, which I can do myself) is exactly the functionality I want.
I don't see the percent increase on my spell list, I use MWSE with the patch, does it have any conflict/minor issues with UI mods? or spell reworks for the matter
Something is messing with lua framework for me, causing issues with Guar Whispers. Looking at log I got bunch of Morrowind Script Extender v2.1.0-2758 (built Dec 31 2022) Error in event callback: Data Files\MWSE\mods\MKB\Staff Casting 2.0\main.lua:32: attempt to index field 'readiedWeapon' (a nil value) stack traceback: .\Data Files\MWSE\core\lib\event.lua:166: in function '__index' Data Files\MWSE\mods\MKB\Staff Casting 2.0\main.lua:32: in function <Data Files\MWSE\mods\MKB\Staff Casting 2.0\main.lua:31> [C]: in function 'xpcall' .\Data Files\MWSE\core\lib\event.lua:179: in function 'trigger' .\Data Files\MWSE\core\lib\event.lua:199: in function <.\Data Files\MWSE\core\lib\event.lua:169>
This is very odd. There should be no interactions between the two mods whatso ever (Guar Whisperer right?) So I don't know why this mod would be the cause of errors with that one.
I just saw this and I'll look in between both mods and talk with the other mod developer to try and figure out what's going on. Sorry for the delay in response.
I changed a code a bit as I don't use instant casting. Now it just requires equiped staff. Error also got fixed by accident. Also lowered multipliers a bit. local function staffValues(item) local value = item.value local isStaff local multiplier if item.type ~= tes3.weaponType.bluntTwoWide then isStaff = false multiplier = 1 else isStaff = true if value == nil then multiplier = 1 return end if value < 50 then multiplier = 1 elseif value < 100 then multiplier = 1.5 elseif value < 200 then multiplier = 2 elseif value < 1000 then multiplier = 2.5 elseif value < 10000 then multiplier = 3 elseif value > 9999 then multiplier = 4 end end return multiplier, isStaff end
local function staffCasting(e) if e.caster.mobile.readiedWeapon == nil then return end local weapon = e.caster.mobile.readiedWeapon.object local multiplier, isStaff = staffValues(weapon) if multiplier == nil or isStaff == nil then return end if isStaff == true then e.castChance = e.castChance*multiplier end end
local function updatingTheSpellMenu() local weapon local multiplier = 1 local isStaff if tes3.mobilePlayer and tes3.mobilePlayer.readiedWeapon then --if tes3.mobilePlayer.weaponReady == false then --multiplier = 1 --else weapon = tes3.mobilePlayer.readiedWeapon.object multiplier, isStaff = staffValues(weapon) --end else weapon = nil end
local chance = {} local cost = {} local menu = tes3ui.findMenu("MenuMagic") if not menu then return end local menuCost = menu:findChild("MagicMenu_spell_costs") local menuChance = menu:findChild("MagicMenu_spell_percents")
for i, child in pairs(menuChance.children) do table.insert(chance, i, string.match(child.text, "%d+")) --child.text = "/"..chance[i]--*multiplier child.visible = false end
for i, child in pairs(menuCost.children) do table.insert(cost, i, string.match(child.text, "%d+")) child.text = cost[i]..string.format("/%d", math.clamp(chance[i]*multiplier, 0, 100)) end
end
local function staffTooltip(e) local multiplier, isStaff = staffValues(e.object) if multiplier == nil or isStaff == nil then return end if isStaff == true then local text = string.format("Cast Chance Multiplier: %s", multiplier) local block = e.tooltip:createBlock() block.minWidth = 1 block.maxWidth = 230 block.autoWidth = true block.autoHeight = true block.paddingAllSides = 6 local label = block:createLabel{text = text} label.wrapText = true end end event.register("initialized", function() event.register("spellCast", staffCasting) event.register("uiObjectTooltip", staffTooltip) event.register("enterFrame", updatingTheSpellMenu, {priority = -500}) print("Staff Casting : initialized") end)
i love this idea and when combined with how easy you make it to modify the values (heavily nerfed it for my taste) it seemlessly integrates into morrowind as a mechanic that feels like it should have always been there
I'm so glad you like it! I was shocked that nobody had created a similar mod before! I hope that this mod continues to grow and become one of those "Well I can't play the game without it." mods. I know it is for me now >.< But I'm biased.
This is actually really dope, it incentivizes uses staves for wizards and makes early game magic users way more viable in the process. If you pair it with Miscast Enhanced it makes magic feel like something dangerous that requires special tools and knowledge to use.
Thank you! I hope more people end up using this mod! I'm not good at designing these mod pages so it looks weird and bland, but it's probably a mod that I think would get permanent use out of a lot of players if they are ever able to try it!
Actually, how would you go about classifying more types of items as staves? It detects the lutes from Bardic Inspiration (As very good lutes, I consider this a fun feature) but I'm wondering what it would take to make this pick up on the wands from OperatorJack's Wands mod.
I've been working on learning coding myself for another mod so haven't been able to do much else with this. I thought about attempting to do stuff like adding the wand stuff into it. But I need to get more used to doing code myself before I can.
To answer your first question, the way the game works, every "Staff" in the game (and thankfully the ones added) are considered "BluntTwoWide" as weapons in the fundamental coding files of the game, I don't even know what classification Wands are under, but to make a mod like this work with OperatorJacks Wand mod, either they have to have added a new weapon type to the game with the mod, or if they used a weapon type from Morrowind I'd have to build in an exclusion list for it to not work on normal weapons, or, I have to just make a list of weapons in the game (Specificity for the wands) for this mod to work with.
Regardless, I'm hoping for the first one, because if it's a new "weapon type" that's all wands, it will keep this mod functioning as intended. As this is supposed to be a lightweight universal piece of code. Like EVERY staff (as long as they are weapon typed properly by mod creator) will work with this mod. Just period.
So I'd have to look into that, but right now that's not my focus, I'm sorry to disappoint. I'm trying to make a unique... Shopping mod that I think and hope a lot of the more immersive players will utilize!
Sounds a bit like how certain Magick (their spelling) staves in Troika Games' Arcanum worked - they would come with mana pools that could be used to cast spells until the pool was drained, then it would use your fatigue (that game's version of stamina and mana combined instead of being separate resources like here) like usual.
Oh that's an interesting idea. Basically it increases your magicka pool but it does decrease the staff's magicka pool first?... Hmn
If I were to do something like this I don't know how I would impliment it. I think the easiest way would be to tie it to the weapons health value in some way.
But if I do that, then it becomes too easy to repair the weapons and just get a temporary pool of magicka permanately, so I would also desire to make it more difficult to repair these weapons.
Maybe I could just tie "Fortify Magicka" Enchantment for free on every staff naturally? But not have it interfere with other enchantments you might want to put onto it?
I mean that's essentially what this is right? Just having the staff have a "Fortify Magicka" Enchantment but as a baseline.
I"m trying to work on another more robust mod currently, learning more of the coding on my own so I don't have to utilize other authors, so it'll be a while before I come back to this, but it's something I do find interesting (and actually had a similar idea of "making the spells cheaper to cast" along with modifying the spell cast chance. But I didn't want to make this mod too powerful.)
One of the primary goals with this mod is that I desire it to be completely able to just drop into a save and play it without it modifying too much of the game, or making any speciifc requirements. Any new things I add or try and do with this specfific mod will have to some how pull the information from the game itself and then modify content based on that. Hard coding stuff like staff magicka into each staff would be more difficult and probably require an ESP file.
However, if -that- mod were to exist, -this- mod should just be 100% compatible with it regardless.
36 comments
I have checked my other mods and I don't believe any should be overriding the category of staves as BluntTwoWide.
Is it working for other people?
It was working for me before and now it seems to have just stopped.
Guess I need to just start narrowing down mods one by one I suppose.
Like a couple of the other recent commenters, I can't seem to get this to work.
I have tried both files available, I have tried replacing the code with the error fix here in the comments, I have tried cutting the code down to its bare basics (removing the features for updating tooltips and menus, leaving only the multiplier calculation and application) and it just won't function. I am failing to cast 50-chance spells holding a Daedric staff, which should not be happening if this mod is functioning. The mod seems to be having no effect at all, which makes me think there's some error in the code that is simply stopping it from running - but I can't find it.
If anybody is able to get this working or recreate this effect in a new script, PLEASE let me know. This mod (just with a few number tweaks, which I can do myself) is exactly the functionality I want.
Morrowind Script Extender v2.1.0-2758 (built Dec 31 2022)
Error in event callback: Data Files\MWSE\mods\MKB\Staff Casting 2.0\main.lua:32: attempt to index field 'readiedWeapon' (a nil value)
stack traceback:
.\Data Files\MWSE\core\lib\event.lua:166: in function '__index'
Data Files\MWSE\mods\MKB\Staff Casting 2.0\main.lua:32: in function <Data Files\MWSE\mods\MKB\Staff Casting 2.0\main.lua:31>
[C]: in function 'xpcall'
.\Data Files\MWSE\core\lib\event.lua:179: in function 'trigger'
.\Data Files\MWSE\core\lib\event.lua:199: in function <.\Data Files\MWSE\core\lib\event.lua:169>
I just saw this and I'll look in between both mods and talk with the other mod developer to try and figure out what's going on. Sorry for the delay in response.
I'm fairly certain it has a nil=zero... What would I have to add explicitly do you think?
local function staffValues(item)
local value = item.value
local isStaff
local multiplier
if item.type ~= tes3.weaponType.bluntTwoWide then
isStaff = false
multiplier = 1
else
isStaff = true
if value == nil then
multiplier = 1
return end
if value < 50 then
multiplier = 1
elseif value < 100 then
multiplier = 1.5
elseif value < 200 then
multiplier = 2
elseif value < 1000 then
multiplier = 2.5
elseif value < 10000 then
multiplier = 3
elseif value > 9999 then
multiplier = 4
end
end
return multiplier, isStaff
end
local function staffCasting(e)
if e.caster.mobile.readiedWeapon == nil then return end
local weapon = e.caster.mobile.readiedWeapon.object
local multiplier, isStaff = staffValues(weapon)
if multiplier == nil or isStaff == nil then return end
if isStaff == true then
e.castChance = e.castChance*multiplier
end
end
local function updatingTheSpellMenu()
local weapon
local multiplier = 1
local isStaff
if tes3.mobilePlayer and tes3.mobilePlayer.readiedWeapon then
--if tes3.mobilePlayer.weaponReady == false then
--multiplier = 1
--else
weapon = tes3.mobilePlayer.readiedWeapon.object
multiplier, isStaff = staffValues(weapon)
--end
else weapon = nil
end
local chance = {}
local cost = {}
local menu = tes3ui.findMenu("MenuMagic")
if not menu then return end
local menuCost = menu:findChild("MagicMenu_spell_costs")
local menuChance = menu:findChild("MagicMenu_spell_percents")
for i, child in pairs(menuChance.children) do
table.insert(chance, i, string.match(child.text, "%d+"))
--child.text = "/"..chance[i]--*multiplier
child.visible = false
end
for i, child in pairs(menuCost.children) do
table.insert(cost, i, string.match(child.text, "%d+"))
child.text = cost[i]..string.format("/%d", math.clamp(chance[i]*multiplier, 0, 100))
end
end
local function staffTooltip(e)
local multiplier, isStaff = staffValues(e.object)
if multiplier == nil or isStaff == nil then return end
if isStaff == true then
local text = string.format("Cast Chance Multiplier: %s", multiplier)
local block = e.tooltip:createBlock()
block.minWidth = 1
block.maxWidth = 230
block.autoWidth = true
block.autoHeight = true
block.paddingAllSides = 6
local label = block:createLabel{text = text}
label.wrapText = true
end
end
event.register("initialized", function()
event.register("spellCast", staffCasting)
event.register("uiObjectTooltip", staffTooltip)
event.register("enterFrame", updatingTheSpellMenu, {priority = -500})
print("Staff Casting : initialized")
end)
To answer your first question, the way the game works, every "Staff" in the game (and thankfully the ones added) are considered "BluntTwoWide" as weapons in the fundamental coding files of the game, I don't even know what classification Wands are under, but to make a mod like this work with OperatorJacks Wand mod, either they have to have added a new weapon type to the game with the mod, or if they used a weapon type from Morrowind I'd have to build in an exclusion list for it to not work on normal weapons, or, I have to just make a list of weapons in the game (Specificity for the wands) for this mod to work with.
Regardless, I'm hoping for the first one, because if it's a new "weapon type" that's all wands, it will keep this mod functioning as intended. As this is supposed to be a lightweight universal piece of code. Like EVERY staff (as long as they are weapon typed properly by mod creator) will work with this mod. Just period.
So I'd have to look into that, but right now that's not my focus, I'm sorry to disappoint. I'm trying to make a unique... Shopping mod that I think and hope a lot of the more immersive players will utilize!
I don't know if it's possible, but could you perhaps make it so staves come with Magicka that is drained when casting?
If I were to do something like this I don't know how I would impliment it. I think the easiest way would be to tie it to the weapons health value in some way.
But if I do that, then it becomes too easy to repair the weapons and just get a temporary pool of magicka permanately, so I would also desire to make it more difficult to repair these weapons.
Maybe I could just tie "Fortify Magicka" Enchantment for free on every staff naturally? But not have it interfere with other enchantments you might want to put onto it?
I mean that's essentially what this is right? Just having the staff have a "Fortify Magicka" Enchantment but as a baseline.
I"m trying to work on another more robust mod currently, learning more of the coding on my own so I don't have to utilize other authors, so it'll be a while before I come back to this, but it's something I do find interesting (and actually had a similar idea of "making the spells cheaper to cast" along with modifying the spell cast chance. But I didn't want to make this mod too powerful.)
One of the primary goals with this mod is that I desire it to be completely able to just drop into a save and play it without it modifying too much of the game, or making any speciifc requirements. Any new things I add or try and do with this specfific mod will have to some how pull the information from the game itself and then modify content based on that. Hard coding stuff like staff magicka into each staff would be more difficult and probably require an ESP file.
However, if -that- mod were to exist, -this- mod should just be 100% compatible with it regardless.
https://www.nexusmods.com/morrowind/mods/51124?tab=posts
I wonder if you can apply it as a base effect to all staves without making them count as enchanted. Just a thought.