Is there a version of this or a mod that has similar papyrus functions that works for SSE/AE? If not, I'd be interested in helping to get this working in newer versions of the game.
Working with ActiveMagicEffects Its been a freaking pain in the arse. This plugin amazes me, because I understand how it has bothered other modders enough to get to work on stuff like this, but I never manage to find the one single function that would probably be (what I consider) the simplest and most logical one:
A bloody cast() function that actually returns shit.
You can't know what did you cast with your spells. Not only that, but since ActiveMagicEffects aren't "Forms" you can't even directly get their IDs (although I gotta try casting them as String and see if that does something). All I can think of is to modify the magnitude of the spell or something like that to use it as a "password", but that seems a really annoying method.
Do you think it would be possible to create such a method with a plugin?
WOW!! I've been looking for something like this. This would definitely smooth out some mod conflict issues, being able to dynamically modify these. I'm very much looking forward to the mod you're planning this for.
The only thing I would ask for is the ability to retrieve your own summon from a function. I assume GetMGEFRelatedForm just returns the creature in general, rather than the specific reference the spell would create?
That's correct, it would only return the ActorBase of the creature that the MagicEffect is set up to summon an instance of.
I would have to look into whether the ObjectReference for a summoned actor could be obtained or not. The details of how Summon archetype MagicEffects work hasn't been decoded yet, though, so it's probably going to be difficult to get that info. I would suggest using a workaround, for instance you could use GetMGEFRelatedForm to find what base form the magic effect will create, and then when it is cast, use Game.FindClosestReferenceOfType() on that form to identify the newly summoned actor.
Looked into ActiveMagicEffects more closely this week, but for the moment I can't make magnitude changes work for any AME whose MagicEffect has the recover flag set on it. It will work for all other effects (any effect whose damage is applied every second) though using the current beta version. I might be able to figure it out eventually.
Other than that, I have no additional plans until someone makes a request or something.
There's no such thing as Magnitude on a MagicEffect.
You will need to set the magnitude on the thing that uses the MagicEffect instead. SKSE will let you do that -- there is already a SetMagnitude available for most things that use MagicEffects (Spells, Potions, Enchantments, Scrolls, etc).
I know, but Spell for ActiveMagicEffect is equivalent of BaseObject for ObjectRef, so modyfing anything changes all objects that inherits from it. I was curious if magnitude of currently active effect that comes from spell couldnt be modified on run time, but if it cant then fck, im doomed.
You're right that the ActiveMagicEffect inherits its magnitude directly from the Spell data the moment it is created. But Spell is not quite the same thing as a "BaseObject" for the ActiveMagicEffect - actually AME is a completely different script type, not even related to Form. Once it has inherited the Spell data when it is created, the AME no longer has any technical relation to its originating Spell at all, AFAIK.
In any case, AME instances would need to be manipulated directly. The good news is that it looks like the data for ActiveMagicEffects is exposed in the SKSE source already, so I could try testing out magnitude changes and see if it works when I get a chance this week. I have a feeling its probably not completely safe to alter that data while the effect is active, but who knows, maybe it will be okay.
Of course, you would have to alter this data in a script attached directly to the MagicEffect, which would in turn be inherited by its ActiveMagicEffect instances (or alternatively, you could manipulate the AME in another script that is sent the reference to the AME from this script instance) -- as far as I'm aware there is no possible way to get access to a specific AME reference without attaching a script to the MagicEffect.
Not sure if it matters, but I found that AME is refreshed only OnLoad (at the same time when everything is unloaded from non player actors). So editing *SPELL* magnitude takes effect after next OnLoad (for npcs, not sure about player), so modyfing AME would probably take effect till next OnLoad as well, then it would get overwritten (it would still be mega useful, because we can track OnLoad).
[edit] or wait I'm actually not sure if it took affect after OnLoad or immediately, then get overwritten on next OnLoad (tested it several months ago)? Either way, things are only refreshed OnLoad for non player actors.
23 comments
Thanks for sharing this awesome mod!
A bloody cast() function that actually returns shit.
You can't know what did you cast with your spells. Not only that, but since ActiveMagicEffects aren't "Forms" you can't even directly get their IDs (although I gotta try casting them as String and see if that does something). All I can think of is to modify the magnitude of the spell or something like that to use it as a "password", but that seems a really annoying method.
Do you think it would be possible to create such a method with a plugin?
The only thing I would ask for is the ability to retrieve your own summon from a function. I assume GetMGEFRelatedForm just returns the creature in general, rather than the specific reference the spell would create?
I would have to look into whether the ObjectReference for a summoned actor could be obtained or not. The details of how Summon archetype MagicEffects work hasn't been decoded yet, though, so it's probably going to be difficult to get that info. I would suggest using a workaround, for instance you could use GetMGEFRelatedForm to find what base form the magic effect will create, and then when it is cast, use Game.FindClosestReferenceOfType() on that form to identify the newly summoned actor.
I do have a request, unsure if you can make it
Other than that, I have no additional plans until someone makes a request or something.
You will need to set the magnitude on the thing that uses the MagicEffect instead. SKSE will let you do that -- there is already a SetMagnitude available for most things that use MagicEffects (Spells, Potions, Enchantments, Scrolls, etc).
In any case, AME instances would need to be manipulated directly. The good news is that it looks like the data for ActiveMagicEffects is exposed in the SKSE source already, so I could try testing out magnitude changes and see if it works when I get a chance this week. I have a feeling its probably not completely safe to alter that data while the effect is active, but who knows, maybe it will be okay.
Of course, you would have to alter this data in a script attached directly to the MagicEffect, which would in turn be inherited by its ActiveMagicEffect instances (or alternatively, you could manipulate the AME in another script that is sent the reference to the AME from this script instance) -- as far as I'm aware there is no possible way to get access to a specific AME reference without attaching a script to the MagicEffect.
I'll get back to you about it.
[edit] or wait I'm actually not sure if it took affect after OnLoad or immediately, then get overwritten on next OnLoad (tested it several months ago)? Either way, things are only refreshed OnLoad for non player actors.