Jump to content

[Papyrus] Script Function stops working


Rebual

Recommended Posts

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 Auto
Keyword Property ArmorLight Auto
Keyword Property ArmorHeavy Auto
Keyword Property ArmorShield Auto
Keyword Property ArmorJewelry Auto
Keyword Property ArmorMaterialIron Auto
Keyword Property ArmorMaterialLeather Auto
Keyword Property ArmorMaterialHide Auto
Keyword Property ArmorMaterialSteel Auto
Keyword Property ArmorMaterialSteelPlate Auto
Keyword Property ArmorMaterialEbony Auto
Keyword Property ArmorMaterialElven Auto
Keyword Property ArmorMaterialGlass Auto
Keyword Property ArmorMaterialDragonscale Auto
Keyword Property ArmorMaterialDragonplate Auto
Keyword Property ArmorMaterialDwarven Auto
Keyword Property ArmorMaterialFalmer Auto
Keyword Property ArmorMaterialScaled Auto
Keyword Property ArmorMaterialOrcish Auto
Keyword Property ArmorMaterialDaedric Auto
Keyword Property WeapTypeBattleaxe Auto
Keyword Property WeapTypeGreatsword Auto
Keyword Property WeapTypeWarhammer Auto
Keyword Property WeapTypeStaff Auto
Keyword Property WeapTypeBow Auto
Keyword Property WeapTypeMace Auto
Keyword Property WeapTypeDagger Auto
Keyword Property WeapTypeWarAxe Auto
Keyword Property WeapTypeSword Auto
nSky_configquest Property cfgqst Auto
ObjectReference Property TempCont Auto
Bool Reg
Bool Init
Bool Update
Bool Special
Bool Break
Int iCount
Int iMask
Int iTemp
Int[] cTemp
Int[] Property SlotMasks Auto
Armor aPick
Armor cPick
Armor[] aTemp
Armor[] iArmor
Weapon[] wTemp
Weapon lWep
Weapon rWep
Weapon 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 probT
Float probM
Float probS = cfgqst.BreakProb[20]
Form a = none
Int i = SlotMasks.Length
while i
i -= 1
a = 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
endif
endif
endwhile
Break = false
Special = false
EndFunction
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
endif
EndFunction
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")
endif
EndEvent
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
endif
EndEvent
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
if cfgqst.BreakEnabled && !Break
if akAggressor && !akProjectile && !abHitBlocked && !abBashAttack
Weapon 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()
endif
endif
endif
EndEvent

 

 

 

nSky_configquest

Scriptname nSky_configquest extends ski_configbase

Event OnConfigInit()
Int i
Bool b = ModEnabled
if b
ModEnabled = EnableMod(false)
endif
if b
ModEnabled = EnableMod(true)
endif
EndEvent

Bool Property ModEnabled Auto
Bool Property LimitArmorEnabled Auto
Bool Property LimitWeaponEnabled Auto
Bool Property LimitShieldEnabled Auto
Bool Property BreakEnabled Auto
Quest Property nSkyQuest Auto
nSky_playeralias Property plal Auto
Int ModEnabledOID_B
Int LimitArmorEnabledOID_B
Int LimitWeaponEnabledOID_B
Int LimitShieldEnabledOID_B
Int BreakEnabledOID_B
int BreakClothingOID_S
int BreakLightOID_S
int BreakHeavyOID_S
int BreakIronOID_S
int BreakLeatherOID_S
int BreakHideOID_S
int BreakSteelOID_S
int BreakSteelPlateOID_S
int BreakEbonyOID_S
int BreakElvenOID_S
int BreakGlassOID_S
int BreakDragonscaleOID_S
int BreakDragonplateOID_S
int BreakDwarvenOID_S
int BreakFalmerOID_S
int BreakScaledOID_S
int BreakOrcishOID_S
int BreakDaedricOID_S
int BreakOtherOID_S
int BreakSpecialOID_S
int BreakShieldOID_S
int BreakWeaponOID_S
Float[] Property BreakProb Auto
Race[] Property HumanoidList Auto
Race[] Property SpecialList Auto

Bool Function IsHumanoid(Actor akRef)
if akRef
Race actorrace = akRef.GetRace()
int i = HumanoidList.Length
bool b = false
while i && !b
i -= 1
b = (actorrace == HumanoidList)
endwhile
return b
else
return false
endif
EndFunction

Bool Function IsSpecial(Actor akRef)
if akRef
Race actorrace = akRef.GetRace()
int i = SpecialList.Length
bool b = false
while i && !b
i -= 1
b = (actorrace == SpecialList)
endwhile
return b
else
return false
endif
EndFunction

Bool Function EnableMod(Bool value = true)
Bool b = false
Int stg = nSkyQuest.GetStage()
if value
if LimitArmorEnabled
LimitArmorEnabled = EnableLimitArmor(true)
endif
if LimitWeaponEnabled
LimitArmorEnabled = EnableLimitWeapon(true)
endif
if LimitShieldEnabled
LimitArmorEnabled = EnableLimitShield(true)
endif
if BreakEnabled
BreakEnabled = EnableBreak(true)
endif
if stg != 10
nSkyQuest.Start()
b = true
endif
else
if LimitArmorEnabled
EnableLimitArmor(false)
endif
if LimitWeaponEnabled
EnableLimitWeapon(false)
endif
if LimitShieldEnabled
EnableLimitShield(false)
endif
if BreakEnabled
EnableBreak(false)
endif
if stg == 10
nSkyQuest.SetStage(1000)
b = true
endif
endif
EndFunction

Bool Function EnableLimitArmor(Bool value)
if value
LimitArmorEnabled = true
else
LimitArmorEnabled = false
endif
plal.RegisterForSingleUpdate(0.0)
EndFunction

Bool Function EnableLimitWeapon(Bool value)
if value
LimitWeaponEnabled = true
else
LimitWeaponEnabled = false
endif
plal.RegisterForSingleUpdate(0.0)
EndFunction

Bool Function EnableLimitShield(Bool value)
if value
LimitShieldEnabled = true
else
LimitShieldEnabled = false
endif
plal.RegisterForSingleUpdate(0.0)
EndFunction

Bool Function EnableBreak(Bool value)
if value
BreakEnabled = true
else
BreakEnabled = false
endif
plal.RegisterForSingleUpdate(0.0)
EndFunction

Event 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}%")
EndEvent

Event 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)
endif
EndEvent

Event OnOptionSliderAccept(Int option, Float value)
if (option == BreakOtherOID_S)
BreakProb[0] = value
SetSliderOptionValue(BreakOtherOID_S, BreakProb[0], "{0}%")
elseif (option == BreakClothingOID_S)
BreakProb[1] = value
SetSliderOptionValue(BreakClothingOID_S, BreakProb[1], "{0}%")
elseif (option == BreakLightOID_S)
BreakProb[2] = value
SetSliderOptionValue(BreakLightOID_S, BreakProb[2], "{0}%")
elseif (option == BreakHeavyOID_S)
BreakProb[3] = value
SetSliderOptionValue(BreakHeavyOID_S, BreakProb[3], "{0}%")
elseif (option == BreakIronOID_S)
BreakProb[4] = value
SetSliderOptionValue(BreakIronOID_S, BreakProb[4], "{0}%")
elseif (option == BreakLeatherOID_S)
BreakProb[5] = value
SetSliderOptionValue(BreakLeatherOID_S, BreakProb[5], "{0}%")
elseif (option == BreakHideOID_S)
BreakProb[6] = value
SetSliderOptionValue(BreakHideOID_S, BreakProb[6], "{0}%")
elseif (option == BreakSteelOID_S)
BreakProb[7] = value
SetSliderOptionValue(BreakSteelOID_S, BreakProb[7], "{0}%")
elseif (option == BreakSteelPlateOID_S)
BreakProb[8] = value
SetSliderOptionValue(BreakSteelPlateOID_S, BreakProb[8], "{0}%")
elseif (option == BreakEbonyOID_S)
BreakProb[9] = value
SetSliderOptionValue(BreakEbonyOID_S, BreakProb[9], "{0}%")
elseif (option == BreakElvenOID_S)
BreakProb[10] = value
SetSliderOptionValue(BreakElvenOID_S, BreakProb[10], "{0}%")
elseif (option == BreakGlassOID_S)
BreakProb[11] = value
SetSliderOptionValue(BreakGlassOID_S, BreakProb[11], "{0}%")
elseif (option == BreakDragonscaleOID_S)
BreakProb[12] = value
SetSliderOptionValue(BreakDragonscaleOID_S, BreakProb[12], "{0}%")
elseif (option == BreakDragonplateOID_S)
BreakProb[13] = value
SetSliderOptionValue(BreakDragonplateOID_S, BreakProb[13], "{0}%")
elseif (option == BreakDwarvenOID_S)
BreakProb[14] = value
SetSliderOptionValue(BreakDwarvenOID_S, BreakProb[14], "{0}%")
elseif (option == BreakFalmerOID_S)
BreakProb[15] = value
SetSliderOptionValue(BreakFalmerOID_S, BreakProb[15], "{0}%")
elseif (option == BreakScaledOID_S)
BreakProb[16] = value
SetSliderOptionValue(BreakScaledOID_S, BreakProb[16], "{0}%")
elseif (option == BreakOrcishOID_S)
BreakProb[17] = value
SetSliderOptionValue(BreakOrcishOID_S, BreakProb[17], "{0}%")
elseif (option == BreakDaedricOID_S)
BreakProb[18] = value
SetSliderOptionValue(BreakDaedricOID_S, BreakProb[18], "{0}%")
elseif (option == BreakSpecialOID_S)
BreakProb[20] = value
SetSliderOptionValue(BreakSpecialOID_S, BreakProb[20], "{0}%")
elseif (option == BreakWeaponOID_S)
BreakProb[21] = value
SetSliderOptionValue(BreakWeaponOID_S, BreakProb[21], "{0}%")
elseif (option == BreakShieldOID_S)
BreakProb[22] = value
SetSliderOptionValue(BreakShieldOID_S, BreakProb[22], "{0}%")
endif
EndEvent

Event OnOptionSelect(Int option)
if (option == ModEnabledOID_B)
ModEnabled = !ModEnabled
SetToggleOptionValue(ModEnabledOID_B, ModEnabled)
EnableMod(ModEnabled)
elseif (option == LimitArmorEnabledOID_B)
LimitArmorEnabled = !LimitArmorEnabled
SetToggleOptionValue(LimitArmorEnabledOID_B, LimitArmorEnabled)
if ModEnabled
EnableLimitArmor(LimitArmorEnabled)
endif
elseif (option == LimitWeaponEnabledOID_B)
LimitWeaponEnabled = !LimitWeaponEnabled
SetToggleOptionValue(LimitWeaponEnabledOID_B, LimitWeaponEnabled)
if ModEnabled
EnableLimitWeapon(LimitWeaponEnabled)
endif
elseif (option == LimitShieldEnabledOID_B)
LimitShieldEnabled = !LimitShieldEnabled
SetToggleOptionValue(LimitShieldEnabledOID_B, LimitShieldEnabled)
if ModEnabled
EnableLimitShield(LimitShieldEnabled)
endif
elseif (option == BreakEnabledOID_B)
BreakEnabled = !BreakEnabled
SetToggleOptionValue(BreakEnabledOID_B, BreakEnabled)
if ModEnabled
EnableBreak(BreakEnabled)
endif
endif
EndEvent

 

Link to comment
Share on other sites

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

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

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...