I am sorry I have not been active lately. I spent most of the holidays with my family and getting some much needed rest and relaxation. While I am still grinding away at things, my modding activity is severely limited as I am now in the final few months of my PhD. From now until my dissertation defense this summer, I will likely not be doing much modding. I would like to think I will have a few months free after I defend, but I do not know when I may start working after I graduate.
I will try to mod when I have free time... I just may not have much for the next few months. Thanks for your understanding.
Please visit the wiki on the github if you have questions about how to make a configuration file. I will probably be making a few updates to it over the next few days, but this will be where the most complete documentation is.
I have plans to add additional functionality but really wanted to get the first version released. If you have suggestions, please let me know!
My current implementation of modifying spell magnitude works, but is a little janky. It should be fine, but let me know if you run into any weird interactions. I plan to change the implementation at some point.
If you run into issues please do a few things please:
Change your logging settings in the MCM to debug.
Post your crash log and your DynamicMagicModificationFramework.log files to pastebin or similar website and link it in a comment or bug report. If you paste directly, please use spoiler tags.
Please let me know which DMMF mods are used or link your personal configuration file if that is what you are using.
Please describe the situation you are in when you are crashing
Ok, after finally having some time, I have been able to take a look at a few issues.
First, there was an issue with invisibility and etherealize. If you casted invisibility, casting another spell would not cancel invisibility (however, interacting with items still should have). This was because of a silly mistake. I had lines of code to remove invisibility and etherealize during the spell casting process, however, for some reason I decided to add an if statement checking if the spell had the invisibility (or etherealize) effect. Therefore, invisibility was only broken if you were recasting invisibility which would just... reapply invisibility. So effectively, casting a spell never removed the effect. I removed those if statements and now things seem to be working. I don't really know what I was thinking with those if statements...
Second, some people were experience crashes, seemingly randomly. They would usually happen during combat, but were not consistent or repeatable. Worst of all, I could not reproduce them. This meant I couldn't do any troubleshooting personally. To make matters even more worse, the first report of this crash came with the weirdest crash log I've ever seen - only 2 lines! This made me think the crash was something completely unrelated to the mod.
Subsequent crash reports were more complete, but all referenced the same thing: D:\a\_work\1\s\src\vctools\crt\vcruntime\src\string\amd64\memcpy.asm:440 memcpyThe number (440) before memcpy may differ.
This was confusing as it didn't really reference DMMF at all. Some google searching initially led me to believe that maybe it was an issue with users not have the Virtual C++ redistributables.
Further analysis of the crash logs revealed that it may have something to do with line 97 in Hooks.cpp. This line involves erasing an iterator from a vector. Although I had some checks in place to prevent an invalid iterator being passed to this line, it seems like I missed a few loopholes. After consulting some forums and chatgpt, I found how to fix potential sources of invalid iterators and made the appropriate changes.
Unfortunately, since I cannot reproduce the original crash, I cannot test if this actually fixed the crashes.
I have uploaded an update file called DMMF Hotfix 1.0.1a 1.0.1b. Users on v1.0.1a still experienced memcpy crashes. This fixes the invisibility issue and hopefully fixes the memcpy related crashes. If you have experience any of these crashes please download the update. It just overwrites the dll with a new version. Please let me know if this seems to fix the crashes. Once I get confirmation that it does fix the crash, I will include this fix in the main file of the mod. Likely, I will wait until I have some more features added before updating the main file. Until then, the hotfix update should suffice.
After spawning in hundreds of mages and having them all cast simultaneously, I was able to consistently reproduce the memcpy crashes. I noticed that depending on how many mages and how long it took to crash, the crash log would differ. In the worst case scenario, I actually was able to reproduce the 2 line crash log (!!) that previously confused me. I even got a 1 line crash log once lol. My initial fix in 1.0.1a changed where the memcpy issue occurred, but still caused crashes. Finally, I was able to resolve all memcpy issues by changing the vector to list. If anyone is adept at c++, you may understand why, but simply, a list was a better storage method for this data than a vector and avoids the memcpy concerns. This fix is included in v1.0.1b.
If you do still experience crashes, please check if it includes that line above about memcpy (I sure f'n hope not). Please let me know if it does. Otherwise, if you have a crash that mentions something else entirely, please also let me know about that to see if there is another issue.
First of all, thank you for your excellent work and this amazing framework! I've been looking for a decrease casting time to my projectile spells and this will definitely help. However, when I try to use the latest version, I get a CTD and my skyrim won't even load. I'm currently using Nolvus Ascension v5 and MO2 and version 1.0.1b starts to load and then crashes.
Here is a small exert of the crash report: Unhandled native exception occurred at 0x7FFF274D933A (KERNELBASE.dll+C933A) on thread 13768!
Possible relevant objects (0) { } AX: 0x1C40EEA8AF0 (char*) "directory_iterator::directory_iterator: The system cannot find the path specified." DX: 0x30955EDDB0 (char*) "DynamicMagicModificationFramework???" SP: 0x30955EEA40 (char**) "directory_iterator::directory_iterator: The system cannot find the path specified." [SP+0] 0x1C40EEA8AF0 (char*) "directory_iterator::directory_iterator: The system cannot find the path specified." [SP+8] 0x30955EEB68 (void*) [SP+10] 0x1 (u8):[1] [SP+18] 0x30955EEC08 (char**) "directory_iterator::directory_iterator: The system cannot find the path specified." [SP+20] 0x81E06D7363 (u64):[557816050531] [SP+110] 0x1C40EEA8AF0 (char*) "directory_iterator::directory_iterator: The system cannot find the path specified." [SP+118] 0x52 (u8):[82] [SP+1C8] 0x1C40EEA8AF0 (char*) "directory_iterator::directory_iterator: The system cannot find the path specified." [SP+228] 0x1C328135AD0 (char*) "directory_iterator::directory_iterator: The system cannot find the path specified.: "Data\SKSE\Plugins\DynamicMagicModificationFramework\""
It seems to be looking for a file or folder and isn't using the correct path. But, as I said, version 1.0.1 seems to work just fine. Do you know why this is happening or an easy fix for the problem?
And if you need the whole crash report, here it is.
And help would be appreciated and even if you can't thanks anyway!
How much does the debug log option in the MCM actually record? Because if it records everything that happens in the process of casting a spell, it might help me figure out why I am having an extremely inconvenient glitch these past couple weeks that I have not been able to figure out the cause for.
Basically, certain spells won't activate while I am in the middle of combat, working fine when combat has not started yet. One particular spell won't activate at all.
So does the debug log record information that might be useful to diagnosing my problem?
Within your framework, would there be a way to "refresh" passive effects (i.e., Constant-Effect Self-Targeted Ability spells) based on conditions, so that their magnitude updates in response to active perks?
Let me clarify with an example: In the vanilla game, if you are a vampire and have the Necromage perk, the magnitude of all passive effects are enhanced at the moment they are added to the player and remain that way even after the player is cured. However, the enhanced passives will reset back to normal magnitude if they are removed and added back to the cured-vampire player.
So, a Necromage vampire who activates the Atronach Stone will have their absorption rate boosted to 62.5%. If this player is later cured of vampirism, the boosted magnitude persists. However, if the cured player switches to a different Standing Stone and then returns to the Atronach Stone, the absorption rate reverts to the normal 50%.
So for that example, if there was like a “Refresh” function to remove and reapply the spell on the condition Subject.HasMagicEffect(SomeVampirePassive)==0, then it would patch that exploit.
That’s not why I would want that function btw, but I’m facing a similar problem in a mod I’m developing where I want a passive on the player to react dynamically to a perk entry point that, itself, switches on and off in response to a magic effect. The necromage example just felt easier for me to explain as most skyrim players are familiar with it.
I'll think about it when I get the chance, but I don't know if that would actually be something this mod could target. I definitely think it is something that could be fixed, but probably warrants its own plugin to implement.
Great mod, just a heads up though, when it comes to spells which pick things up like telekinesis, this mod causes an issue where sometimes objects can no longer be picked up, as a result, this can cause clashes with other mods which have spells that pick up actors for example, like with Ordinator Perks or Psychokinesis.
I will look into it, but in my experience, I haven't had any issues with telekinesis. I have my own spell mod in the works that has a grab actor spell and haven't had issues.
What is the script load for a mod like this? I noticed from the logs it runs on more spells than just the ones for which I have installed mods to mange with this framework.
Good evening, congratulations to the breakthrough! I'll be happy to test. But it'll be some time until I can, because I need to finish mods first. Might be easiest to upload the dll to optional or misc file?
I'm trying to figure out if a spell is cast by script, would the correct condition for that be to check Casting Slot? or is there a better way to do so?
Ah, I had simply assumed they were being modified and was adding a preemptive condition. I wasn't sure what exactly was being defined as cast, which really should have been my first question. So just to be clear, only spells either manually cast by a player or cast by npc ai are being detected, excluding all scripted methods?
As an aside, I also have a suggestion for regarding resources. I understand this is likely out of scope, but it would be incredible of resources could have a secondary value. For example if a spell cost 50 magicka, and you only have 40, take the remainder from a defined secondary resource such as health.
To clarify your first point, yes, scripted spells are excluded as the functions I've hooked never actually get called by the game.
For the second point, that is an interesting idea. It should be possible, but it may require a decent amount of work to get working. Not something that would be at the top of the priority list, but may be something to try in the future.
This is amazing. Controlled Casting has been a staple in my modlist since I first saw it last year, and now having such a robust way to extend its features and more in whatever way I want to whatever spell I want is so cool. I made a little mod to make some modded Blood spells cost health instead of magicka yesterday and it just worked, first try, effortlessly.
I have some suggestions for additional features:
1. Could we have a condition for plugins? Basically something like:
Would affect specifically all spells in the Bloodmoon mod.
2. What about a condition for spells that are referenced by a spell tome? This would make it easy to apply modifications only to spells intended to be used normally by the player character or human npcs, ignoring dummy spells authors might use for other reasons.
3. I took a look at the SKSE API and saw that only actor values can be passed as a resource. Do you think it would be possible to have spells cost things other than actor values? Though now that I think about it, it might be possible to spoof an actor value using Actor Value Generator.
1. I am planning to add a bunch more options in the next patch (no eta yet) and I'll look into that. It may be a bit tricky though. Better option imo is to distribute keywords to the spells via KID and then just check for keywords. I know it means an extra config file, but ultimately may be the best way. 2. That should be possible. 3. I have plans to add some kind of custom AV support eventually. I've talked with Noah (AVG mod author) about it briefly but we haven't done any work towards it yet.
Regarding AVs, the github documentation specifically calls out health, magicka, and stamina as the only valid resource types but it sounds like AV can be used as well? if so that is really opens up some possibilities, even more so if custom AVs are supported in the future.
62 comments
I will try to mod when I have free time... I just may not have much for the next few months. Thanks for your understanding.
Please visit the wiki on the github if you have questions about how to make a configuration file. I will probably be making a few updates to it over the next few days, but this will be where the most complete documentation is.
I have plans to add additional functionality but really wanted to get the first version released. If you have suggestions, please let me know!
My current implementation of modifying spell magnitude works, but is a little janky. It should be fine, but let me know if you run into any weird interactions. I plan to change the implementation at some point.
If you run into issues please do a few things please:
First, there was an issue with invisibility and etherealize. If you casted invisibility, casting another spell would not cancel invisibility (however, interacting with items still should have). This was because of a silly mistake. I had lines of code to remove invisibility and etherealize during the spell casting process, however, for some reason I decided to add an if statement checking if the spell had the invisibility (or etherealize) effect. Therefore, invisibility was only broken if you were recasting invisibility which would just... reapply invisibility. So effectively, casting a spell never removed the effect. I removed those if statements and now things seem to be working. I don't really know what I was thinking with those if statements...
Second, some people were experience crashes, seemingly randomly. They would usually happen during combat, but were not consistent or repeatable. Worst of all, I could not reproduce them. This meant I couldn't do any troubleshooting personally. To make matters even more worse, the first report of this crash came with the weirdest crash log I've ever seen - only 2 lines! This made me think the crash was something completely unrelated to the mod.
Subsequent crash reports were more complete, but all referenced the same thing:
D:\a\_work\1\s\src\vctools\crt\vcruntime\src\string\amd64\memcpy.asm:440 memcpy
The number (440) before memcpy may differ.This was confusing as it didn't really reference DMMF at all. Some google searching initially led me to believe that maybe it was an issue with users not have the Virtual C++ redistributables.
Further analysis of the crash logs revealed that it may have something to do with line 97 in Hooks.cpp. This line involves erasing an iterator from a vector. Although I had some checks in place to prevent an invalid iterator being passed to this line, it seems like I missed a few loopholes. After consulting some forums and chatgpt, I found how to fix potential sources of invalid iterators and made the appropriate changes.
Unfortunately, since I cannot reproduce the original crash, I cannot test if this actually fixed the crashes.I have uploaded an update file called DMMF Hotfix
1.0.1a1.0.1b. Users on v1.0.1a still experienced memcpy crashes. This fixes the invisibility issue and hopefully fixes the memcpy related crashes. If you have experience any of these crashes please download the update. It just overwrites the dll with a new version. Please let me know if this seems to fix the crashes. Once I get confirmation that it does fix the crash, I will include this fix in the main file of the mod. Likely, I will wait until I have some more features added before updating the main file. Until then, the hotfix update should suffice.After spawning in hundreds of mages and having them all cast simultaneously, I was able to consistently reproduce the memcpy crashes. I noticed that depending on how many mages and how long it took to crash, the crash log would differ. In the worst case scenario, I actually was able to reproduce the 2 line crash log (!!) that previously confused me. I even got a 1 line crash log once lol. My initial fix in 1.0.1a changed where the memcpy issue occurred, but still caused crashes. Finally, I was able to resolve all memcpy issues by changing the vector to list. If anyone is adept at c++, you may understand why, but simply, a list was a better storage method for this data than a vector and avoids the memcpy concerns. This fix is included in v1.0.1b.
If you do still experience crashes, please check if it includes that line above about memcpy (I sure f'n hope not). Please let me know if it does. Otherwise, if you have a crash that mentions something else entirely, please also let me know about that to see if there is another issue.
I've been looking for a decrease casting time to my projectile spells and this will definitely help.
However, when I try to use the latest version, I get a CTD and my skyrim won't even load.
I'm currently using Nolvus Ascension v5 and MO2 and version 1.0.1b starts to load and then crashes.
Here is a small exert of the crash report:
Unhandled native exception occurred at 0x7FFF274D933A (KERNELBASE.dll+C933A) on thread 13768!
FrameworkName: NetScriptFramework
FrameworkVersion: 15
FrameworkArchitecture: x64
GameLibrary: SkyrimSE
GameLibraryVersion: 18
ApplicationName: SkyrimSE.exe
ApplicationVersion: 1.5.97.0
VersionInfo: Successfully loaded
Time: 16 Apr 2025 18:35:42.504
Possible relevant objects (0)
{
}
AX: 0x1C40EEA8AF0 (char*) "directory_iterator::directory_iterator: The system cannot find the path specified."
DX: 0x30955EDDB0 (char*) "DynamicMagicModificationFramework???"
SP: 0x30955EEA40 (char**) "directory_iterator::directory_iterator: The system cannot find the path specified."
[SP+0] 0x1C40EEA8AF0 (char*) "directory_iterator::directory_iterator: The system cannot find the path specified."
[SP+8] 0x30955EEB68 (void*)
[SP+10] 0x1 (u8):[1]
[SP+18] 0x30955EEC08 (char**) "directory_iterator::directory_iterator: The system cannot find the path specified."
[SP+20] 0x81E06D7363 (u64):[557816050531]
[SP+110] 0x1C40EEA8AF0 (char*) "directory_iterator::directory_iterator: The system cannot find the path specified."
[SP+118] 0x52 (u8):[82]
[SP+1C8] 0x1C40EEA8AF0 (char*) "directory_iterator::directory_iterator: The system cannot find the path specified."
[SP+228] 0x1C328135AD0 (char*) "directory_iterator::directory_iterator: The system cannot find the path specified.: "Data\SKSE\Plugins\DynamicMagicModificationFramework\""
It seems to be looking for a file or folder and isn't using the correct path.
But, as I said, version 1.0.1 seems to work just fine.
Do you know why this is happening or an easy fix for the problem?
And if you need the whole crash report, here it is.
And help would be appreciated and even if you can't thanks anyway!
Basically, certain spells won't activate while I am in the middle of combat, working fine when combat has not started yet. One particular spell won't activate at all.
So does the debug log record information that might be useful to diagnosing my problem?
Let me clarify with an example: In the vanilla game, if you are a vampire and have the Necromage perk, the magnitude of all passive effects are enhanced at the moment they are added to the player and remain that way even after the player is cured. However, the enhanced passives will reset back to normal magnitude if they are removed and added back to the cured-vampire player.
So, a Necromage vampire who activates the Atronach Stone will have their absorption rate boosted to 62.5%. If this player is later cured of vampirism, the boosted magnitude persists. However, if the cured player switches to a different Standing Stone and then returns to the Atronach Stone, the absorption rate reverts to the normal 50%.
So for that example, if there was like a “Refresh” function to remove and reapply the spell on the condition Subject.HasMagicEffect(SomeVampirePassive)==0, then it would patch that exploit.
That’s not why I would want that function btw, but I’m facing a similar problem in a mod I’m developing where I want a passive on the player to react dynamically to a perk entry point that, itself, switches on and off in response to a magic effect. The necromage example just felt easier for me to explain as most skyrim players are familiar with it.
Cheers! And thanks for your effort :)
Edit: I've uploaded the update file
Spells cast via script would not be effected by this mod. Those spells aren't actually ever "cast" and therefore is not detected by the mod.
As an aside, I also have a suggestion for regarding resources. I understand this is likely out of scope, but it would be incredible of resources could have a secondary value. For example if a spell cost 50 magicka, and you only have 40, take the remainder from a defined secondary resource such as health.
For the second point, that is an interesting idea. It should be possible, but it may require a decent amount of work to get working. Not something that would be at the top of the priority list, but may be something to try in the future.
I have some suggestions for additional features:
1. Could we have a condition for plugins? Basically something like:
{
"condition": "plugin",
"operator":"==",
"value": "Bloodmoon.esp"
}
Would affect specifically all spells in the Bloodmoon mod.
2. What about a condition for spells that are referenced by a spell tome? This would make it easy to apply modifications only to spells intended to be used normally by the player character or human npcs, ignoring dummy spells authors might use for other reasons.
3. I took a look at the SKSE API and saw that only actor values can be passed as a resource. Do you think it would be possible to have spells cost things other than actor values? Though now that I think about it, it might be possible to spoof an actor value using Actor Value Generator.
With regards to your questions/suggestions:
1. I am planning to add a bunch more options in the next patch (no eta yet) and I'll look into that. It may be a bit tricky though. Better option imo is to distribute keywords to the spells via KID and then just check for keywords. I know it means an extra config file, but ultimately may be the best way.
2. That should be possible.
3. I have plans to add some kind of custom AV support eventually. I've talked with Noah (AVG mod author) about it briefly but we haven't done any work towards it yet.