Item aliasing for disenchant script

Post » Sun Aug 04, 2013 5:13 pm

I'm trying to add quest aliases that include the keyword "MagicDisallowEnchanting" to items that I don't want the player to be able to disenchant. I'm still getting a feel for the quest and alias system, so this script may be a bit clunky. Everything seems to be going well--my item is filled into the alias, as my debug notification tells me, but I still can disenchant the item. I thought maybe the enchanting system didn't "catch" the keyword change in time, but activating the table a second time didn't work either (the item should still be filling the alias, if I'm not mistaken, so should have at least had the keyword on it the second time I activated the table, right?). Here are the scripts I'm working with. Any advice? Is this perhaps just impossible to accomplish?

Spoiler
Scriptname EA_EnchTable_PreventDisenchanting extends ObjectReference{enchanting table script to prevent disenchanting without the right perks}Actor property PlayerRef autoContainer property EA_GhostContainer auto     ;invisible chest, to be placeAtMe'dEvent OnActivate(ObjectReference akActionRef)	ObjectReference ghostBox = PlayerRef.placeAtMe(EA_GhostContainer)	PlayerRef.RemoveAllItems(ghostBox, true)	ghostBox.RemoveAllItems(PlayerRef, true)	ghostBox.Disable()	ghostBox.Delete()EndEvent

Spoiler
Scriptname EA_GhostBoxScript extends ObjectReference;PROPERTIESQuest property EA_PreventDisenchantingQuest	auto	;quest with 30 aliases that carry the MagicDisallowEnchanting keywordActor property PlayerRef autoPerk property EA_SoulShaper01 autoPerk property EA_SoulShaper02 autoPerk property EA_SoulShaper03 auto				;perks needed for disenchantingPerk property EA_AetherStrider autoPerk property EA_ChaosMaster auto;Perk property EA_CorpusGuardianFormlist property EA_NoPerk1_DisallowList autoFormlist property EA_NoPerk2_DisallowList auto		;formlists of items that carry enchantments which the playerFormlist property EA_NoPerk3_DisallowList auto		;shouldn't have access to yet, depending on perks acquiredFormlist property EA_AetherFocus_DisallowList autoFormlist property EA_ChaosFocus_DisallowList autoFormlist property EA_CorpusFocus_DisallowList auto;LOCALSFormlist disallowListEvent OnInit()	;I think it would be good to begin by clearing out all aliases from	;previous instances of this script -- will a quest.reset() work?	;perk check to set up correct disallow list	if (!PlayerRef.HasPerk(EA_SoulShaper01))		disallowList = EA_NoPerk1_DisallowList	elseif (!PlayerRef.HasPerk(EA_SoulShaper02))		disallowList = EA_NoPerk2_DisallowList	elseif (!PlayerRef.HasPerk(EA_SoulShaper03))		disallowList = EA_NoPerk3_DisallowList	elseif (PlayerRef.HasPerk(EA_AetherStrider))		disallowList = EA_AetherFocus_DisallowList	elseif (PlayerRef.HasPerk(EA_ChaosMaster))		disallowList = EA_ChaosFocus_DisallowList	else ;HasPerk EA_CorpusGuardian		disallowList = EA_CorpusFocus_DisallowList	endif	;start filtering	AddInventoryEventFilter(disallowList)EndEventEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)	int AliasNum = 30 				;total number of reference aliases in the quest (hopefully 30 should be enough to cover player's inventory)	bool AliasFilled = false	While (AliasNum)		AliasNum -= 1		if ((EA_PreventDisenchantingQuest.GetAlias(AliasNum) as ReferenceAlias).ForceRefIfEmpty(akItemReference))			;alias has been filled			debug.notification("success: alias has been filled")			AliasNum = 0			AliasFilled = true		endif	endWhile	if !AliasFilled		debug.notification("failure: the damn thing didn't work")	endifEndEvent
User avatar
brian adkins
 
Posts: 3452
Joined: Mon Oct 01, 2007 8:51 am

Return to V - Skyrim