xkkmEl Posted March 24 Share Posted March 24 Why does this not work? It always returns false, even for objects that are destructible in the arcane enchanter. Keyword property MagicDisallowEnchanting Auto bool function IsCollectableWisdom( ObjectReference r) Form f = r.getBaseObject() int t = f.getType() if r.isDeleted() || r.isDisabled() return False elseif t == 26 && !f.hasKeyword( MagicDisallowEnchanting) Enchantment e = (f as Armor).getEnchantment() if !e return False elseif e.getBaseEnchantment() e = e.getBaseEnchantment() endif return !e.playerKnows() else return False endif endfunction Other branches (not shown) of the elseif cascade, testing for potions, soulgems and unread books do work as intended. It's just the unknown enchantments for armor and weapons that don't. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 25 Share Posted March 25 At what point is it failing? Is it not getting the enchantment? Is it not getting the base enchantment? Is it not determining if the player knows the base enchantment? Link to comment Share on other sites More sharing options...
xkkmEl Posted March 25 Author Share Posted March 25 Ah! Found it. Finally. The function works. There was a logic error elsewhere that prevented the function being called on the target objects (type 26 objects where in fact not being fed to the function in the circumstances that I was testing). It escaped me because there are other paths through which the same processing can occur, making it look like the function was being called. And other paths through which type 26 objects where fed in, but other conditions applied as well in those cases making them poor test targets. Thanks Ishara. Your being puzzled is what pushed me to reconsider ALL my potential failure points Link to comment Share on other sites More sharing options...
Recommended Posts