Siegh
Thronar Developer
So, I have this in one of my weapons scripts which is supposed to check whether you have a certain necklace equipped and, if yes, you gain 1 soul. It works fine, but it returns an error on my console if I don't have any necklace equipped.
I have looked up previous questions and I found this fix here, which works in some contexts, but I'm not being able to modify it to still allow the script to work even if you don't have enything equipped in the slot.
I'm pretty sure there is a very simple solution to this which I'm oversighting, help please!
Code:
if player:getSlotItem(CONST_SLOT_NECKLACE).itemid == 2131 then
player:addSoul(1)
end
I have looked up previous questions and I found this fix here, which works in some contexts, but I'm not being able to modify it to still allow the script to work even if you don't have enything equipped in the slot.
Code:
if not player:getSlotItem(CONST_SLOT_NECKLACE) then
return false
I'm pretty sure there is a very simple solution to this which I'm oversighting, help please!