Failing to extract items properties
TheThird
Member Posts: 4
Hello!
Some context: I am scripting an item rating calculator for a low magic server so we can remove items deemed too powerful from the loot tables (all in DB). Now, I have been trying to figure out a way to extract item properties for a week and I am still no closer to a solution.
I have resorted to the nwnx:ee libraries (hoping someone have some ideas). The code below is a simple script that should in theory extract items properties using nwnx:ee function and put them in the chat, but they all return 0 no matter what. I am using that script on a chest event disturbed.
Here is the link to the Item Property Function I am trying to use
I was not too familiar with struct before but after some research and reading I think I am using it as it should. Anything obvious I might have missed ?
PS: I did try to extract the properties using the more standard Get2DAStringand GetItemProperty methods and got some results, but the documentation around all it is a nightmare. If anyone has any pointer in that matter I would also be interested.
Thanks !!
Some context: I am scripting an item rating calculator for a low magic server so we can remove items deemed too powerful from the loot tables (all in DB). Now, I have been trying to figure out a way to extract item properties for a week and I am still no closer to a solution.
I have resorted to the nwnx:ee libraries (hoping someone have some ideas). The code below is a simple script that should in theory extract items properties using nwnx:ee function and put them in the chat, but they all return 0 no matter what. I am using that script on a chest event disturbed.
Here is the link to the Item Property Function I am trying to use
I was not too familiar with struct before but after some research and reading I think I am using it as it should. Anything obvious I might have missed ?
PS: I did try to extract the properties using the more standard Get2DAStringand GetItemProperty methods and got some results, but the documentation around all it is a nightmare. If anyone has any pointer in that matter I would also be interested.
#include "nwnx_itemprop" void main() { object oPlayer = GetLastUsedBy(); object oItem = GetFirstItemInInventory(OBJECT_SELF); itemproperty ipLoop = GetFirstItemProperty(oItem); if (GetInventoryDisturbType() == INVENTORY_DISTURB_TYPE_ADDED) { struct NWNX_IPUnpacked n = NWNX_ItemProperty_UnpackIP(ipLoop); while(GetIsItemPropertyValid(ipLoop)) { struct NWNX_IPUnpacked n = NWNX_ItemProperty_UnpackIP(ipLoop); SendMessageToPC(oPlayer, "-----"); SendMessageToPC(oPlayer, "sID:"+n.sID+""); SendMessageToPC(oPlayer, "nProperty: "+IntToString(n.nProperty)+""); SendMessageToPC(oPlayer, "nSubType: "+IntToString(n.nSubType)+""); SendMessageToPC(oPlayer, "nCostTable: "+IntToString(n.nCostTable)+""); SendMessageToPC(oPlayer, "nCostTableValue: "+IntToString(n.nCostTableValue)+""); SendMessageToPC(oPlayer, "nParam1: "+IntToString(n.nParam1)+""); SendMessageToPC(oPlayer, "nParam1Value: "+IntToString(n.nParam1Value)+""); ipLoop = GetNextItemProperty(oItem); } } }
Thanks !!
0
Comments
https://forums.beamdog.com/discussion/comment/1117101/#Comment_1117101
I had some issues using it at first (doesn't seem to work without small modifications) but now it does like a charm.