ID:270558
 
I was trying to put together a world code so when a mob walks over an icon like a set of stairs, it will take them to another level, or walking over a city icon with take you to a city, but it didn't work so well, can someone help me out?
Err... world code..? Right. Well this is what you wanted.

turf
door
Entered(mob/M)
M.loc=locate(x,y,z)//fill in the x, y, and z coords.


Or if you want a way that you do not have to pick x, y, and z locations all the time you can do this...

turf
doors
enter
one
two
Entered(mob/M)
for(var/turf/doors/exit/E in world)M.loc=locate(E.x,E.y,E.z)
exit
one
two
Entered(mob/M)
for(var/turf/doors/exit/E in world)M.loc=locate(E.x,E.y,E.z)

In response to Exophus
Or more bugfree;
turf/Entered(var/atom/movable/a)
if(ismob(a))
var/mob/M=a
...


Always check if the thing that is entering IS a mob. What if it plainly isn't a mob? :|
In response to Mysame
A bit more organised:
turf/Entered(var/atom/movable/a)
if(!ismob(a))
... //stuff for non-mobs here
return
var/mob/M=a
... //your stuff for mobs

//See? It saves you from a tab, in big complicated procs they can get quite
//annoying -- which is why you should always keep them minimal. But I believe that's
//rather a matter of opinion. >_>


O-matic
Okay, I got that, I have another question...what about making a sign readable. After this I can get everything else downpat, but I was reading in the demos and libraries and saw nothing..
In response to Magnel Productions
One method
obj/Sign
var/smsg//Edit this var on the map for a message
Click() Read()
verb/Read()
usr<<smsg


- GhostAnime
In response to O-matic
Ahh, yes. I usually don't bother to show that on the forum as I would think most people should know that by now. Eh, I'll show just in case from now on to be safe.

-Exophus
In response to Exophus
Well thanks though.
In response to O-matic
Though, O-Dutchy, what if it should also do something when a certain obj enters? =P. Like trees that get fire after being Entered by a fire attack! :<