Script removal of Race-dependent starting spells?

Post » Tue Jul 09, 2013 9:14 pm

Hello,

I am trying to create a mod that removes all starting spells from the player regardless of their chosen race.

So far, I've successfully removed Healing and Flames from the player by editing the Prisoner Preset ID. That seems to work for all races.

However, I could not find any way to remove Sparks, Conjure Familiar, and Frenzy for those respective races. I have come to the conclusion that they are added via script, but I could not find where and when this takes place.

It seems that I will need to remove them by scripts, but I don't know how when or where to do this. I have some practice with scripts, but only with a custom spell I made(Summoning a shield); I haven't done any quest related scripts like this. I'm pretty sure it will involve something simple like player.removespell commands triggered by some form of EVENT, but I'm at a loss as to where to place the script and how to create the most efficient implementation (like I've said, I only have experience placing scripts in magic effect and item IDs).

I was hoping someone here could save me a ton of time by explaining how I could do this or at least point me in the right direction.

Thanks for your time.

User avatar
QuinDINGDONGcey
 
Posts: 3369
Joined: Mon Jul 23, 2007 4:11 pm

Post » Tue Jul 09, 2013 10:15 pm

So quests/reference aliases are good script holders. Scripts can run as soon as a mod is installed with a quest.

For your case, you need to determine when the player done creating their character.

Scriptname _test_testscript extends ReferenceAliasActor Property PlayerRef AutoSpell Property kSpell01 AutoSpell Property kSpell02 Auto;all your spells...Event OnRaceSwitchComplete()    PlayerRef.RemoveSpell(kSpell01) ;doesn't matter if the player has the spell or not, just try to remove all of them    PlayerRef.RemoveSpell(kSpell02)    GetOwningQuest().Stop() ;stop the quest, no longer neededendEvent

However... I'm not entirely sure if this event will trigger if the player selects Nord. You may need to test that out or find an alternative to detecting when chargen is done.

User avatar
Amy Masters
 
Posts: 3277
Joined: Thu Jun 22, 2006 10:26 am

Post » Tue Jul 09, 2013 7:30 pm

Mojo, I doubt your script will work. The spells aren't added to the player reference; they are stored in each of the chargen presets. I think SMIM removed them by editing those records directly. I don't see any function to remove spells from an ActorBase, even with SKSE...

edit: Well, I didn't read carefully enough. Try Mojo's script.

...or mine, since it features an "array" ;DDD

Scriptname _test_testscript extends ReferenceAliasActor Property PlayerRef AutoSpell[] Property Spells AutoEvent OnRaceSwitchComplete()    int Count = Spells.Length ; Ah-Ah-Ah    While Count > 0        Count -= 1        PlayerRef.RemoveSpell(Spells[Count])    EndWhile    GetOwningQuest().Stop()endEvent

Filling the Spells[] property may be a little different than what you're used to, but I'm sure you'll figure it out ;)

User avatar
jodie
 
Posts: 3494
Joined: Wed Jun 14, 2006 8:42 pm


Return to V - Skyrim