How do you make the user go to different dmps instead of just going to the first dmp file insteantly? like how can I make players warp to different dmps?
(I moved this to coding problems)
ID:148956
Aug 5 2002, 9:28 pm
|
|
Aug 5 2002, 9:42 pm
|
|
Maps are stacked on top of each other. To change to a different map, change the z level. You can also use objects with tags and (using locate()) find out which z level they are on. (So you can refer to maps by name rather than number, as the number can change during development.)
|
MartialArtistAbu wrote:
How do you make the user go to different dmps instead of just going to the first dmp file insteantly? like how can I make players warp to different dmps? Just for future reference, Code Problems isn't the correct forum to post a question if you don't have any code to debug. A better place would be Newbie Central. Lummox JR |
It does seem maps are stacked on top of each other.
For example, if I have two maps "alpha" and "beta", where "alpha" has 4 z-levels and "beta" has 3 z-levels, and I create a teleport verb for my own mob: Map "alpha" is stacked first, then map "beta" second. If I want to teleport to the first z-level of map "beta", I could teleport so that my location (x,y,z) = (1,1,5) This puts me just past the 4 z-levels in map "alpha", at the first z-level in map "beta". I like to think of it as a very tall building, even a skyscraper. Map "alpha" starts at the first floor, then moves up floors until there are no more floors in "alpha". That is where map "beta" begins. (So the first floor of beta is actually, in this case, floor 5 of the building.) --- For a long time I thought it was impossible to teleport between maps. I hope this is of some value to some one. --- P.S. However, many people creating maps don't know how many levels they want at first. This could cause problems when teleporting something if the location it was teleporting became different as the map size was increased. One solution is to just have the map(s) at the bottom of the stack maps that don't change size as the game is in creation. For example, I could make a game like Dragon Warrior, and have each player teleport to his or her own z-level of a "battle_map". Each z-level would be the same, just a space to do battles in, and I could just create 100 or 1000 if I think I'll have that many players. I wouldn't have to change that map's size, ever, unless my game suddenly became popular and over 1000 people started playing, in which case I should quit using byond and get in with an online computer gaming company. |
In response to Woo
|
|
I've just discovered how to use locate() proc to find the first z-level of a map stacked on another map, as happens when there are multiple maps in the same game.
--- How to do it: Create an object (or turf, etc.) to hold what is called a "tag". (This tag will be used to reference the object.) You could create special objects with their own type in your code, but it easier to just give identical objects tags. Stick each of the identical, possibly icon-less objects in the lower-left corner of the first z-level of each map in your game. Right-click the object and change the tag of the object to any special tag for each map. (A good practice would be to make the tag identical to the name of the map. For example, if I have a map named "world.dmp", make the tag of the object "world". This is better than making the tag "map1" or "map2" because if you decide to make another map, it might be in the middle of those two in the stack of maps.) While the game is running, use locate() to find the tag. That will return the object that the tag is in. Then you know where the first level of that map is because you have the object's z value. Here is example code for a verb any mob can use to find the first z-level of a map, where an object with an unknown name has a tag equal to the string "map2": mob/verb/find_map2() var/obj/O = locate("map2") var/ZZ = O.z world << ZZ This gives the first z-level of 'map2.dmp' (assuming an object was created and given the tag "map2" and put on the first z-level of 'map2.dmp') |
In response to Woo
|
|
If you're going to be using tags anyway (which can only be assigned at runtime), then you might as well just use usr.loc = locate("TeleportExit").
|
In response to Garthor
|
|
Garthor wrote:
If you're going to be using tags anyway (which can only be assigned at runtime), then you might as well just use usr.loc = locate("TeleportExit"). Except for the fact that you would be warped to the lower-left hand corner of the map. After all, his method only uses the object to check the z level, not as the actual target landing zone. |
In response to Polatrite
|
|
I know. I implied that you would move it to the target, or set the target turf's tag.
|