Checking If An Item Is Equipable
I'm making a tag based scripting widget that checks if an item is equipable (and meets level requirements in a scripted item level restriction system). In this case, the widget only works when clicking on items in a player inventory.
My script checks for base item types that are able to be equipped by the player. The problem is that it always returns as FALSE—no matter which inventory item the widget is used on (equipable or not).
The check relies on a big GetBaseItemType conditional that apparently isn't working.
The script that's not working correctly (script name - j_ilrchecker): https://pastebin.com/igfhRXUP
An include used for the above script (name - j_inc_itemlvl): https://pastebin.com/x1gMLKFz
Widget item tag name: "j_ilrchecker" with Cast Spell: Unique Power (Unlimited Uses/Day)
Any help will be appreciated, especially alternate ways to check if an item can be equipped in an inventory slot.
Thanks
My script checks for base item types that are able to be equipped by the player. The problem is that it always returns as FALSE—no matter which inventory item the widget is used on (equipable or not).
The check relies on a big GetBaseItemType conditional that apparently isn't working.
The script that's not working correctly (script name - j_ilrchecker): https://pastebin.com/igfhRXUP
An include used for the above script (name - j_inc_itemlvl): https://pastebin.com/x1gMLKFz
Widget item tag name: "j_ilrchecker" with Cast Spell: Unique Power (Unlimited Uses/Day)
Any help will be appreciated, especially alternate ways to check if an item can be equipped in an inventory slot.
Thanks
0
Comments
That part will never work!
Should be something like
int nBaseItemType = GetBaseItemType(oTarget); if ((nBaseItemType != BASE_ITEM_AMULET) && (nBaseItemType!=BASE_ITEM_ARMOR) && ...) { ...or at least
I however would probably write something like:
switch (GetBaseItemType(oTarget)) { case BASE_ITEM_AMULET: case BASE_ITEM_ARMOR: case ... return TRUE; break; } return FALSE;int GetEquippable(object oTarget) { return (Get2DAString("baseitem","EquipableSlots", GetBaseItemType(oTarget)) != "0x00000"); }I tried your Get2DAString method. It would have been easier, but it returned TRUE for all items, not just equippable ones (in my initial test).
Thanks again!
int GetEquippable(object oTarget) { return (Get2DAString("baseitems","EquipableSlots", GetBaseItemType(oTarget)) != "0x00000"); }It's some nwscript sorcery. Nice work!