ID:155018
 
Let's say I had buildings on my map, and I wanted to make it so you could walk up to the door, and it would let you 'enter' the building by displaying a different map with different NPC's and all.

I know this sounds like an noobish question, well that's because I am a noob.

Anyways, please give a link or display some kind of code,

Thanks!
If you want to create and place a 'fixed' amount of buildings on the map, you can use another z-level for their interior and use usr.loc = locate(x, y, z) to move them inside the building.

You also might need to use Bump() proc if you want them to enter the building by bumping on the door.


On the other hand, if you want to create buildings during runtime and their interiors as well, then you can use this.

Regards,
In response to Hashir
Uhhh... what? lol

I'm really new to this Byond stuff and the entire code, so this really confuses me.
In response to ITI3l33
Do some tutorials and actually learn the language before jumping into a game.
In response to Robertbanks2
I've tried to find some tutorials, but most tutorials I find are really outdated.

And I'm kind of building the game as I go along, and learning some things.
In response to Robertbanks2
You could post a link to a tutorial for him at the very least... You don't have to harass newbs, this is a How-To forum.

Anyways, ZBT is the best DM tutorial out there. Read it through and you shouldn't have any trouble with transitions. http://www.byond.com/members/ DreamMakers?command=view_post&post=36143
In response to Shaoni
Robertbanks2 wasn't harassing him/her. He was simply stating a fact and telling him a very useful hint/tip.
In response to Shaoni
One of the first things on the Developers page is a list of tutorials and resources for learning, they aren't hard to find.
In response to ITI3l33
obj
door
Entered()
usr.loc=locate(x,y,z)//x y and z are the coordinates of where you mapped the building
In response to Dr.DraX
Dr.DraX wrote:
obj
> door
> Entered()
> usr.loc=locate(x,y,z)//x y and z are the coordinates of where you mapped the building


That would have to be a turf. Entering a obj does not involve being in the same location on it, unlike turfs. You also wouldn't use usr.

turf
door
Entered(mob/m)
if(ismob(m)) //have to check it's a mob
if(!m.client) //if the mob does not have a client
return 0 //deny access
else //it does have a client
..() //this allows it to do the default action of the proc, which is permiting access
else //it isn't a mob
return 0 //deny access
In response to Moonlight Memento
Thanks a bit, this kind of helps. But, as I stated in my first post, I want to use the door as an obj, not a mob

Also, I've read through the ZBT tutorial. He doesn't really state anything about transitioning maps and the such. I've also used most of the code within the Testworld code in my game that I am currently building.
In response to ITI3l33
You can do that by creating an action procedure which is called everytime you enter a new turf.

The turf then checks all it's contents, and if one of the contents has a functioning action procedure, then you can run it as you wish:

atom
proc
Action() //by default do nothing

turf
Entered(mob/m) //m is the mob who entered the turf
..() //Entered will do what it normally does, however technically unnecessary since there is no default
for(var/atom/a in src) //every turf entered will call the Action proc
a.Action(m) //so now you can use it how you like, and pass along m
obj
door
icon = 'door.dmi'
Action(mob/m)
m.loc = locate(1,1,2)


I know it can be complicated at first, I remember years ago trying to grasp this myself. Just keep programming and enjoying yourself, it will come. Just stick with it. :)
In response to Speedro
Speedro wrote:
You can do that by creating an action procedure which is called everytime you enter a new turf.

The turf then checks all it's contents, and if one of the contents has a functioning action procedure, then you can run it as you wish:

atom
> proc
> Action() //by default do nothing
>
> turf
> Entered(mob/m) //m is the mob who entered the turf
> ..() //Entered will do what it normally does, however technically unnecessary since there is no default
> for(var/atom/a in src) //every turf entered will call the Action proc
> a.Action(m) //so now you can use it how you like, and pass along m
> obj
> door
> icon = 'door.dmi'
> Action(mob/m)
> m.loc = locate(1,1,2)

I know it can be complicated at first, I remember years ago trying to grasp this myself. Just keep programming and enjoying yourself, it will come. Just stick with it. :)


Thank you so much!