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?
ID:179275
Jan 25 2002, 12:28 pm
|
|
Jan 25 2002, 2:29 pm
|
|
he is not the only onw with this problem i need this answered too.
|
Try this for the click proc instead:
Click() set src in oview(1) for(var/obj/MasterKey/K in usr.contents) icon_state = "DoorOpen" density = 0 opacity = 0 break if(icon_state == "DoorClosed") usr << "Seems you don't have the key." |
Try this:
: That should work. -Rcet |
ok heres my code now but now the door opens even without 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) for(var/obj/MysteryKey in usr.contents) icon_state = "DoorOpen" density = 0 opacity = 0 break if(icon_state == "DoorClosed") usr << "Seems you don't have the key." Key Code MysteryKey icon = 'Items.dmi' icon_state = "Key" verb/Get() set src in oview(0) usr.contents+=new/obj/MysteryKey//This adds a mace to usr.contents *Note* always use the new var cause if you don't you will get nasty run time errors// del(src) verb/Drop() set src in usr.contents src.Move(usr.loc) |
In response to Tazor07
|
|
for(var/obj/MysteryKey/K in usr.contents) //You must put var/obj/MysteryKey/K or it wont work.
|