ID:267416
 
Can you make an effect when you get teleported to an area, it gives you this effect? (EX. Battle area on a 2nd floor and you go through the first with the 2nd floor filled up with battle area.)

~~Dragon Lord~~
Well, you can do:

<code>area/death/Entered(atom/movable/A) if (ismob(A)) world << "[A] entered the evil Area of Death. Whoops." del A</code>

Does that help? If not, you need to be a little more specific. =)
In response to Crispy
No, I meant that if you are teleported from another place. Pretend you start at /area/Start. Then your friend summons you to /area/Battle. You wont get the effects that will happen unless you actually "Enter" it. Thats what i mean. I want it so you can make it work when you are teleported.

~~Dragon Lord~~
In response to Unknown Person
If you're teleporting with Move(), then Entered() will get called. If you're not, you should be. =P

If I'm misinterpreting your question and you want to do something ONLY when a player is teleported (and not when they move to there by walking or whatever), then you need to something like this:

<code>mob/player/Move() var/atom/saveloc=src.loc .=..() if (get_dir(saveloc,src.loc)>1) //Moved more than one space, must have been teleported else //Otherwise, it was (probably) normal movement</code>

You can then get the area by using the following proc:

<code>proc/GetArea(atom/A) var/turf/T=locate(A.x,A.y,A.z) return T.loc //A turf's location is the area it is in</code>

So you can check if it's a certain type of area by using that and istype():

<code>if (istype(GetArea(src),/area/NoTeleport)) world << "[src] tried to teleport into an area where \he wasn't allowed to. Uh-oh." del src</code>
In response to Crispy
=) THANKS! =)
In response to Crispy
Just an addendum to that: If you use Move() to teleport, you should be careful not to set up an infinite loop. If your teleport destination also allows a teleport back to where you were, you could end up bouncing back and forth until the game crashes.
area/teleport     // also use this code for turf/teleport
var/destination

// Entered() takes 2 arguments; the 2nd is rarely used
// this is where you'd use it
Entered(atom/movable/A, atom/oldloc)
if(oldloc==destination || (oldloc in destination) || (destination in oldloc))
// don't go back or there'll be an infinite loop
return
if(ismob(A))
A.Move(destination)
In this kind of case it pays to check the oldloc argument.

Lummox JR