ID:176799
 
im trying to creat a door that as you walk through it it opens but im having problems. please help

obj/door
icon = 'door.dmi'
icon_state = "door1"
density = 0
opacity = 1
Entered(mob/M)
if(usr.cl >=0)
flick("door1open",src)
icon_state = "1open"


thanks
First, usr has no defined meaning within the Entered() proc. You already have the variable you want in your proc declaration: mob/M. Second, a mob can't normally enter an obj. Make the door a turf.

Try this small change:

turf/door
Entered(mob/M)
if(istype(M) && M.cl >=0)
flick("door1open",src)
icon_state = "1open"

You need to check istype(M) to make sure it's a mob entering the door and not some obj.
In response to Air Mapster
Making doors turfs is usually a bad idea, because it means you need more turfs of different kinds (door-stone, door-wood, etc.) This is a somewhat nicer way to do it:
<code> atom proc Bumped(atom/movable/A) obj door Bumped(atom/movable/A) if(ismob(A)) var/mob/M = A if(istype(M) && M.cl >=0) flick("door1open",src) icon_state = "1open" mob Bump(atom/A) A.Bumped(src) </code>
This gives you a Bumped() proc for everything that can be bumped. This is useful in so many different ways. I'm not sure if you can change mob/Bump() to atom/movable/Bump(), but you should try it. This moves the clutter of the bumping procedures to the object that is being bumped, instead of a long, nasty bump proc for mobs/objs.