Here's my script:
scn HVHGTUnenchanterScriptlong NumEffectslong CurrentEffectshort DoOnceref Myselfref cInvObjref NewStoneBegin OnActivate Activate Set DoOnce to 1EndBegin GameMode if HVHGTOBSE.HasOBSE == 0 return else if DoOnce == 0 return endif set Myself to GetSelf array_var Items ForEach Items <- Myself.GetItems let cInvObj := Items["Value"] if eval ( GetEnchantment cInvObj == 0 || GetObjectType cInvObj == 34 ) ;Only work on enchanted non-arrows PrintToConsole "Skipped an innapropriate item" Continue ;This ran fine when I placed a non-enchanted ring into the container endif if eval ( GetObjectType cInvObj == 33 ) ;Special consideration for weapons if eval ( GetWeaponType == 4 ) ;Don't do anything to a staff PrintToConsole "Skipped an innapropriate item" Continue ;I experienced a CTD when placing an enchanted staff into the container endif let NumEffects := GetMagicItemEffectCount cInvObj let CurrentEffect := 0 if NumEffects > 0 Label if eval ( IsNthEffectItemScripted cInvObj CurrentEffect ) PrintToConsole "Skipped a scripted item" Continue endif set CurrentEffect to ( CurrentEffect + 1 ) if ( CurrentEffect < NumEffects ) GoTo ;The loop ends here, but only if you have no more effects to go through. endif PrintToConsole "Found an appropriate item" let NewStone := CloneForm HVHGTInvertSigilStoneBase RemoveNthEffectItem newStone 0 CopyAllEffectItems cInvObj NewStone Myself.AddItem NewStone 1 RemoveEnchantment cInvObj PrintToConsole "An item has been Unenchanted" endif else let NumEffects := GetMagicItemEffectCount cInvObj let CurrentEffect :=0 if NumEffects > 0 Label if eval ( IsNthEffectItemScripted cInvObj CurrentEffect ) PrintToConsole "Skipped a scripted item" Continue endif set CurrentEffect to ( CurrentEffect + 1 ) if ( CurrentEffect < NumEffects ) GoTo ;The loop ends here, but only if you have no more effects to go through. endif PrintToConsole "Found an appropriate item" let NewStone := CloneForm HVHGTInvertSigilStoneBase RemoveNthEffectItem newStone 0 CopyAllEffectItems cInvObj NewStone Myself.AddItem NewStone 1 RemoveEnchantment cInvObj PrintToConsole "An item has been Unenchanted" endif endif Loop set DoOnce to 0 endifEnd
Thanks in advance. I'm completely, 100% stumped on this.