ID:179727
 
Ok, heres the deal, I have 2 maps, well I want to say.... make a certain tile, when you step on it, take me to the new map, how do I do this?

Thanks
KnightRen
you dont.(not efficiently you dont)
make 1 map, and give it multiple Z layers, then you can switch maps that way. A Z layer is nothing but another map in one map file. Like have 5, 5, 5, thats 5 maps of 5 x 5.

mob
verb
Teleport(myx as num, myy as num, myz as num)
src.loc = locate(myx, myy, myz)

this will teleport you to ANYWHERE on the map that you type in.

FIREking
In response to FIREking
um ok, can you be a little more specific, on the multiple sets, do you mean I have to type in 3 numbers for each coordinate?, like 3 for x, 3 for y, and 3 for z?
You make a new turf that works like this:

turf/certaintile
//turf info here
Entered(mob/M)
if(ismob(M)) // check if M is a mob
M.Move(locate(1,1,2))
// or wherever you want to send them too, just pick the Z location depending on the map.



There is also a more efficient way to do this for if you have many stairways, but that might be a bit complex if you're too new. It's also untested by me, so beware.


var/list/StairList = list()
world/New() // Run at world.new to ensure it doesn't cause lag
..()
for(var/turf/T in world)
if(T.stairway)
StairList.Add(T)

turf/var/stairway
turf/certaintile
//tile information
Entered(mob/M)
if(ismob(M)) // If M is a mob
for(var/turf/T in (StairList() - src))
if(T.stairway == src.stairway)
M.Move(locate(T.x,T.y,T.z))
break



With this code, every time you place a certaintile on the map, just use the editor to edit the tile and change the stairway var, and whenever you enter the tile, it searches the stairlist for any other tiles in the world that have the same stairway value, and warps you the location of the stairway it found.

Keep in mind that I haven't tested it, so it probably needs some debugging, but the concept still works (I've done it before).
In response to KnightRen
You might want to look up locate() in the reference while you're working with this, if you haven't already.

usr.loc = locate(X,Y,Z)

where X is the horizontal value, Y is the verticle value, and Z is the map value.
In response to GateGuardian
Yes i know what x,y, and z mean, now I have another problem, both maps have the z coordinate as 1, now what do I do?
In response to KnightRen
KnightRen wrote:
Yes i know what x,y, and z mean, now I have another problem, both maps have the z coordinate as 1, now what do I do?


Both of them don't have the z = 1, what dream seeker displays is what z levels are in one map file, the first map's z is now 2 because making a new map file pushes the z level of all the previous maps up one, your second map file's z level is 1.
In response to Nadrew
Ok now that I did that, it does 1 of 2 things, when I try the floor and walk on it on the new map, it sends me to a black screen, and when i try it on the old map, it does nothing but makes me walk backwards
In response to KnightRen
KnightRen wrote:
Ok now that I did that, it does 1 of 2 things, when I try the floor and walk on it on the new map, it sends me to a black screen, and when i try it on the old map, it does nothing but makes me walk backwards



You're getting your Z levels confused, or maybe even your x,y coords.
In response to Nadrew
Ok here is what I have


flashingfloor
icon = 'flashingfloor.dmi'
Entered(mob/M)
if(ismob(M))
M.Move (locate (45,170,1))

And I the oldest map selected, but when I step on the tile, it does nothing, just treats it like a normal tile. (And yes the number is correct, its a 200x200 map size)

In response to KnightRen
If it's not doing anything, unless you goofed something up in the code, then you're teleporting yourself to your current location, which would make no difference.

try changing the X,Y coords and see if there's a difference.
In response to KnightRen
KnightRen wrote:
Ok here is what I have


flashingfloor
icon = 'flashingfloor.dmi'
Entered(mob/M)
if(ismob(M))
M.Move (locate (45,170,1))

And I the oldest map selected, but when I step on the tile, it does nothing, just treats it like a normal tile. (And yes the number is correct, its a 200x200 map size)


That code wouldn't work try this:

turf/Flashing_floor
icon='flashingfloor.dmi'
Enter(mob/M)//Notice I used Enter() not Entered()
..()
M.loc=locate(45,170,1)
In response to GateGuardian
It was because you used Entered() wrong and you didn't need the if(ismob(M)) mob/M or mob/M as mob does this already.
In response to Nadrew
Ok, this works fine and dandy now, now 1 more problem, it starts me out right outside of my map, instead of inside, im right outside of my map, and I can see inside, i can even ghostform and go inside, but it starts me out outside....
In response to KnightRen
Ive even changed the z coordinate from 1 to 2, and both start me out in the same place
In response to Nadrew
Actually, the if(ismob(M)) line DOES matter, if it's not there, objs will be teleported as well when entering, and that can cause errors. I just tested it.
In response to GateGuardian
flashingfloor
icon = 'flashingfloor.dmi'
Enter(mob/M)
..()
M.loc=locate (45,170,1)

this is what I have now, I wish you guys would make up your mind, what should I put in now?
In response to KnightRen
Oh yeah, for some reason ive also found out, it thinks the new map is 2, and not 1, opposite of what you said, because when i put in (45,170,2), (still starting right outside of the old map) it will take me to the new map, where the coordinate is.... almost got it figured out, lol, dont quit on me now ;)
In response to KnightRen
anyone there?
In response to KnightRen
That's right, when you've got two sepperate map files, playing the game reads them each as a different Z level. So when you have 2 maps, you have Z level 1 and 2, if you have 50 maps, you have Z level 1 through 50...

What else do you need to know?
Page: 1 2