ID:180193
 
I have a question about linking maps together. I've notice in almost all the finished games when where walking and u come to the end of the map and u can see black turf and u keep waling and it take u to a different map, how do u do that. I know u use locate=(x,y,z) but do u have to go up to file,new and make a new map or what. This question has been bothering me for a while I would appreciate any help i can get on this.
Tatakau wrote:
I have a question about linking maps together. I've notice in almost all the finished games when where walking and u come to the end of the map and u can see black turf and u keep waling and it take u to a different map, how do u do that. I know u use locate=(x,y,z) but do u have to go up to file,new and make a new map or what. This question has been bothering me for a while I would appreciate any help i can get on this.

You can have a second map, or you can set the number of levels for one map, using the Options menu.
In response to Deadron
Deadron wrote:
Tatakau wrote:
I have a question about linking maps together. I've notice in almost all the finished games when where walking and u come to the end of the map and u can see black turf and u keep waling and it take u to a different map, how do u do that. I know u use locate=(x,y,z) but do u have to go up to file,new and make a new map or what. This question has been bothering me for a while I would appreciate any help i can get on this.

You can have a second map, or you can set the number of levels for one map, using the Options menu.

I think he wants to know how to move somebody to the 2nd map FILE , and so do i, i havnt ever done that :)
In response to Sariat
Sariat wrote:
I think he wants to know how to move somebody to the 2nd map FILE , and so do i, i havnt ever done that :)

When you compile two map files in one project, the second map file will be on z-level 2. Perhaps the z-levels will be stored in alphabetical map order? Check it out.
As for the moving across maps, an easy way to link maps together is to use areas and tags. When someone enters an exit area, they are moved to an area with a specified tag. And using the x and y-coordinates of the player, you can locate them at the same coordinate location as the previous map.


/Andreas
Tatakau wrote:
I have a question about linking maps together. I've notice in almost all the finished games when where walking and u come to the end of the map and u can see black turf and u keep waling and it take u to a different map, how do u do that. I know u use locate=(x,y,z) but do u have to go up to file,new and make a new map or what. This question has been bothering me for a while I would appreciate any help i can get on this.

Easiest way to do this is define a special type of area or turf called teleport. Which you use (area or turf) depends largely on what you want to do with it - but either will work. Area is more flexible because you can put lots of different types of turfs on top of it.

So first, define it:

area/teleport

Cool. Now, what do we want to have happen? When you get to the edge of the map, you should be teleported to a new map level (Z level) somewhere. How do we know when the player reaches the edge? We make the map spaces along the edge all have area of /area/teleport. Then we use the Entered() proc. That proc gets called any time a player enters the teleport area.

So, now we have:

area/teleport
Entered(mob/M)

What do we want to put in there? Probably the code to relocate the player to the new map level. But how do we know where that is? We could hardcode the x,y,z values in a locate() call, but that would be silly! What if we change the map around later on? Then it probably won't work and we have to go back and change every single one.

So here's an approach that's worked well for me. In each unique area, set its tag in the map editor to something that uniquely identifies it. Like "Level1Start" or "Level2Dungeon." Whatever. Now we know how to identify the destination when we teleport the player. But wait, how do we know which destination any particular teleport wants to go to? Easy, just add a new var to area/teleport called destination. It'll hold the tag of the destination area. You can set this in the map editor too.

So now we have:

area/teleport
var/destination

Entered(mob/m)

Now we're ready to fill in the Entered() proc. What do we want? Move the player (m) to the destination. We probably want Move instead of locate because if the destination is blocked (somebody else is standing there), the player shouldn't be able to go, right? But then again, maybe not in your game, so you'll have to decide which you use.

Here's what I'd do:

Entered(mob/m)
var/dest = locate(src.destination)
if (dest) // if no destination set in the map editor, don't do anything
m.Move(dest)
else
. = ..()

Now, in the map editor, you have to set the tag vars of all your possible teleport destinations. Then set the destination vars of all your teleport areas to be the tags of their actual destinations.

Example: on the right edge of Z level 1, I want players to go to the left edge of Z level 2, just as if it was continuous. So on the left edge of Z level 2, I set the tag vars to something like "Left2" in the map editor. Then on the right edge of Z level 1, I set the destination vars to "Left2". If I want players to be able to go back the same way, I do the opposite: set tags of right edge, Level 1 to "Right1" and destinations of left edge, level 2 to "Right1".

Easy!

There's more you can do with this - for example, if your area runs along the entire side of the map, you're not guaranteed to teleport to the same x or y coordinate on the new level. You could use a combination of tags and checking x,y coordinates as Gazoot suggests in this case.
In response to Gazoot
how do i make it so when i walk on a tile i get transpoted to a diffrent map
In response to Aaron3
He just told you :)

Here's a hint:

Entered(mob/M)
usr.loc = locate(1,1,2)
usr << "Oh my, Toto... we sure aren't in Kansas any more!"
usr << "We represent the lollipop guild!"
usr.loc = locate(34,128,2) // move them to Lollipop Guild HQ.
view() << "Where can I find the nearest Dominos?"
In response to Lord of Water
i put this and
Entered(mob/Alien)
usr.loc = locate(1,1,2)
usr << "Oh my, Toto... we sure aren't in Kansas any more!"
usr << "We represent the lollipop guild!"
usr.loc = locate(34,128,2) // move them to Lollipop Guild HQ.
view() << "Where can I find the nearest Dominos?"




loading Aliens.dme
The Alien.dm:1312:error:Entered :undefined proc

Aliens.dmb - 1 error, 0 warnings
In response to Lord of Water
Lord of Water wrote:
He just told you :)

Here's a hint:

Entered(mob/M)
usr.loc = locate(1,1,2)
usr << "Oh my, Toto... we sure aren't in Kansas any more!"
usr << "We represent the lollipop guild!"
usr.loc = locate(34,128,2) // move them to Lollipop Guild HQ.
view() << "Where can I find the nearest Dominos?"

But please only regard this as a hint, not as something you should actually use! First, using locate() on hardcoded numbers for x,y,z is bad because then it seriously limits you when you want to change your map around later. Try using tags as I explained. Second, usr is not well defined here! Why is mob/M even in the call if you are going to use usr instead? Use M.

turf/Entered(mob/M)
M.loc = locate(1,1,2)
M << "Oh my, Toto... we sure aren't in Kansas any more!"
M << "We represent the lollipop guild!"
M.loc = locate(34,128,2) // move them to Lollipop Guild HQ.
view(M) << "Where can I find the nearest Dominos?"
In response to Aaron3
Aaron3 wrote:
i put this and
Entered(mob/Alien)
usr.loc = locate(1,1,2)
usr << "Oh my, Toto... we sure aren't in Kansas any more!"
usr << "We represent the lollipop guild!"
usr.loc = locate(34,128,2) // move them to Lollipop Guild HQ.
view() << "Where can I find the nearest Dominos?"




loading Aliens.dme
The Alien.dm:1312:error:Entered :undefined proc

Aliens.dmb - 1 error, 0 warnings

Thats why he said heres a hint. You dont paste hints into your code. Look at the turf/Entered proc. U think by pasting that "hint" in, its gonna magically do everything you need?
In response to Ebonshadow
Plus, you're going to find yourself in downtown Lolipopville...


lol