ID:267336
![]() Mar 10 2003, 3:27 am
|
|
Does Entered() work with objs? My friend told me it did, but when i tried it it didn't. If it doesn't, or if i jsut don't know how to use it, is there an alternate way of checking to see if a person walks over an obj?
|
![]() Mar 10 2003, 3:35 am
|
|
It doesn't. What you can do is this:
|
So then, lets say i have a door code like this
obj/door it order to close it, would this work? turf would that work? thanks -Magnus |
Magnus VI wrote:
Does Entered() work with objs? My friend told me it did, but when i tried it it didn't. If it doesn't, or if i jsut don't know how to use it, is there an alternate way of checking to see if a person walks over an obj? Entered() does work with objs, but not in the way you thought it would. It does not check to see if a person walked over it, because what the person's mob entered was the turf it's on, not the obj itself. The way Entered() works for all atoms--turfs, objs, mobs, and areas--is to be called whenever something uses Move() to enter its contents list. When you walk onto a turf with another obj, obj.Entered() is not called because you didn't get into the obj; you stepped onto the turf. However if the obj was some kind of treasure chest and you could climb in, then Entered() would be called for it. obj/treasurechest Lummox JR |
Enter(atom/movable/A) Isn't that <code>return 0</code> redundant? |
Probably the best way to handle this is to create two new procs, walkOver() and walkOff(), like this:
atom/movable/proc/walkOn(atom/movable/A) |
Garthor wrote:
Enter(atom/movable/A) Isn't that <code>return 0</code> redundant? Good point. Oh well; can't hurt. Lummox JR |
Actually, it could destroy an entire galactic civilization! Haven't you hever read Hitchhiker's Guide to the Galaxy?!
|
obj so using that, how can i change the stairs to an object? because for some reason i couldnt call the mobs variables. I tried this obj but that didnt work. Please help. ETG |
atom/movable/proc/walkOn(atom/movable/A) obj junk.dm:19:error:A.client:undefined var obj junk.dm:21:error:A.movable:undefined var obj junk.dm:22:error:A.Fade_Out:undefined proc obj junk.dm:26:error:A.Fade_In:undefined proc obj junk.dm:27:error:A.movable:undefined var obj junk.dm:17:error:WalkOn :undefined proc this is what i have. |
What i have now, should work, yet it doesn't.
obj/door can someone help? thanks |
Okay, first of all, it's walkOn, not WalkOn. Second, after you do an ismob() check, use var/mob/M = A, and then use M.
if(ismob(A)) var/mob/M = A if(M.client) ... |
Lummox JR wrote:
Garthor wrote: Enter(atom/movable/A) Isn't that <code>return 0</code> redundant? It's not a bad habit, especially if you work in other languages that don't default to a return value of zero. The Vignette TCL interpreter I must suffer at work comes to mind. |