Ok, first thing you should know is that I am VERY new to scripting and modding in general.
Second, my mod is already working fantastically, but with only one slight irritation(or two).
I made this mod to add a new summon spell into the game. More specifically, it summons a shield into the players left hand in much the same way that bound weapons are.
I want it to function entirely the same way as bound weapons (except visually of course, it doesn't need any of their summon animations)
That means dispelling and removing them when unequipped. So far I've accomplished it perfectly with a few minor issues.
The first problem I had was while casting the spell in the right hand when the shield is already summoned.
It would remove the currently equipped shield but not place a new one into the empty shield-hand. I overcame this by making the spell a left-hand slot item only. The vanilla bound weapons never run into this scenario for an obvious reason (Bow and Axe must be sheathed or dispelled before recasting, and bound sword just places the sword into the casting hand. So I'm skeptical that there is even a solution.) I'm content to leave it as a left handed spell in its final form, but if you know of a solution, I'm all ears.
The second problem I still have is how to dispel the Summon-Shield Spell's corresponding Active Effect from the Active Effect list (the one seen at the bottom of the player's magic inventory). I have an Object Reference Script attached to the shield that governs the OnUnequipped event, and I don't know how to have the Active Effect end or dispel when this event takes place.
The ObjectReference Script Attached to the Shield
Scriptname ArmorEtherWard01Script extends ObjectReference Armor Property ArmorEtherWard01 AutoEVENT OnUnequipped(Actor akActor) akActor.removeitem(ArmorEtherWard01, akActor.GetItemCount(ArmorEtherWard01), TRUE)endEVENT
The ActiveMagicEffect script governing the Spell itself:
Scriptname MagEtherWard01Script extends ActiveMagicEffect Armor Property ArmorEtherWard01 Auto MagicEffect Property MagEtherWard01 Auto EVENT OnEffectStart(Actor Target, Actor Caster) caster.additem(ArmorEtherWard01, 1, TRUE) caster.equipItem(ArmorEtherWard01, TRUE, TRUE)endEVENT EVENT onLoad() if !(getCasterActor().hasMagicEffect(MagEtherWard01)) dispel() endifendEVENT EVENT OnEffectFinish(Actor Target, Actor Caster) caster.removeitem(ArmorEtherWard01, caster.GetItemCount(ArmorEtherWard01), TRUE)endEVENT
Both scripts compile, and pull off the effect I want in game superbly; but I'm need to have that active magic effect disappear from the list when it needs to. I'm trying to polish this mod, so I can upload it to Steam.
Another thing I would like to know(but don't necessarily need), is how to have the "Summon Spell" re-equipped to the left hand after the effect wears off; like how the vanilla bound weapons do it. However, this isn't too concerning considering a likely scenario; one where the shield wears off in the middle of a fight and you want to block (if you have a sword out while it wears off, the free hand would allow you to block with the sword instead of the now disappeared shield; going into a casting animation because of reflex could be disasterous).
Thank you for your time.