Okay, new problem. Here's the full script:
ScriptName MalonnHotkeyTorchRef rShieldRef HKOneRef HKTwoRef HKThreeRef HKFourRef HKFiveRef HKSixRef HKSevenRef HKEightShort sAttackKeyShort sActivatedBegin GameMode Set rShield to Player.GetEquippedObject 13 Set HKOne to GetHotKeyItem 1 Set HKTwo to GetHotKeyItem 2 Set HKThree to GetHotKeyItem 3 Set HKFour to GetHotKeyItem 4 Set HKFive to GetHotKeyItem 5 Set HKSix to GetHotKeyItem 6 Set HKSeven to GetHotKeyItem 7 Set HKEight to GetHotKeyItem 8 Set sAttackKey to GetControl 4 If HKOne != aaaMalonnHotKeyTorch && HKTwo != aaaMalonnHotKeyTorch && HKThree != aaaMalonnHotKeyTorch && HKFour != aaaMalonnHotKeyTorch && HKFive != aaaMalonnHotKeyTorch && HKSix != aaaMalonnHotKeyTorch && HKSeven != aaaMalonnHotKeyTorch && HKEight != aaaMalonnHotKeyTorch Return Endif If (HKOne != aaaMalonnHotKeyTorch && IsControlPressed 18) || (HKTwo != aaaMalonnHotKeyTorch && IsControlPressed 19) || (HKThree != aaaMalonnHotKeyTorch && IsControlPressed 20) || (HKFour != aaaMalonnHotKeyTorch && IsControlPressed 21) || (HKFive != aaaMalonnHotKeyTorch && IsControlPressed 22) || (HKSix != aaaMalonnHotKeyTorch && IsControlPressed 23) || (HKSeven != aaaMalonnHotKeyTorch && IsControlPressed 24) || (HKEight != aaaMalonnHotKeyTorch && IsControlPressed 25) Return Elseif (IsControlPressed 18 && sActivated == 0) || (IsControlPressed 19 && sActivated == 0) || (IsControlPressed 20 && sActivated == 0) || (IsControlPressed 21 && sActivated == 0) || (IsControlPressed 22 && sActivated == 0) || (IsControlPressed 23 && sActivated == 0) || (IsControlPressed 24 && sActivated == 0) || (IsControlPressed 25 && sActivated == 0) Set sActivated to 1 If Player.IsTorchOut If Player.IsInCombat Set aaaMalonnDropLitTorches.Dropped to 1 Player.UnequipItemNS Torch02 Player.AddItemNS aaaTorchLight 1 Player.UnequipItemNS aaaMalonnHotKeyTorch Player.Drop Torch02 1 TapKey sAttackKey Else Player.UnequipItemNS Torch02 Endif Elseif Player.GetItemCount Torch02 > 0 If Player.IsShieldOut && Player.IsWeaponOut Set aaaMalonnDropLitTorches.Dropped to 1 Player.UnequipItemNS Torch02 Player.AddItemNS aaaTorchLight 1 Player.UnequipItemNS aaaMalonnHotKeyTorch Player.Drop Torch02 1 Elseif Player.IsWeaponOut If Player.GetWeaponAnimType == 2 || Player.GetWeaponAnimType == 3 Set aaaMalonnDropLitTorches.Dropped to 1 Player.UnequipItemNS Torch02 Player.AddItemNS aaaTorchLight 1 Player.UnequipItemNS aaaMalonnHotKeyTorch Player.Drop Torch02 1 Else Player.EquipItemNS Torch02 Endif Else Player.EquipItemNS Torch02 Endif Endif Elseif (IsControlPressed 18 && sActivated == 1) || (IsControlPressed 19 && sActivated == 1) || (IsControlPressed 20 && sActivated == 1) || (IsControlPressed 21 && sActivated == 1) || (IsControlPressed 22 && sActivated == 1) || (IsControlPressed 23 && sActivated == 1) || (IsControlPressed 24 && sActivated == 1) || (IsControlPressed 25 && sActivated == 1) Return Elseif (IsControlPressed 18 != 1 && sActivated == 1) || (IsControlPressed 19 != 1 && sActivated == 1) || (IsControlPressed 20 != 1 && sActivated == 1) || (IsControlPressed 21 != 1 && sActivated == 1) || (IsControlPressed 22 != 1 && sActivated == 1) || (IsControlPressed 23 != 1 && sActivated == 1) || (IsControlPressed 24 != 1 && sActivated == 1) || (IsControlPressed 25 != 1 && sActivated == 1) Set sActivated to 0 Endif If Player.GetItemCount Torch02 > 0 If Player.IsTorchOut If IsControlPressed 8 || IsControlPressed 4 If (Player.GetWeaponAnimType == 1 && Player.GetEquipped rShield == 0) Return Else Set aaaMalonnDropLitTorches.Dropped to 1 Player.UnequipItemNS Torch02 Player.AddItemNS aaaTorchLight 1 Player.UnequipItemNS aaaMalonnHotKeyTorch Player.Drop Torch02 1 Endif Endif Endif Endif DebugBreakEnd
Problem is unequipping a shield breaks the script. Everything works as I want it to if I don't unequip a shield, or if I switch shields without unequipping first.
Any ideas as to why?
EDIT:
It has to do with this script section:
Player.GetEquipped rShield == 0
If I remove that, it works almost as intended. The only problem is when I have a shield and sword equipped, the torch does not drop. But that line should not cause the script to not function correctly if you unequip the shield.
EDIT2:
I can use IsShieldOut, but the problem with that is, if you have a torch already equipped, it returns 0.