var/map_names[] = list('001.dmm','002.dmm','003.dmm') //Global list to hold map_names, so we don't have to search the world.
obj/map_name
icon = 'map object.dmi' //This is so you can see the map_name in the mapper
invisibility = 101 //Set to maximum invisibility, so it cannot be seen in game
New(loc, set_tag)
tag = set_tag
spawn(1)
map_names += src
return ..(loc)
Del()
map_names -= src
return ..()
proc/map_Locate(x, y, z_name) //Upgraded locate() that lets you specify a map_name instead of a z level ie. Locate(5,9,"forest")
if(istext(z_name))//Uses a name
var/obj/map_name/O = locate(z_name) in map_names
if(O)
return locate(x, y, O.z)
else
return null
else //Uses old-style number
return locate(x, y, z_name)
proc/map_zname(num) //Returns the name of the z level num
for(var/obj/map_name/O in map_names)
if(O.z == num)
return O.name
return null //This z level is not named!
Problem description: I'm trying to make it so when players enter an object they're teleported to another map.
I'm making a Silent Hill fan-game and would love to have buildings that once players enter they're sent to the interior map.
area
HappyBurger
Enter()
usr.loc = map_Locate(5, 2, "003")
I can't figure out how to get this code to work for me.
then call map_Locate(some x value, some y value, "happy burger").
Incidental: Don't use usr in procs, /especially/ movement procs. What do you think usr is if an NPC walks into the area? Also, you should use Entered(), not Enter().