ID:266720
Jun 3 2002, 9:43 am (Edited on Jun 3 2002, 9:52 am)
|
|
i tryed amking it so that when u get a key a var is activated for only u but i cant get that to work. how can i get it to work or is there another way to make a door only open if u have a key?..... or if u cant show me the code or u r just mean then maybe u could at least tell me a demo on this
|
In response to Vortezz
|
|
//is this right?
obj/jaildoor icon = 'jail.dmi' icon_state = "closed" density = 1 Click() var/obj/K = locate() in usr.contents if(K) src.icon_state = "open" src.density = 0 icon = 'cobble16.dmi' sleep(50) src.icon_state = "closed" src.density = 1 icon = 'jail.dmi' else usr << "Its Locked" //it looks correc t to me, but it sez that else is inconsistently indented/.... can u help? ps if and else are on the same row as are usr<< its locked and src.iconstateetc.. |
You may want to consider associating the key with the door. What I mean, is something like this:
key This allows you to have a 'mastery key' for doors, and keys that only work for specific doors(Look up locate(). It searches the current path, and all its children.). Try and think of it like this: Master Key The Master Key will open both DoorFive and DoorSix. But DoorFive will only open DoorFive. |
In response to Alathon
|
|
wuts Parnet_type or wutever and can u fix my poorly indented code
|
In response to Magnus VI
|
|
the else part needs to be indented more. Also, inconsistant indentation means you're using different indentation throughout your code. Like a single tab here, two space there, etc.
|
That there is. You can use the locate() proc to check if the player has a key in his inventory. Here's an example.
Of course, there are several other ways to do this, but that's how I do it ;). You'll also want to check for seeing if the door is locked, too, or else a lot of people are going to need keys for unlocked doors ;)
=V