The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Shinami on August 23, 2010, 08:27:51 PM

Title: [VX]Item system issue
Post by: Shinami on August 23, 2010, 08:27:51 PM
I want to create an item system where all items, equipment, and such are stand alone objects with their own levels of quality that only use the databases as templates for item creation. I've successfully gotten the majority of the work done but one issue remains. The script will not stop pointing to the database. That means my inventory of potions could look like this for a little while:

Name     Quality of item
Potion           :15
Potion           :15
Long Sword   :21

And then when I pick up another Potion, it changes to something like this:

Name     Quality of item
Potion           :38
Potion           :38
Potion           :38
Long Sword   :21


As you can see, all items are still pointing to the databases. I know this because when the variable containing the item data is outputted, I'll see several potion entries in it with the same <RPG:Item0x123b34> hash-like information displayed before the rest of the object's information.

Anyone got any ideas on what I can do? =/
Title: Re: [VX]Item system issue
Post by: modern algebra on August 23, 2010, 11:18:11 PM
Hmm, well I took on a project like this some time ago; I wrote it as a base script, since I had intended to make a durability and socketing script later. I finished it, but I never finished the durability or socketing so I never released it. I can look for it and share that if you want.

I believe what I had done was create a new hash that held every new item that was created and saved it in the save files. I made a new Game_Weapon, Game_Armor, etc... class so that each time a new item is given, one of those are created and it is saved in the hash, and when you accessed the id of that object, it would point to its position in the hash, rather than its database ID. I think that was basically how it worked. I could release the Instance Items Base script if you want, and you could look at it and maybe get some ideas. I don't know if how I did it was the best way or not though.
Title: Re: [VX]Item system issue
Post by: Shinami on August 24, 2010, 06:41:16 AM
You mentioning "new instances"...I can't believe I didn't realize that. XD *cracks knuckles* Time to get down to business! *munches a poptart and pounds keys*