Do you have to have the Infinite flag marked on your items.
When My computer crashed awhile back I was messing with making a player store system. Lost most of my code and have not gotten back into it full strength yet. Never had any infinite items in them, so am not cretin as to the problems you are running into.
the.gray.fox wrote...
Once DestroyObject() has destroyed an item, _all_ info about that item are permanently lost.
Yes once an object is destroyed it can not be accessed. How ever the DestroyObject is a delayed command. So the object should not be destroyed until after the current script finishes, Even at a delay of 0.0f. If it is somehow getting destroyed with the 0.0f delay just increase the delay a little to make sure it sticks around until you are done with it.
There is no need to check for an open store. If the store is receiving an item and the OnUnquire Event is running some has to have it open. unless of course you are moving items to the store from a storage creature via ActionCommands.
When I did my player store test runs i was using a test against the tag of the store. Like this.
object oItem = GetModuleItemAcquired();
if (GetTag(GetModuleItemAcquiredFrom())=="PS_STORE_001")
SendMessageToPC(GetFirstPC(),"Received Item From Player Store");
It would be just as easy to hook all items Taken by the store this way.
object oItem = GetModuleItemAcquired();
if (GetObjectType(GetModuleItemAcquiredFrom())==OBJECT_TYPE_STORE)
SendMessageToPC(GetFirstPC(),"Received Item From a Store");
For Items sold to the store with a tag check I used:
object oItem = GetModuleItemLost();
if (GetTag(GetItemPossessor( oItem ))== "PS_STORE_001")
SendMessageToPC(GetFirstPC(),"Sold Item To Player Store");
Again for a hook of all stores just as easy.(lol, I may say easy but it took me a long time to work it out.
object oItem = GetModuleItemLost();
if ( GetObjectType(GetItemPossessor( oItem ))== OBJECT_TYPE_STORE)
SendMessageToPC(GetFirstPC(),"Sold Item To a Store");
If you wanted to have infinite Items in the store without having the inifinite flag set you could just recreate them if they where bought from the store.
In short if you wanted infinite items without having to set the Flag you could just add the item back into the store if it was ever bought. (keep in mind however that stackable items also have a mind of there own. If they get stacked with other items of there type they talk on the vars of the item they where stacked with. and lose there own. I also do not know if the Event even fires if a new stack is not created on the PC). So for inifinite nonstackable items.
object oItem = GetModuleItemAcquired();
object oStore= GetModuleItemAcquiredFrom();
if (GetObjectType(oStore)==OBJECT_TYPE_STORE)
{
if (GetLocalInt(oItem,"inifinite"))
{
object oNewItem=CopyItem(oItem,oStore,TRUE);
DeleteLocalInt(oItem,"inifinite");
}
}
Modifié par Lightfoot8, 26 juillet 2010 - 09:24 .