Quest 5.0.2 - container troubles
SarahJay
10 Apr 2012, 18:14Hello everyone.
I am trying to make a vending machine with various snacks, and a ticket (to be used as a key to a door later) hidden within one of the snack bags. I have a coin hidden in the room to be used as the key.
I am very new to quest, and I am having some troubles with using the coin on the vending machine, and also selecting which snack the user wants (ideally, I would like the user to enter a specific code for each snack). It's set in the future, so the coin has enough value on it for unlimited candy, so they will not need to find more coins in the future.
I can take the coin out of the couch, but I cannot "open", "unlock", or "use", the coin to operate the vending machine. Meaning I cannot test my snack codes or if the ticket is removable from the specific snack bag.
Additionally, I am coding this game for a class project, and I am unable to change the quest version because 5.0.2 is installed on the school computers we need to use.
Thank you in advance for any and all help!
I am trying to make a vending machine with various snacks, and a ticket (to be used as a key to a door later) hidden within one of the snack bags. I have a coin hidden in the room to be used as the key.
I am very new to quest, and I am having some troubles with using the coin on the vending machine, and also selecting which snack the user wants (ideally, I would like the user to enter a specific code for each snack). It's set in the future, so the coin has enough value on it for unlimited candy, so they will not need to find more coins in the future.
I can take the coin out of the couch, but I cannot "open", "unlock", or "use", the coin to operate the vending machine. Meaning I cannot test my snack codes or if the ticket is removable from the specific snack bag.
Additionally, I am coding this game for a class project, and I am unable to change the quest version because 5.0.2 is installed on the school computers we need to use.
Thank you in advance for any and all help!
sgreig
10 Apr 2012, 20:23I'm not very familiar with the differences between Quest 5.0.2 and 5.1.1 personally, but here's how I would go about setting this up:
[list]
[*] I would create a script that sets a flag when the coin is used on the vending machine.[/*:m]
[*] I would create custom commands for the snack codes, that turned off the flag on the vending machine once used (this would make it so you'd have to use the coin every time you wanted to take something from the vending machine.) The script would also cause the snack to be vended.[/*:m]
[*] To accomplish the snack being vended, I would create objects for the different snacks and have them hidden in a dummy room, and would simply move the object to the room with the vending machine once the snack has been dispensed.[/*:m][/list:u]
There would also have to be some kind of check to see if the snack had already been vended, as Quest only allows one instance of any object. So in this case, I would probably make the snack with the ticket the only item that actually vends a "physical" product that can be added to the inventory.
If I've totally lost you, I can probably whip up a sample ASLX file to show what I mean. Hopefully it would work in Quest 5.0.2?
[list]
[*] I would create a script that sets a flag when the coin is used on the vending machine.[/*:m]
[*] I would create custom commands for the snack codes, that turned off the flag on the vending machine once used (this would make it so you'd have to use the coin every time you wanted to take something from the vending machine.) The script would also cause the snack to be vended.[/*:m]
[*] To accomplish the snack being vended, I would create objects for the different snacks and have them hidden in a dummy room, and would simply move the object to the room with the vending machine once the snack has been dispensed.[/*:m][/list:u]
There would also have to be some kind of check to see if the snack had already been vended, as Quest only allows one instance of any object. So in this case, I would probably make the snack with the ticket the only item that actually vends a "physical" product that can be added to the inventory.
If I've totally lost you, I can probably whip up a sample ASLX file to show what I mean. Hopefully it would work in Quest 5.0.2?
SarahJay
10 Apr 2012, 22:40Could you walk me through the second and third bullet (custom commands, editing the flag on the vending machine, and "vending" the snack from a different room)? If you can do images showing me the lines you are changing and the boxes you are ticking, that would be wonderful.
sgreig
11 Apr 2012, 00:16Ok, here goes: (Bear in mind, i'm using the web version of the Quest editor to do the examples. Hopefully, if certain boxed or whatever aren't in your version, you'll be able to extrapolate the general idea and tweak it.)
So the first step is the coin object. You want a script that will display a message and then add a "credit" to the vending machine. If the vending machine doesn't have this credit, you won't be able to use it. Here's how I have the coin object set up. Notice how I have a script set that prints a message and adds a flag to the vending machine only when the coin is used on the vending machine. I know it's cut off a bit in the screenshot, but the set variable line in the script is vending_machine.credit, not vending_machine.credi as it shows there.

Now there's a couple of ways of handling the vending machine and the snack. One, you can not give the snack a parent, so it just won't show up in the game until you move it. Alternatively, you could make the vending machine a container and put the snack in it. The end result is the same, because you're just going to be changing the parent of the snack object to the player to put it in their inventory. For the purpose of this example, I'm going to use the former example, because I don't know what Quest 5.0.2's support for containers is.
In this screenshot you'll notice how the snack item is not nested under the vending room or any of the other objects. This is important, because if it's in the vending area, it will show up as an object in the description, and if you put it under the player, it will be in their inventory.

You'll also want to make sure to set the parent of the coin to the player so they have that in their inventory. I just realized I had it in the wrong place on that screenshot.
This next screenshot shows the custom command E7. If the player types E7 and the vending machine has no credits, it informs them of such. If the vending machine does have a credit, the snack is dispensed and added to the player's inventory.

And that's how you do it. Now, this is a REALLY simple example. In practice, you'd want the custom command to check to see if the vending machine was in the same room as the player first, for example. Otherwise, as it's written, as long as the vending machine has the credit flag the snack will dispense no matter where you are, which is much less realistic. You also might want to put a description on the vending machine that lists the different codes for the items, and then you'd obviously make a custom command for each code that would reset the vending machine flag and dispense the relevant product. But that should give you a good base to work off of.
So the first step is the coin object. You want a script that will display a message and then add a "credit" to the vending machine. If the vending machine doesn't have this credit, you won't be able to use it. Here's how I have the coin object set up. Notice how I have a script set that prints a message and adds a flag to the vending machine only when the coin is used on the vending machine. I know it's cut off a bit in the screenshot, but the set variable line in the script is vending_machine.credit, not vending_machine.credi as it shows there.

Now there's a couple of ways of handling the vending machine and the snack. One, you can not give the snack a parent, so it just won't show up in the game until you move it. Alternatively, you could make the vending machine a container and put the snack in it. The end result is the same, because you're just going to be changing the parent of the snack object to the player to put it in their inventory. For the purpose of this example, I'm going to use the former example, because I don't know what Quest 5.0.2's support for containers is.
In this screenshot you'll notice how the snack item is not nested under the vending room or any of the other objects. This is important, because if it's in the vending area, it will show up as an object in the description, and if you put it under the player, it will be in their inventory.

You'll also want to make sure to set the parent of the coin to the player so they have that in their inventory. I just realized I had it in the wrong place on that screenshot.
This next screenshot shows the custom command E7. If the player types E7 and the vending machine has no credits, it informs them of such. If the vending machine does have a credit, the snack is dispensed and added to the player's inventory.

And that's how you do it. Now, this is a REALLY simple example. In practice, you'd want the custom command to check to see if the vending machine was in the same room as the player first, for example. Otherwise, as it's written, as long as the vending machine has the credit flag the snack will dispense no matter where you are, which is much less realistic. You also might want to put a description on the vending machine that lists the different codes for the items, and then you'd obviously make a custom command for each code that would reset the vending machine flag and dispense the relevant product. But that should give you a good base to work off of.