Having more than 1 of the same item

jnde011
11 Dec 2013, 21:36
I need some help, i have looked up a lot of tutorials and such but nothing about my problem i feel like i am missing something i need a little help. Anyways the problem is that i have an Object called stone and when i play my game i pick up the wooden pickaxe and i have to mine the stone but when i mine the stone i get the object in my inventory but when i mine a second time i don't get a second stone object i want to say something like ''Stone (2)'' I hope i can get some help and a explication to my problem so i can deal whit it in the future also, i can't figure out a way to add a status other than health and score i want to be able to sell the stone to get a status called gold like say i don't know how about 1 stone= 3 gold for starts. Please if you send me code be sure to explain it in as much detail as possible because i have no idea where to put it or type. Thanks in advance and sorry for being dumb if it's obvious. :D

george
12 Dec 2013, 07:32
There is a stackable library you could use for the stones -- viewtopic.php?f=18&t=3515 Though you'll need a script to create more stones when you mine.

I don't have time at the moment to give an example but if someone doesn't come along to help I can give this a shot later.

However as a first step I recommend you try to code a script that, whenever you mine, creates a stone and puts it in your inventory. Don't worry about how it looks or anything, just try to get the stones created.

To do this you'll want this function:

http://quest5.net/wiki/Clone

And maybe this for convenience:

http://quest5.net/wiki/CloneObjectAndMove

Good luck!

Pertex
12 Dec 2013, 10:24
As george said it's really simple to do this. I have added a stone object to a room 'junkyard' where the player will never go to just to storage it there. Then there is a rock object and if you 'mine rock' the stone object is cloned and the clone is moved to the inventory