Hello, I'm completely new to Quest and I do not know much about coding so I only use the (rather superb) GUI.
I just thought I post my way of combining objects into stacks and see if anybody can either use it or even better (for me) tell me how my system can be improved or if it contains any errors or cases I haven't foreseen.
I basically just modified the "take", "drop", "removefrom" and "put" commands as well as the "DoTake" and "DoDrop" functions so that if you use them objects will stack as long as you give them the appropriate attributes as explained in the file attached to this post (there is a "help" command explaining how to set up stackable objects).
I did not use a turn script for my system since I wanted the player to be able to divide stackable objects into seperate stacks and with a turn script they would be combined again right after the player splits them.
How to split and combine objects into stacks is pretty self-explanatory I believe.
The following is purposely set up this way since it seemed to be the most logical to me:
Objects stack if the player:
- picks up an object and already has one of its kind in his inventory
- removes an object from a container and already has one of its kind in his inventory (technically the same as taking the object out of the container)
- drops an object and one of its kind is already on the floor
- puts an objects to a place where another one of its kind is already located
Objects do not stack if the player:
- picks up an object and has one of its kind in the inventory, but in a container (i.e. a bag)
- drops an object and one of its kind is in the room, but in a container (i.e. a chest)
- picks up a container which contains another object (i.e. a small bag contains a potion, you pick up the small bag)
Complex cases:
- putting an object inside a container which itself is inside a container and one of the containers contains an object of the same kind (i.e. a small bag contains a potion, the small bag is inside a large bag)
- if you put a potion inside the large bag, then it will not stack with the potion in the small bag
- if, one the other hand, you put the potion in the small bag, then it will stack
I apologize for any grammatical shortcomings, but English is not my mother language. The programming is still in English though so that shouldn't be a problem.