Unlocking doors with objects

AmyPond42
19 Feb 2013, 20:39
I hate to have to ask this here after I've just asked a different question, but I have searched everywhere for an answer and watched different tutorials and I simply cannot seem to find the answer anywhere.

I wanted players to be able to open the cell door in my game by breaking it open with a crowbar. Obviously they couldn't/wouldn't simply type "unlock door with crowbar" or something like that to open it, but I couldn't figure out how to make it so that they could simply type "use crowbar on door" or something like that and have the door open that way. I finally just gave up and put a key in the room for them instead for them to use on the door. And yet, I still can't figure out how to make it to where they can use the key to unlock the door! This is very frustrating and I can't continue working on the game until I resolve this problem. I've tried different things but nothing seems to work, can someone tell me how to do this?

Asyranok
19 Feb 2013, 20:53
Hi Amy,

This one should be relatively simple, and you could do it a number of ways.

My way would be to add an object in the room called "Cell Door".

The player can look at it, which tells them that it is locked etc. All the while, hide the exit from the cell. Make it "not visible" via the check box in its setup.

Add an inventory verb to the crowbar object, so that while it is in your inventory, you can click on it, and it offers a "use" function.

Now, go to the Use/Give tab on the cell door object that you made. Under "Use other object on this", add a new one for the crowbar, and then add a script for it. In the script, you can make it so that the "cell door" object is made invisible, and the exit (which might also be called cell door) can be made visible in the same script. This will then clean up the loose ends and allow the user to navigate out of the unlocked cell.

*I am relatively new. This way should work fine, but it might not be the most efficient or pretty way. See what others say too. But that should get you started.*

sgreig
20 Feb 2013, 08:32
That method would work fine as far as I can tell. The only thing that would make things slightly more complicated is if you really wanted the player to have to use the command "break door with crowbar" as then you'd have to deal with creating custom commands, which isn't much of a problem really, but most players would probably just try "use" first.

AmyPond42
22 Feb 2013, 22:01
Thank you both very much! :)

TriangleGames
22 Feb 2013, 23:26
As another idea for further education, would I be correct in suggesting that one could make the cell door an exit that is locked, and then make a custom verb (rather than a command) for 'break' which unlocked the exit?
And in that case, would the effective difference between making 'break' a command vs a verb be to provide a default response for 'break'?

sgreig
23 Feb 2013, 00:53
TriangleGames wrote:As another idea for further education, would I be correct in suggesting that one could make the cell door an exit that is locked, and then make a custom verb (rather than a command) for 'break' which unlocked the exit?
And in that case, would the effective difference between making 'break' a command vs a verb be to provide a default response for 'break'?


That sounds like it would work, but admittedly I've never delved into verbs much in the games I've made so I don't know for sure.