Assistance on Creating an Item Dispenser/Spawner

SeanTrunks
I'm new on using Quest so I experimented around for a while until I came across this problem.
I was creating a dispenser that infinitely creates the same item every time the player uses it. Said dispensed item can be used on multiple objects in the game which generates different results depending on what object it is used on. Once the item is used it's deleted so in a way it's a consumable item. There's also the fact that there are multiple items in the game with the same property.

The problem with this is the fact that cloned objects have a different name, confusing the scripts thus resulting in errors.
To what I've gathered so far it seems that a cloned object's name has a number on the last bit of its name (like "item1" and "item2" and so on.)
I was wondering if there is a solution to this.

Perhaps there is a way in the editor can "generalize things" so that the scripts don't need to be as precise with the names. Something like instead of the item name itself an expression like "item[something]" (where [something] can be anything) is used in its place. I was wondering if there is a (combination of) word(s) or symbol(s) available in the coding that have such a function like [something]. I'm curious if this is even possible at all or perhaps there is a better way of doing this compared to what I've speculated.

I also pondered of instead of making it into an object I instead should make it into a status attribute like a money-like resource though I have not found out of a way to hide an attribute on the user interface when it's 0 (so that the player won't get spoiled on what items they will be finding) nor do I know of a way of a making it count in the inventory space since I plan on a limited inventory system.

If you know of a solution of doing this so that I can making a working infinite item dispenser/spawner then please let me know. :)

XanMag
Instead of removing the item and cloning it, why not just move the object back to the dispenser? Or, do you need more than one at a time?

SeanTrunks
I would prefer if the player be able to carry multiple copies of the same item but I guess that would work although that would make puzzles that require multiple copies of the same item a bit tedious for the player since they will have to backtrack to the dispenser repeatedly.

The Pixie
One Attribute

If you want to go down the attributes route, you can add a status attribute during game, when the player first gets one of these things, like this:
    dictionary add (player.statusattributes, "itemcount", "Items: !")

If there are currently no attributes to show, this will even (I think) cause the status panel to appear. There will be a fair bit of scripting this way, but it will probably look more slick to the player.

I am using code here; you may find this post helpful to understand how to copy it to your game:
viewtopic.php?f=18&t=4771


Cloned Objects

If you want multiple actual items, the easiest way is to test the name of the alias. The alias will be the same for all the clones. Insert an "If", and in the expression box, try this:
object.alias = item.alias

(I am assuming what you want to test is called "object", you will have to change accordingly.

Rather more advanced, but it you try to use verbs rather than commands, you might be able to get around having to test at least sometimes. Verbs use scripts attached to the object, so when you clone the object the script is still there. You just have to remember to use this to refer to the thing the script is attached to, rather than its name.
viewtopic.php?f=18&t=5023

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums