Combining Inventory Items
CoffeeCat777
23 Jul 2017, 05:53Hello, I'm new to Quest and am still working on my first game. I'd like to know if there's any way to combine two inventory items into one item. For example, there's a part in my game where you have to get past a guard who's blocking an entrance. I was planning on combining two items that are picked up earlier in the game (a cup of coffee and a bottle of sleeping pills) into one item (a cup of coffee laced with sleeping pills) in order to make the guard fall asleep. Is there anyway to do this?
The Pixie
23 Jul 2017, 07:03There is! The title says converting one thing to another, but it works for any number:
http://docs.textadventures.co.uk/quest/convert.html

Richard Headkid
23 Jul 2017, 07:20UPDATE:
Yeah.. do what Pixie said.
I'll leave these alternate methods listed, just in case...
-
Create an object called
cup of coffee laced with sleeping pills
and set(none)
as the parent. (The parent setting is the same window in which you name your new object.) -
Now, go select
cup of coffee
in your tree on the left of the screen. Go to theFeatures
tab, and select the box markedContainer
. -
Select the tab labeled
Container
and selectcontainer
from the drop-down menu. -
Uncheck
can be opened
andcan be closed
. (It's a cup, after all, right?) -
Towards the bottom, you'll see
Script to run when trying to add an object
. Copy the following and paste it into that script's code view:
if (object = bottle of sleeping pills) {
MoveObject (cup of coffee laced with sleeping pills, player)
RemoveObject (cup of coffee)
RemoveObject (bottle of sleeping pills)
msg ("Insert your message to print here! I.e., You put the pills into the coffee. They dissolve instantly.")
}
You could take a different route, and set up a GIVE option on the guard. It basically be the same setup though.
-
Select the guard in the object tree on the left.
-
go to the Features tab
-
Check the box labeled
Use/Give
-
Select the Use/Give tab
-
Check the box for
Give this to other object
-
Select
handle objects individually
from the drop-down menu -
click ADD, and click the drop-down menu's arrow to select the guard
-
Past the following into the code view:
if (bottle of sleeping pills.parent = cup of coffee) {
Remove(bottle of sleeping pills)
Remove(cup of coffee)
msg ("The guard take the cup, drinks it and passes out!")
guard.unconscious = true
}
--
You'll also have to set up the exit you're blocking so you can pass through it when the guard is asleep.
We can help you out there if you need it when you get to writing that, just let us know!
Here's a link to the tutorial (it's quite helpful, and it's got screenshots to look at!):
http://docs.textadventures.co.uk/quest/tutorial/