I want characters to be able to pick up more than one of an item (lets say a flare) but not add the flare into their inventory (except if there is none of its kind in there) but rather to a counter, so that the inventory doesnt get clogged with a thousand flares...
Can anyoen point me in the direction of how to do this cos im clueless...
Thanks in advance
- GunRunner
ID:170295
Feb 18 2005, 1:46 am
|
|
In response to Crispy
|
|
Good advice, Crispy! Just wanted to point out one thing:
Crispy wrote: If you did this, you would easily run into the 32,000 object limit. The limit is 65535. =P |
In response to Wizkidd0123
|
|
Wizkidd0123 wrote:
The limit is 65535. =PIs that the limit a single atom can hold or is that the limit the world can hold? |
In response to Angel_Inc
|
|
It's the limit the whole world can hold.
|
In response to Angel_Inc
|
|
World/
|
In response to Crashed
|
|
Coool I never knew that.
One more question are the BYOND staff members ever going to show the HARD-CODED procs in the refrence or Guide or whatever. eg pick(list/l) I think if people knew how the build in procs really workded then we'd have a lot more gurus. :) |
Cosmetic stacking: Treat each object as a separate one, as normal (so if you have 1000 flares then there are actually 1000 flare objects in your inventory) but display them stacked, so you only see one of the flare objects. In some ways this is the easiest method, as it only requires changing the code that displays the objects.
However, you are more likely to run into object limits when using this method. Say you represented money using coin objects; so if you had 10,000 gold then you would actually have 10,000 gold objects in your inventory. If you did this, you would easily run into the 32,000 object limit.
Object-combining stacking: Treat the 1000 flares as a single flare with a "uses" or "count" variable that is set to 1000. This is a better method in many ways, but requires fundamental changes to how objects are handled. For example, you no longer delete flares after using them; you decrease their "uses" counter by 1, and if the uses counter reaches zero, THEN you delete it.
This method requires no changing of display code and makes it much less likely that you'll run into object limits. However, it is much more complicated; whenever you move an object anywhere, you have to check for similar objects and group them together into the one object.
One of the trickiest parts, logic-wise, is working out what qualifies as a "similar" object. Do you just do it by type? Sometimes that's a good method, but what if your items have quality ratings that vary from item to item? You don't want your quality 100 sword being stacked with your quality 3 sword, giving both swords a quality rating of 3. You also don't want them to stack to have a quality rating of 100, because that amounts to item duplication and is a pretty serious exploit.