ID:270160
 
i've always wanted to put a teleport in a game but i never knew how.Deomos didnt help me since all the ones i lokked at where for teleporting to a different location on map.But i wanted to use a teleport that teleports you to a different
map.Im gonna try at this code:
obj
teleport
icon = 'teleport.dmi'
verb
Teleport()
set src in oview(1)
//something that has to do with bumping into the obj here.
 teleporter
name = "."
icon = '.'
icon_state = "."
Entered(O)
if (istype(usr,/mob/player))
usr.loc = locate(/turf/teleportturfnamehere)


This should help you understand.
In response to Daman3456
No it shouldn't. There is no usr in Entered(), and Teleporter would have to be a turf to for that act upon entering. Also, he should be taugh exact location first, rather than relative based on a turf he may have two or more of. And location shouldn't be set directly. Rather, use Move() or get_step(), something.

turf/Teleporter
//variables defined here
Entered(atom/movable/A)
if(ismob(A) && istype(A,/mob/Player/)) //place type here, biotch
A.Move(locate(x,y,z),A.dir) //set location absolutely or reference a tuf in the world, like Dama displayed
else ..()


In response to CaptFalcon33035
if(ismob(A) && istype(A, /mob/player)) is redundant. If istype(A, /mob/player) returns true, then ismob(A) will always also return true. The first part makes the second useless.
In response to Loduwijk
Refrencing a turf is much easier then refrencing an x y and z. The Z level can also be misleading if you have more then one map file in your game. You'd have to code something that tells you your Z level in game. Oh and that usr.loc works, because i have tested it.
In response to Daman3456
Daman3456 wrote:
Oh and that usr.loc works, because i have tested it.

It works in that specific example; but it can be broken if applied to a game where usr is null at that point, which is not unlikely.
In response to Daman3456
Reguardless, usr shouldn't be used. And, I know you're way is an excellent way to do it, but what if yopu have more than one of that tile? Why make a bunch of different tiles for teleportation?

And Ludjowik, you're completely right. I was thinking to check for client, but instead, I placed that check, I dunno why.
hmmm...I know whatyour problem is. It quite simple accually. The caordinence x y z, you know. Do you know what z is for? Well when you make a map you probebly do like 100 x 100 y and you leave z 1, right? Well if you make z 2, you have to different maps in one type of thing. So what do you do? I don't remmember the teleport thing, so when you find it on demos, when it asks you the area you want to be teleported to put in like 1,1,2. that last 2 means on a whole new map. Enjoy.
In response to Bamrulez
I believe my Teleport demo would help out here.