HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Retrieve Item from Game Cache?

05-20-2005, 03:14 AM#1
Ceo
I'm working on a bag system (no, I don't want to look at yours, sorry).

I've got it so it can save the items in the game cache as an integer and then destroys the item. Now I was wondering, how do you recreate the item after it has been destroyed? I know how to change it back to a handle, but what do I do with it then?
05-20-2005, 06:42 AM#2
Ceo
Solved the problem by removing the item from the hero's inventory and then hiding it until I need it again.
05-20-2005, 08:41 AM#3
SADISM
Glad you solved your problem, but just wanted to point something out. If you are saving an actual item in the game cache using its specific integer handle, that refers only to that item. If that item is destroyed, that handle effectively points to nothing (unless the game repoints something to that handle, which probably wouldn't happen).

If you wanted to go this route, I would suggest storing the integer type in game cache, then recreating an item of that type when needed.
05-20-2005, 01:48 PM#4
Anitarf
Actually, the game would repoint something else to the handle, as long as the handle' object is destroyed and no pointers (variables) point to it, the handle gets recycled.

And SADISM is right, you should just store the item-type.
05-20-2005, 02:48 PM#5
Vexorian
No, store the item's handle, since you are hiding it.

If you store the item's type the item will then lose Custom values, attached variables, handle variables, and any variable that points to it
05-20-2005, 09:16 PM#6
Anitarf
Quote:
Originally Posted by Lord Vexorian
No, store the item's handle, since you are hiding it.

If you store the item's type the item will then lose Custom values, attached variables, handle variables, and any variable that points to it
Yes, right, well, obviously, now that he's hiding it, yes. What I meant was, storing the item type would come into consideration if he destroyed it, but hiding it and storing the handle indeed is a better way to do things.
05-21-2005, 05:59 PM#7
Ceo
Thanks for the suggestions everyone.