RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VX]Item system issue

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
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? =/

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
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.

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
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*