ID:149939
 
ok well im making a door system that closes by its self after 5 sec of not having somone in it but right now i just had the close part and cant even think of how to make it so the door waits till the usr is out of the door befor it closes. See my problem is a bug were if your in the door and it closes no monster can attack you because its bumping the door. So you can kill anything wile not geting killed your self. But i see a problem in any idea i can sceme up, when the when the usr steps out the door they could step back in befor it closes than it will close on them keeping the problem. Heres my door code if you under stand my problem plz repli and if you dont tell me.


doors/housedoor1
name = "Door"
icon = 'doors.dmi'
icon_state = "closed"
density = 1
opacity = 1
DblClick()
set src in oview(1)
icon_state = "opened"
density = 0
opacity = 0
sleep(50)
icon_state = "closed"
density = 1
opacity = 1
One thing to do is to see if the usr.loc = src.loc if it is dont close it

otherwise sleep 5 seconds then close

or better have it so it runs a proc once the door opens and it checks to see if theres a mob in oview(0) if there is dont close
In response to DoOmBringer
see the problem with that is i think once they leave the door they can jump right back in and get in befor it closes.
In response to Scoobert
door
parent_type=/obj
click-code-stuff
Enter(M)
icon_State="closed"
density=1

this makes it so that when the user enters it, it closes. It may be solid when it closes, but the user can still move off of it.
In response to unimatrix
looks good but it needs to be entered doent it. That way its when they walk out of it.
In response to Scoobert
replace Enter(M) with Exit(M) then....duh....