[MCM] Remove Flames and Healing Spell

Post » Thu Oct 15, 2015 6:45 pm

Hello Creation Kit community.

I've have a trouble to get to work the ToggleOption "Remove Initial Spells" that I've created im My Mod Menu.

Here the script that should remove the spells:

Spoiler
scriptname SHRemoveInitialSpells extends ReferenceAliasGlobalVariable property AARemoveInitialSpells autoActor property PlayerRef autoSpell property Flames autoSpell property Healing autoPerk property SHAAInitialSpellsPerk autofunction setInitialSpells()	if(AARemoveInitialSpells.GetValue() == 1)		PlayerRef.AddPerk(SHAAInitialSpellsPerk)	elseIf (AARemoveInitialSpells.Getvalue() == 0)			PlayerRef.RemovePerk(SHAAInitialSpellsPerk)	endIf		if (PlayerRef.HasPerk(SHAAInitialSpellsPerk))		PlayerRef.RemoveSpell(Flames)		PlayerRef.RemoveSpell(Healing)	else		PlayerRef.AddSpell(Flames)		PlayerRef.AddSpell(Healing)	endIf			endFunctionevent OnPlayerLoadGame()	setInitialSpells()endEvent 

Then the script who add and manage the ToggleOption in my Mod menu:

Spoiler
event OnPageReset(String page)		if page == ("General Settings")		setGeneralPage()	endIfendEventfunction setGeneralPage()	AddHeaderOption("Spells")	removeInitSpellsO = AddToggleOption("Remove Initial Spells", false)endFunctionevent OnOptionSelect(int option)	; Text Options		; Toggle Options	if(option == removeInitSpellsO)		initialSpellsState = !initialSpellsState		if(AARemoveInitialSpells.GetValue() != 0)			AARemoveInitialSpells.SetValue(0)		else			AARemoveInitialSpells.SetValue(1)			endIf			SetToggleOptionValue(option, initialSpellsState)	endIfendEvent 

The ToggleOption in menu working but it does not remove the spells Flames and Healing from Magic Menu.

Any help?

User avatar
Trevi
 
Posts: 3404
Joined: Fri Apr 06, 2007 8:26 pm

Post » Thu Oct 15, 2015 5:44 pm

The Player ActorBase contains the Flames/Healing spells. RemoveSpell cannot remove spells from the ActorBase. You'll have to remove the spells there, and then add them via script if you Remove Initial Spells option is False.

User avatar
Calum Campbell
 
Posts: 3574
Joined: Tue Jul 10, 2007 7:55 am

Post » Thu Oct 15, 2015 5:54 pm

I don't think I've understand. I must set a property ActorBase as player, right? Can you show me an example, please?

Then the ActorBase Script don't have functions for removing and adding spells.

User avatar
Justin Hankins
 
Posts: 3348
Joined: Fri Oct 26, 2007 12:36 pm

Post » Thu Oct 15, 2015 11:06 pm

I mean to edit the ActorBase in the CK, not by script. This would conflict with other mods that modify the Player object though.

User avatar
dell
 
Posts: 3452
Joined: Sat Mar 24, 2007 2:58 am


Return to V - Skyrim