Losing Inventory Item after interation

Started by Ibrahim9, Sat 03/11/2007 22:20:18

Previous topic - Next topic

Ibrahim9

I can't get my key to work on the door, I have made it disappear when i touch it and appear on my inventory, but i can't use it on my door, which when i click it, i just go to the next room while keeping my keys. How can i use my key on my hotspot (door) and lose it after i use it?

Da_Elf

if you checked the manual you would find how to give and take away inventory items

Ibrahim9

Thats not really helping me.

Ghost

#3
If you want interaction, you need to script it. As far as I understood, you want to use a KEY on a DOOR, and the key is an inventory item while the door's a hotspot.

So, in the doors interaction list, you go to "use inventory on hotspot". Select the "Run Script" entry to open the scripting editor.

There you write

if (player.ActiveInventory == iKey) {
player.loseInventory(iKey);
player.changeroom(10, 20, 120);
}

That's everything, really. You just need to use the loseInventory command to remove an item from the inventory.

There is a caveat here, though, because your method would mean that the new room can only be entered by using the key on the door. That'd mean that the door can only ever be used once (since using the key is losing the key). You would probably want to use the key to UNLOCK the door, and using the door would then transport the player.

Ibrahim9

how would i do that?

Ghost

Quote from: Ibrahim9 on Sun 04/11/2007 00:59:16
how would i do that?

A very thorough answer to that question has been PM'd to you via Ghost mail ;)

You should give us some time to answer, though. Patience pays off.

Ashen

#6
Ibrahim:
Don't double post. Don't quote the extire text of the post immediately before yours. Ask more specific questions - Ghost gave you a pretty detailed answer there, which bit of it was giving you trouble? There's a few problems with capitalisation - but the manual should help you there, and you'd be getting an error message that you should show us. If it was the last bit ("use the key to UNLOCK the door..."), use variables. The BFAQ has a pretty detailed section on setting them up (or you could use GlobalInts, but that seems like a waste), and the manual explains conditons. Or (and again, I don't actually recommend this....) you could use the Interaction Editor commands 'Game - Set variable value' and 'Conditional - If variable is set to a certain value'.

Quote
if you checked the manual you would find how to give and take away inventory items
Quote
Thats not really helping me.
Actually, it is. You're supposed to be reading the manual BEFORE you post. If you post, and it's obvious you haven't read the manual, your thread will be locked. It's obvious you haven't read the manual when you have to ask about how to lose Inventory Items - the command is called LoseInventory so it's not like it's hidden. There's also the IE command 'Player - Remove an item from the inventory' - if you're using the Interaction Editor and didn't find that, it begins to look like you're not even trying before you run to the forums. As Gilbot suggested in another thread, try cooling off on posting for a while, until you've had a real chance to play around on your own.

EDIT: Also, use descriptive titles - 'Keys' doesn't really say anything about what the problem is.
I know what you're thinking ... Don't think that.

Da_Elf

I'm sorry i wasnt being super helpfull but i did noice there were other posts made (one about the manual which was locked) and i figured that manual was not getting full use. ibrahim i hope you do get familiar with AGS and do get some game out there for all to enjoy (more importantly for you to enjoy the process of making them)

SMF spam blocked by CleanTalk