Hello fello gamers, I have run into yet another problem, I am currently trying to implement Deadrons Door code from "STEP BYOND" into my game, with J.Ker's roof library. I have the roof thing fihured out completely, its just that when you open a door to go into a house, the door is stil dense, and the user can not walk through. Below is the code I am using, I modified a tiny little bit, thank you for any help possible.
area/hut
name = "hut"
desc = "Hmm, a hut beside a mountain, looks interesting..."
/* The door is handled here using two kinds of turfs, one open and one closed.
The door could also be treated as one obj or turf with different states, so this is
just to demonstrate how you can replace turfs at runtime. When the open door is
closed, the turf/door/open object is replaced by a turf/door/closed object. */
turf/door
name = "door"
turf/door/open
icon = 'open_door.dmi'
verb
close()
// set src defines where a player has to be to use this verb.
// In this case, the player must be within one square of this door.
set src in view(1)
// flick() plays an animation once at the specified location.
// Using src for the location means "play the animation at the location of me (the door)".
flick('closing_door.dmi', src)
// This sends the sound 'door.wav' to everyone in view of the door.
view() << 'creakslam.wav'
// This creates a new closed door turf at this location, replacing this open door turf.
new /turf/door/closed(src)
turf/door/closed
icon = 'closed_door.dmi'
// Can't see things on the other side of the door.
density = 1 // The door is solid -- you can't move through it.
Click()
if (get_dist(usr, src) < 2)
open()
Enter(O)
// If a player tries to enter the closed door, be nice and open it for them.
if (istype(O, /mob/Spy))
// On someone entering this closed door turf, automatically open the door.
open()
if (istype(O, /mob/Commando))
// On someone entering this closed door turf, automatically open the door.
open()
return 1
// Otherwise don't let this non-player enter.
return 0
verb
open()
set src in view(1)
flick('opening_door.dmi',src)
view() << 'door.wav'
new /turf/door/open(src)
P.S, if you know how to make it so that when the user walks through the door, the door closed behind him, plz say. Thanks the conjuror
ID:261709
![]() Jan 20 2003, 7:35 am (Edited on Jan 20 2003, 10:49 am)
|
|
The Conjuror wrote:
Its because I have to characters in my character choice section, give me an example . I don't follow you. How you set up the doors is completely orthogonal to how you handle characters. Lummox JR |
The Conjuror wrote:
Just what is the matter with the code? A better way to create doors is to just have one turf, and change its density and icon_state whenever it opens or closes. turf/door Lummox JR |
You're not changing the doors density. Put this line in the door-opening code:
src.density=0 That should fix your problem. |
Jp wrote:
You're not changing the doors density. Put this line in the door-opening code: His system replaces the entire turf, so I don't see that this would make a difference. Lummox JR |
This is almost just what I was looking for, It meets my basic needs, but I was wondering if it would be possible to have the user simply bump the door and it open, as I had, but when the user walks into the room, the door closes behind him, This is not a major need, but if you have any ideas, just post em. Thanks a lot Lummox JR for all your help, I will be sure to include you into my game credits.
|
The Conjuror wrote:
This is almost just what I was looking for, It meets my basic needs, but I was wondering if it would be possible to have the user simply bump the door and it open, as I had, but when the user walks into the room, the door closes behind him, This is not a major need, but if you have any ideas, just post em. Thanks a lot Lummox JR for all your help, I will be sure to include you into my game credits. Sure, this can be done. turf/door Lummox JR |
Lummox JR wrote:
Enter(atom/movable/A)var/mob/M = A // ........Than set up a mob var to check whether A has a client if(M.client) |
Ok guys, thabks for the work , I fixed up Lummoxes and now it brings me to a black screen when I walk into the door, this is the code with verbs im talking about, here is the code, When i walk in i get a black screen, why?
turf/door/open icon = 'open_door.dmi' density = 0 verb/close() set src in view(1) flick('closing_door.dmi',src) view() << 'door.wav' new /turf/door/closed(src) turf/door/closed icon = 'closed_door.dmi' verb/open() set src in view(1) flick('opening_door.dmi',src) view() << 'door.wav' new /turf/door/open(src) |
Flick wrote:
if(ismob(A)) // ........ Need to change the 'if(ismob(M))' to A.var/mob/M = A // ........Than set up a mob var to check whether A has a client Doh! Wrote that one in a hurry. Figures I'd get something wrong on it. Lummox JR |
I even get a black screen when I use the non-verb type code, is it my computer, or is something wrong?
|
The Conjuror wrote:
I even get a black screen when I use the non-verb type code, is it my computer, or is something wrong? If you were using something like your original approach of changing the entire turf, and mixed that with my Enter() and Entered() procs, that'd explain it easily enough. I don't see how my code alone would cause such a thing however. Lummox JR |
I dont know, I kept the code you gave me, and didnt add my original stuff, I would appretiate it if you guys helped me through this but I understand if im becoming a nusense, I have to go to Dog training with my new dog so I dont think I ll be on anymore tonight, tommorrow morning Ill check if you guys got anything and Ill try playing around with the code myself.
Thanks so much The conjuror(conjuring up another aweseome Q&A) |
Lummox JR