Dynamically Injecting a Spell into a Quest as a ReferenceAli

Post » Thu Feb 14, 2013 9:26 am

This is a question/Confirmation of some recent testing and findings.

Basically my mod allows people to teach followers spells and configure when the follower casts them. It all works fine except I am using the Spell.cast() command to cast the spells, so users complain about not getting the animations.

So I was going to set up a Quest with aliases for the follower, the spell and the followers target. Add a Scene to the quest that is marked Begin with Quest and end the quest when the scene completes. The idea was toinject/force the aliases on the SpellCasting Quest, start the quest which would force a SpellCasting Package on the follower as part of a scene. Basically I would be inventing my own Quest backed Spell.cast() command that does animations.

But in testing I am find something odd. In the Scenes AI Package, If I hard code the Spell to an Object ID the follower casts the spell just fine. However, when I try using PlaceAtMe() to spawn a Spell ObjectReference instance and forceRef the Quest alias to the spell, and then set the Spell to use th alias, the spell doesn't cast. I have a check that confirms the alias has a reference after it is assigned. So either the reference is getting lost when the scene starts or the UseMagic Procedure simply doesn't work with dynamically created spell objects. And maybe the lifetime of the spell object is expiring before I can use it, but I am not sure what the proper way of translating a SPELL into something a quest alias can use.

So right now the only thing that seems to work is to create a unique scene for every spell as it doesn't seem like there is a way to dynamically specify a spell via aliases. And then use a quest script to activate a scene based on the spell. Since my mod supports around 150 spells... well that is a lot of scenes. Im not really willing to do all that. Especially since I would need a seperate quest with 150 scenes for each follower my mod supports. And my mod supports quite a few...

I have spent about 8 hours trying to get a dynamic solution to work and I am about ready to give up. But I thought I would post something here and see if anyone else has had any success with this.
User avatar
Charity Hughes
 
Posts: 3408
Joined: Sat Mar 17, 2007 3:22 pm

Return to V - Skyrim