| 05-20-2005, 03:14 AM | #1 |
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 |
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 |
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 |
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 |
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 | |
Quote:
|
| 05-21-2005, 05:59 PM | #7 |
Thanks for the suggestions everyone. |
