Rebual Posted May 28, 2017 Share Posted May 28, 2017 Hello guys, I'm having trouble figuring out why a function of my script stops working after re-enabling a feature. The Register Function at [Line 131] works fine the first time until the features at [Line 210] are updated, then the Register Funtion refuses to work. The last debug "Register" at [Line 212] shows up, so the function must be somehow jammed, but I just can't figure out why it stops. nSky_playeralias Scriptname nSky_playeralias extends ReferenceAlias Keyword Property ArmorClothing AutoKeyword Property ArmorLight AutoKeyword Property ArmorHeavy AutoKeyword Property ArmorShield AutoKeyword Property ArmorJewelry AutoKeyword Property ArmorMaterialIron AutoKeyword Property ArmorMaterialLeather AutoKeyword Property ArmorMaterialHide AutoKeyword Property ArmorMaterialSteel AutoKeyword Property ArmorMaterialSteelPlate AutoKeyword Property ArmorMaterialEbony AutoKeyword Property ArmorMaterialElven AutoKeyword Property ArmorMaterialGlass AutoKeyword Property ArmorMaterialDragonscale AutoKeyword Property ArmorMaterialDragonplate AutoKeyword Property ArmorMaterialDwarven AutoKeyword Property ArmorMaterialFalmer AutoKeyword Property ArmorMaterialScaled AutoKeyword Property ArmorMaterialOrcish AutoKeyword Property ArmorMaterialDaedric AutoKeyword Property WeapTypeBattleaxe AutoKeyword Property WeapTypeGreatsword AutoKeyword Property WeapTypeWarhammer AutoKeyword Property WeapTypeStaff AutoKeyword Property WeapTypeBow AutoKeyword Property WeapTypeMace AutoKeyword Property WeapTypeDagger AutoKeyword Property WeapTypeWarAxe AutoKeyword Property WeapTypeSword AutonSky_configquest Property cfgqst AutoObjectReference Property TempCont AutoBool RegBool InitBool UpdateBool SpecialBool BreakInt iCountInt iMaskInt iTempInt[] cTempInt[] Property SlotMasks AutoArmor aPickArmor cPickArmor[] aTempArmor[] iArmorWeapon[] wTempWeapon lWepWeapon rWepWeapon ranged Event OnInit() aTemp = new Armor [10] wTemp = new Weapon [10] cTemp = new Int [10] iTemp = aTemp.Length iArmor = new Armor [32] RegisterForSingleUpdate(0.1)EndEvent Function BreakArmor()Float probTFloat probM Float probS = cfgqst.BreakProb[20] Form a = none Int i = SlotMasks.Length while i i -= 1a = iArmor if a if a.HasKeyword(ArmorClothing) probT = cfgqst.BreakProb[1] elseif a.HasKeyword(ArmorLight) probT = cfgqst.BreakProb[2] elseif a.HasKeyword(ArmorHeavy) probT = cfgqst.BreakProb[3] endif if a.HasKeyword(ArmorMaterialIron) probM = cfgqst.BreakProb[4] elseif a.HasKeyword(ArmorMaterialLeather) probM = cfgqst.BreakProb[5] elseif a.HasKeyword(ArmorMaterialHide) probM = cfgqst.BreakProb[6] elseif a.HasKeyword(ArmorMaterialSteel) probM = cfgqst.BreakProb[7] elseif a.HasKeyword(ArmorMaterialSteelPlate) probM = cfgqst.BreakProb[8] elseif a.HasKeyword(ArmorMaterialEbony) probM = cfgqst.BreakProb[9] elseif a.HasKeyword(ArmorMaterialElven) probM = cfgqst.BreakProb[10] elseif a.HasKeyword(ArmorMaterialGlass) probM = cfgqst.BreakProb[11] elseif a.HasKeyword(ArmorMaterialDragonscale) probM = cfgqst.BreakProb[12] elseif a.HasKeyword(ArmorMaterialDragonplate) probM = cfgqst.BreakProb[13] elseif a.HasKeyword(ArmorMaterialDwarven) probM = cfgqst.BreakProb[14] elseif a.HasKeyword(ArmorMaterialFalmer) probM = cfgqst.BreakProb[15] elseif a.HasKeyword(ArmorMaterialScaled) probM = cfgqst.BreakProb[16] elseif a.HasKeyword(ArmorMaterialOrcish) probM = cfgqst.BreakProb[17] elseif a.HasKeyword(ArmorMaterialDaedric) probM = cfgqst.BreakProb[18] else probM = cfgqst.BreakProb[0] endif if probT && probM if Special probT = probT + probS probM = probM + probS endif if (Utility.RandomInt(1, 100) <= probT) if (Utility.RandomInt(1, 100) <= probM) Debug.Notification(a.GetName()+" has been torn apart.") Game.GetPlayer().RemoveItem(a, 1, true, None) iArmor = none endif endif endifendif endwhile Break = false Special = falseEndFunction Function Register() Debug.MessageBox("0 - "+aTemp[0].GetName()+" "+cTemp[0]+" ; 1 - "+aTemp[1].GetName()+" "+cTemp[1]+" ; 2 - "+aTemp[2].GetName()+" "+cTemp[2]+" ; 3 - "+aTemp[3].GetName()+" "+cTemp[3]+" ; 4 - "+aTemp[4].GetName()+" "+cTemp[4]+" ; 5 - "+aTemp[5].GetName()+" "+cTemp[5]+" ; 6 - "+aTemp[6].GetName()+" "+cTemp[6]+" ; 7 - "+aTemp[7].GetName()+" "+cTemp[7]+" ; 8 - "+aTemp[8].GetName()+" "+cTemp[8]+" ; 9 - "+aTemp[9].GetName()+" "+cTemp[9]+" ; 10 - "+aTemp[10].GetName()+" "+cTemp[10]) Bool aT Bool sT Bool b Bool next Int iT = aTemp.Length Int iM = SlotMasks.Length while iT iT -= 1 if aTemp[iT] if cTemp[iT] if !b cPick = aTemp[iT] iCount = cTemp[iT] aTemp[iT] = none cTemp[iT] = 0 b = true else next = true iT = 0 endif else aTemp[iT] = none endif endif endwhile if b && !cPick.HasKeyword(ArmorShield) iMask = cPick.GetSlotMask() aT = true elseif b && cPick.HasKeyword(ArmorShield) iMask = cPick.GetSlotMask() sT = true endif Debug.Notification("Slot Mask "+iMask) while b && iMask > 0 && ((cfgqst.LimitArmorEnabled && (aT && !sT)) || (cfgqst.LimitShieldEnabled && (sT && !aT))) iM -= 1 if iMask == SlotMasks[iM] if Update if iArmor[iM] && iArmor[iM] != cPick Game.GetPlayer().DropObject(cPick, iCount) else if iCount > 1 Game.GetPlayer().DropObject(cPick, (iCount - 1)) ;Debug.Notification("More than one picked up, dropping rest...") endif Game.GetPlayer().EquipItem(cPick) endif else if iArmor[iM] Game.GetPlayer().DropObject(cPick, iCount) else if iCount > 1 Game.GetPlayer().DropObject(cPick, (iCount - 1)) ;Debug.Notification("More than one picked up, dropping rest...") endif iArmor[iM] = cPick Game.GetPlayer().EquipItem(cPick) endif endif b = false else if !iM Debug.Notification("ERROR - Slot Mask value not listed.") b = false endif endif endwhile if next Debug.Notification("Next entry") RegisterForSingleUpdate(0.0) else iTemp = aTemp.Length Debug.Notification("Finished Registering") Update = false Reg = false endifEndFunction Event OnUpdate() if Reg && !Init Debug.Notification("Register") Register() else if Update Debug.Notification("All items should be re-added.") Init = false TempCont.RemoveAllItems(Game.GetPlayer()) RemoveInventoryEventFilter(None) else if cfgqst.LimitArmorEnabled AddInventoryEventFilter(ArmorClothing) AddInventoryEventFilter(ArmorLight) AddInventoryEventFilter(ArmorHeavy) Debug.Notification("Limit Armor Initialized.") else RemoveInventoryEventFilter(ArmorClothing) RemoveInventoryEventFilter(ArmorLight) RemoveInventoryEventFilter(ArmorHeavy) endif if cfgqst.LimitWeaponEnabled AddInventoryEventFilter(WeapTypeBattleaxe) AddInventoryEventFilter(WeapTypeGreatsword) AddInventoryEventFilter(WeapTypeWarhammer) AddInventoryEventFilter(WeapTypeStaff) AddInventoryEventFilter(WeapTypeBow) AddInventoryEventFilter(WeapTypeMace) AddInventoryEventFilter(WeapTypeDagger) AddInventoryEventFilter(WeapTypeWarAxe) AddInventoryEventFilter(WeapTypeSword) Debug.Notification("Limit Weapon Initialized.") else RemoveInventoryEventFilter(WeapTypeBattleaxe) RemoveInventoryEventFilter(WeapTypeGreatsword) RemoveInventoryEventFilter(WeapTypeWarhammer) RemoveInventoryEventFilter(WeapTypeStaff) RemoveInventoryEventFilter(WeapTypeBow) RemoveInventoryEventFilter(WeapTypeMace) RemoveInventoryEventFilter(WeapTypeDagger) RemoveInventoryEventFilter(WeapTypeWarAxe) RemoveInventoryEventFilter(WeapTypeSword) endif if cfgqst.LimitShieldEnabled AddInventoryEventFilter(ArmorShield) Debug.Notification("Limit Shield Initialized.") else RemoveInventoryEventFilter(ArmorShield) endif if (!cfgqst.LimitArmorEnabled && !cfgqst.LimitWeaponEnabled && !cfgqst.LimitShieldEnabled) AddInventoryEventFilter(None) Debug.Notification("Empty Filter enabled.") else Init = true Update = true Armor a = None Bool b = true Int i = SlotMasks.Length while b i -= 1 a = Game.GetPlayer().GetWornForm(SlotMasks) as Armor if a iArmor = a else iArmor = none endif if !i b = false endif endwhile rWep = Game.GetPlayer().GetEquippedWeapon(abLeftHand = false) lWep = Game.GetPlayer().GetEquippedWeapon(abLeftHand = true) Game.GetPlayer().RemoveAllItems(TempCont) RegisterForSingleUpdate(1.0) Debug.Notification("Right Weapon is "+rWep.GetName()) Debug.Notification("Left Weapon is "+lWep.GetName()) endif endif endif EndEvent Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) if akBaseItem as Armor aPick = akBaseItem as Armor endif Int sM = aPick.GetSlotMask() if (cfgqst.LimitArmorEnabled || cfgqst.LimitWeaponEnabled || cfgqst.LimitShieldEnabled) && !akBaseItem.HasKeyword(ArmorJewelry) && sM if iTemp && akBaseItem as Armor iTemp -= 1 aTemp[iTemp] = akBaseItem as Armor cTemp[iTemp] = aiItemCount elseif iTemp && akBaseItem as Weapon iTemp -= 1 wTemp[iTemp] = akBaseItem as Weapon cTemp[iTemp] = aiItemCount endif Reg = true if Update RegisterForSingleUpdate(1.0) else RegisterForSingleUpdate(0.1) endif Debug.Notification("Registered Update") endifEndEvent Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference) if !akBaseObject.HasKeyword(ArmorJewelry) && !Break && !Reg && !Update && (cfgqst.LimitArmorEnabled || cfgqst.LimitShieldEnabled) Bool aT Bool sT if akBaseObject as Armor cPick = akBaseObject as Armor endif if !cPick.HasKeyword(ArmorShield) aT = true elseif cPick.HasKeyword(ArmorShield) sT = true endif if (cfgqst.LimitArmorEnabled && (aT && !sT)) || (cfgqst.LimitShieldEnabled && (sT && !aT)) Bool b = true Int iM = SlotMasks.Length iMask = cPick.GetSlotMask() while b && iMask > 0 iM -= 1 if iMask == SlotMasks[iM] if iArmor[iM] Game.GetPlayer().DropObject(akBaseObject, 1) iArmor[iM] = none b = false Debug.Notification("Unregistered "+akBaseObject.GetName()) endif endif if !iM b = false endif endwhile endif endifEndEvent Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)if cfgqst.BreakEnabled && !Breakif akAggressor && !akProjectile && !abHitBlocked && !abBashAttackWeapon w = (akAggressor as Actor).GetEquippedWeapon(0)Int wt = w.GetWeaponType()if (w && (w == (akSource as weapon)) && (wt>0) && (wt<7)) || !cfgqst.IsHumanoid(akAggressor as Actor) if cfgqst.IsSpecial(akAggressor as Actor) Special = true endif Break = true BreakArmor()endifendifendifEndEvent nSky_configquest Scriptname nSky_configquest extends ski_configbaseEvent OnConfigInit()Int iBool b = ModEnabledif bModEnabled = EnableMod(false)endifif bModEnabled = EnableMod(true)endifEndEventBool Property ModEnabled AutoBool Property LimitArmorEnabled AutoBool Property LimitWeaponEnabled AutoBool Property LimitShieldEnabled AutoBool Property BreakEnabled AutoQuest Property nSkyQuest AutonSky_playeralias Property plal AutoInt ModEnabledOID_BInt LimitArmorEnabledOID_BInt LimitWeaponEnabledOID_BInt LimitShieldEnabledOID_BInt BreakEnabledOID_Bint BreakClothingOID_Sint BreakLightOID_Sint BreakHeavyOID_Sint BreakIronOID_Sint BreakLeatherOID_Sint BreakHideOID_Sint BreakSteelOID_Sint BreakSteelPlateOID_Sint BreakEbonyOID_Sint BreakElvenOID_Sint BreakGlassOID_Sint BreakDragonscaleOID_Sint BreakDragonplateOID_Sint BreakDwarvenOID_Sint BreakFalmerOID_Sint BreakScaledOID_Sint BreakOrcishOID_Sint BreakDaedricOID_Sint BreakOtherOID_Sint BreakSpecialOID_Sint BreakShieldOID_Sint BreakWeaponOID_SFloat[] Property BreakProb AutoRace[] Property HumanoidList AutoRace[] Property SpecialList AutoBool Function IsHumanoid(Actor akRef)if akRefRace actorrace = akRef.GetRace()int i = HumanoidList.Lengthbool b = falsewhile i && !bi -= 1b = (actorrace == HumanoidList)endwhilereturn belsereturn falseendifEndFunctionBool Function IsSpecial(Actor akRef)if akRefRace actorrace = akRef.GetRace()int i = SpecialList.Lengthbool b = falsewhile i && !bi -= 1b = (actorrace == SpecialList)endwhilereturn belsereturn falseendifEndFunctionBool Function EnableMod(Bool value = true)Bool b = falseInt stg = nSkyQuest.GetStage()if valueif LimitArmorEnabledLimitArmorEnabled = EnableLimitArmor(true)endifif LimitWeaponEnabledLimitArmorEnabled = EnableLimitWeapon(true)endifif LimitShieldEnabledLimitArmorEnabled = EnableLimitShield(true)endifif BreakEnabledBreakEnabled = EnableBreak(true)endifif stg != 10nSkyQuest.Start()b = trueendifelseif LimitArmorEnabledEnableLimitArmor(false)endifif LimitWeaponEnabledEnableLimitWeapon(false)endifif LimitShieldEnabledEnableLimitShield(false)endifif BreakEnabledEnableBreak(false)endifif stg == 10nSkyQuest.SetStage(1000)b = trueendifendifEndFunctionBool Function EnableLimitArmor(Bool value)if valueLimitArmorEnabled = trueelseLimitArmorEnabled = falseendifplal.RegisterForSingleUpdate(0.0)EndFunctionBool Function EnableLimitWeapon(Bool value)if valueLimitWeaponEnabled = trueelseLimitWeaponEnabled = falseendifplal.RegisterForSingleUpdate(0.0)EndFunctionBool Function EnableLimitShield(Bool value)if valueLimitShieldEnabled = trueelseLimitShieldEnabled = falseendifplal.RegisterForSingleUpdate(0.0)EndFunctionBool Function EnableBreak(Bool value)if valueBreakEnabled = trueelseBreakEnabled = falseendifplal.RegisterForSingleUpdate(0.0)EndFunctionEvent OnPageReset(String page)SetCursorFillMode(TOP_TO_BOTTOM)SetCursorPosition(0)AddHeaderOption("Features")ModEnabledOID_B = AddToggleOption("Mod Enabled", ModEnabled)LimitArmorEnabledOID_B = AddToggleOption("Limit Armor", LimitArmorEnabled)LimitWeaponEnabledOID_B = AddToggleOption("Limit Weapon", LimitWeaponEnabled)LimitShieldEnabledOID_B = AddToggleOption("Limit Shield", LimitShieldEnabled)BreakEnabledOID_B = AddToggleOption("Equipment Break", BreakEnabled)AddHeaderOption("Armor Type Breaking Probability")BreakClothingOID_S = AddSliderOption("Break Clothing", BreakProb[1], "{0}%")BreakLightOID_S = AddSliderOption("Break Light", BreakProb[2], "{0}%")BreakHeavyOID_S = AddSliderOption("Break Heavy", BreakProb[3], "{0}%")AddHeaderOption("Weapon Breaking Probability")BreakWeaponOID_S = AddSliderOption("Break Weapon", BreakProb[21], "{0}%")AddHeaderOption("Shield Breaking Probability")BreakShieldOID_S = AddSliderOption("Break Shield", BreakProb[22], "{0}%")AddHeaderOption("Special Enemy Add Probability")BreakSpecialOID_S = AddSliderOption("Special Enemy", BreakProb[20], "{0}%")SetCursorPosition(1)AddHeaderOption("Material Type Breaking Probability")BreakIronOID_S = AddSliderOption("Break Iron", BreakProb[4], "{0}%")BreakLeatherOID_S = AddSliderOption("Break Leather", BreakProb[5], "{0}%")BreakHideOID_S = AddSliderOption("Break Hide", BreakProb[6], "{0}%")BreakSteelOID_S = AddSliderOption("Break Steel", BreakProb[7], "{0}%")BreakSteelPlateOID_S = AddSliderOption("Break SteelPlate", BreakProb[8], "{0}%")BreakEbonyOID_S = AddSliderOption("Break Ebony", BreakProb[9], "{0}%")BreakElvenOID_S = AddSliderOption("Break Elven", BreakProb[10], "{0}%")BreakGlassOID_S = AddSliderOption("Break Glass", BreakProb[11], "{0}%")BreakDragonscaleOID_S = AddSliderOption("Break Dragonscale", BreakProb[12], "{0}%")BreakDragonplateOID_S = AddSliderOption("Break Dragonplate", BreakProb[13], "{0}%")BreakDwarvenOID_S = AddSliderOption("Break Dwarven", BreakProb[14], "{0}%")BreakFalmerOID_S = AddSliderOption("Break Falmer", BreakProb[15], "{0}%")BreakScaledOID_S = AddSliderOption("Break Scaled", BreakProb[16], "{0}%")BreakOrcishOID_S = AddSliderOption("Break Orcish", BreakProb[17], "{0}%")BreakDaedricOID_S = AddSliderOption("Break Daedric", BreakProb[18], "{0}%")BreakOtherOID_S = AddSliderOption("Break Other", BreakProb[0], "{0}%")EndEventEvent OnOptionSliderOpen(Int option)if (option == BreakOtherOID_S)SetSliderDialogStartValue(BreakProb[0])SetSliderDialogDefaultValue(100.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakClothingOID_S)SetSliderDialogStartValue(BreakProb[1])SetSliderDialogDefaultValue(100.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakLightOID_S)SetSliderDialogStartValue(BreakProb[2])SetSliderDialogDefaultValue(50.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakHeavyOID_S)SetSliderDialogStartValue(BreakProb[3])SetSliderDialogDefaultValue(25.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakIronOID_S)SetSliderDialogStartValue(BreakProb[4])SetSliderDialogDefaultValue(60.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakLeatherOID_S)SetSliderDialogStartValue(BreakProb[5])SetSliderDialogDefaultValue(80.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakHideOID_S)SetSliderDialogStartValue(BreakProb[6])SetSliderDialogDefaultValue(90.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakSteelOID_S)SetSliderDialogStartValue(BreakProb[7])SetSliderDialogDefaultValue(40.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakSteelPlateOID_S)SetSliderDialogStartValue(BreakProb[8])SetSliderDialogDefaultValue(20.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakEbonyOID_S)SetSliderDialogStartValue(BreakProb[9])SetSliderDialogDefaultValue(10.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakElvenOID_S)SetSliderDialogStartValue(BreakProb[10])SetSliderDialogDefaultValue(50.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakGlassOID_S)SetSliderDialogStartValue(BreakProb[11])SetSliderDialogDefaultValue(40.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakDragonscaleOID_S)SetSliderDialogStartValue(BreakProb[12])SetSliderDialogDefaultValue(0.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakDragonplateOID_S)SetSliderDialogStartValue(BreakProb[13])SetSliderDialogDefaultValue(0.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakDwarvenOID_S)SetSliderDialogStartValue(BreakProb[14])SetSliderDialogDefaultValue(30.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakFalmerOID_S)SetSliderDialogStartValue(BreakProb[15])SetSliderDialogDefaultValue(50.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakScaledOID_S)SetSliderDialogStartValue(BreakProb[16])SetSliderDialogDefaultValue(30.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakOrcishOID_S)SetSliderDialogStartValue(BreakProb[17])SetSliderDialogDefaultValue(20.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakDaedricOID_S)SetSliderDialogStartValue(BreakProb[18])SetSliderDialogDefaultValue(0.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakSpecialOID_S)SetSliderDialogStartValue(BreakProb[20])SetSliderDialogDefaultValue(50.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakWeaponOID_S)SetSliderDialogStartValue(BreakProb[21])SetSliderDialogDefaultValue(0.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)elseif (option == BreakShieldOID_S)SetSliderDialogStartValue(BreakProb[22])SetSliderDialogDefaultValue(0.0)SetSliderDialogRange(0.0, 100.0)SetSliderDialogInterval(1.0)endifEndEventEvent OnOptionSliderAccept(Int option, Float value)if (option == BreakOtherOID_S)BreakProb[0] = valueSetSliderOptionValue(BreakOtherOID_S, BreakProb[0], "{0}%")elseif (option == BreakClothingOID_S)BreakProb[1] = valueSetSliderOptionValue(BreakClothingOID_S, BreakProb[1], "{0}%")elseif (option == BreakLightOID_S)BreakProb[2] = valueSetSliderOptionValue(BreakLightOID_S, BreakProb[2], "{0}%")elseif (option == BreakHeavyOID_S)BreakProb[3] = valueSetSliderOptionValue(BreakHeavyOID_S, BreakProb[3], "{0}%")elseif (option == BreakIronOID_S)BreakProb[4] = valueSetSliderOptionValue(BreakIronOID_S, BreakProb[4], "{0}%")elseif (option == BreakLeatherOID_S)BreakProb[5] = valueSetSliderOptionValue(BreakLeatherOID_S, BreakProb[5], "{0}%")elseif (option == BreakHideOID_S)BreakProb[6] = valueSetSliderOptionValue(BreakHideOID_S, BreakProb[6], "{0}%")elseif (option == BreakSteelOID_S)BreakProb[7] = valueSetSliderOptionValue(BreakSteelOID_S, BreakProb[7], "{0}%")elseif (option == BreakSteelPlateOID_S)BreakProb[8] = valueSetSliderOptionValue(BreakSteelPlateOID_S, BreakProb[8], "{0}%")elseif (option == BreakEbonyOID_S)BreakProb[9] = valueSetSliderOptionValue(BreakEbonyOID_S, BreakProb[9], "{0}%")elseif (option == BreakElvenOID_S)BreakProb[10] = valueSetSliderOptionValue(BreakElvenOID_S, BreakProb[10], "{0}%")elseif (option == BreakGlassOID_S)BreakProb[11] = valueSetSliderOptionValue(BreakGlassOID_S, BreakProb[11], "{0}%")elseif (option == BreakDragonscaleOID_S)BreakProb[12] = valueSetSliderOptionValue(BreakDragonscaleOID_S, BreakProb[12], "{0}%")elseif (option == BreakDragonplateOID_S)BreakProb[13] = valueSetSliderOptionValue(BreakDragonplateOID_S, BreakProb[13], "{0}%")elseif (option == BreakDwarvenOID_S)BreakProb[14] = valueSetSliderOptionValue(BreakDwarvenOID_S, BreakProb[14], "{0}%")elseif (option == BreakFalmerOID_S)BreakProb[15] = valueSetSliderOptionValue(BreakFalmerOID_S, BreakProb[15], "{0}%")elseif (option == BreakScaledOID_S)BreakProb[16] = valueSetSliderOptionValue(BreakScaledOID_S, BreakProb[16], "{0}%")elseif (option == BreakOrcishOID_S)BreakProb[17] = valueSetSliderOptionValue(BreakOrcishOID_S, BreakProb[17], "{0}%")elseif (option == BreakDaedricOID_S)BreakProb[18] = valueSetSliderOptionValue(BreakDaedricOID_S, BreakProb[18], "{0}%")elseif (option == BreakSpecialOID_S)BreakProb[20] = valueSetSliderOptionValue(BreakSpecialOID_S, BreakProb[20], "{0}%")elseif (option == BreakWeaponOID_S)BreakProb[21] = valueSetSliderOptionValue(BreakWeaponOID_S, BreakProb[21], "{0}%")elseif (option == BreakShieldOID_S)BreakProb[22] = valueSetSliderOptionValue(BreakShieldOID_S, BreakProb[22], "{0}%")endifEndEventEvent OnOptionSelect(Int option)if (option == ModEnabledOID_B)ModEnabled = !ModEnabledSetToggleOptionValue(ModEnabledOID_B, ModEnabled)EnableMod(ModEnabled)elseif (option == LimitArmorEnabledOID_B)LimitArmorEnabled = !LimitArmorEnabledSetToggleOptionValue(LimitArmorEnabledOID_B, LimitArmorEnabled)if ModEnabledEnableLimitArmor(LimitArmorEnabled)endifelseif (option == LimitWeaponEnabledOID_B)LimitWeaponEnabled = !LimitWeaponEnabledSetToggleOptionValue(LimitWeaponEnabledOID_B, LimitWeaponEnabled)if ModEnabledEnableLimitWeapon(LimitWeaponEnabled)endifelseif (option == LimitShieldEnabledOID_B)LimitShieldEnabled = !LimitShieldEnabledSetToggleOptionValue(LimitShieldEnabledOID_B, LimitShieldEnabled)if ModEnabledEnableLimitShield(LimitShieldEnabled)endifelseif (option == BreakEnabledOID_B)BreakEnabled = !BreakEnabledSetToggleOptionValue(BreakEnabledOID_B, BreakEnabled)if ModEnabledEnableBreak(BreakEnabled)endifendifEndEvent Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 28, 2017 Share Posted May 28, 2017 Maybe you need to actually have an amount of time before the update takes place. You are registering for a time of 0.0 (line 201) which means that the current thread running the Register function may still be running when the OnUpdate event sends another thread to run the Register function. Just a guess, I don't really know. Link to comment Share on other sites More sharing options...
Rebual Posted May 28, 2017 Author Share Posted May 28, 2017 Thanks for your reply, but the register for update time of 0.0 is actually intended for to go through the temporary array of added items without any delay and works just fine. I think after going through the papyrus logs the problem has to be inside the temp array, somehow it is messing up entries on the OnItemAdded Event. These are the last lines on the log: stack:[alias nSkyPlayerAlias on quest nSkyQuest (7B000D62)].nsky_playeralias.Register() - "nSky_playeralias.psc" Line 133[alias nSkyPlayerAlias on quest nSkyQuest (7B000D62)].nsky_playeralias.OnUpdate() - "nSky_playeralias.psc" Line 215[05/28/2017 - 08:28:07PM] warning: Assigning None to a non-object variable named "::temp17"stack:[alias nSkyPlayerAlias on quest nSkyQuest (7B000D62)].nsky_playeralias.Register() - "nSky_playeralias.psc" Line 133[alias nSkyPlayerAlias on quest nSkyQuest (7B000D62)].nsky_playeralias.OnUpdate() - "nSky_playeralias.psc" Line 215[05/28/2017 - 08:28:15PM] Error: Static function LogicalAnd not found on object Math. Aborting call and returning None Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 28, 2017 Share Posted May 28, 2017 I see a possible problem. In your MessageBox line just inside the Register function you have at the very end a set of entries for an index 10. However, you assigned the array to 10 entries rather than 11. 9 is the highest index for a 10 entry array. This is because arrays start at 0 rather than 1. Remove that last set and it might be okay. Or you can change it to the following to let it build the message text on the fly: String MessageText = "" Int entry = 0 While entry < aTemp.Length MessageText += entry+" - "+aTemp[entry].GetName()+" "+cTemp[entry]+" ; " entry += 1 EndWhile Debug.MessageBox(MessageText) Not sure if that will solve the issue as the papyrus log says there is an issue with LogicalAnd. To possibly resolve that you might want to go through some of your condition statements and wraps things in (). I could see papyrus having an issue with something like X && Y != Z Link to comment Share on other sites More sharing options...
Rebual Posted May 29, 2017 Author Share Posted May 29, 2017 Oh, that's why the last two entries always showed the same, thanks for pointing that out! I didn't thought about that when reducing the temp array length to 10 for testing purposes.Anyway, I have tested everything again with a new save game and it is working now when re-enabling any features. Might be my own stupidity for not taking that in mind when changing stuff in the script.But it is weird, because the alias script is attached to a quest and gets shut down when I disable the mod. So it really shouldn't matter if I change things at least for the alias script, but seems like the engine doesn't like too many changes. Link to comment Share on other sites More sharing options...
Recommended Posts