ID:149934
Jan 24 2002, 5:15 pm
|
|
well let's say i want to make a door open if you have a key in your inventory(contents). How would i actually make it say the door opens only if you have the item?
|
In response to Vortezz
|
|
i still have a problem but here's my code so far.
Here's for my door that requires the key: MysteryDoor name = "Door" icon = 'Turf.dmi' icon_state = "DoorClosed" density = 1 opacity = 1 Enter(mob/M) if(istype(M,/mob/NPC)) return//stop movement. else return..()//allow movement through Exited(usr) icon_state = "DoorClosed" density = 1 opacity = 1 Click() set src in oview(1) var/obj/MysteryKey = locate() in usr.contents if(MysteryKey) icon_state = "DoorOpen" density = 0 opacity = 0 else usr << "Seems you don't have the key." And here's my key: MysteryKey icon = 'Items.dmi' icon_state = "Key" verb/Get() set src in oview(0) usr.contents+=new/obj/MysteryKey del(src) verb/Drop() set src in usr.contents src.Move(usr.loc) So what's the problem? |
In response to Tazor07
|
|
o and is there a way to make a monster drop the key?
|
In response to Tazor07
|
|
Tazor07 wrote:
i still have a problem but here's my code so far. Scroll up and look at the red lines, try changing them to this: var/obj/MysteryKey/K = locate() in usr.contents if(K) Don't know if that would help, it'd be the first thing I tried though. |
In response to Vortezz
|
|
i still doesnt work please if anyone else knows whats wrong please look at the other post for my code.
|
Simple, really. Use locate() for this instance.
I can't exactly explain why the locate()ing works, but that's how you'd do it.