Coords(varX as num, varY as num, varZ as num)
set name = "Coords"
set category = "GM"
set desc = "X,Y,Z"
if(varX > world.maxx) // if the number they put in is higher than the map's highest point make it go as close as it can, that way they dont go off map and have to relog
src.x = world.maxx
else
if(varX < 1) // if its less than one go to one since you cant have negative map points
src.x = 1
if(varY > world.maxy)
src.y = world.maxy
else
if(varY < 1)
src.y = 1
if(varZ > world.maxz)
src.z = world.maxz
else
if(varZ < 1)
src.z = 1
src.loc = locate(varX,varY,varZ)
Thats my Co-Ordinates code, now say I am on map A, and I want to teleport to the coords 5,5,1 on on B. How would I do this?
.::Dice::.
Say you have Map A with 3 z levels and Map B with 2 z levels, and let's assume these are in ascending order by the character after map.
If you wanted to teleport to coordinates (1,1,3) it would go to the last z level of Map A. But let's say you wanted to go to Map B, the second z level. Well you would use (1,1,5). Now for the explanation. (It is ruff, as I have never described this or looked into it, but I remember reading it awhile back for problems with world.maxx and world.maxy.)
At runtime, all map files are compressed together. That means that your maps will be pushed together, and forced to take the highest x and highest y of the biggest map. Therefore you will have SOME troubles if your maps are of different sizes. To prevent this, you could use a simple if check, instead of all that mumble jumble you have there.
Example:
That is a mere example, and could be added in with more programming to make it efficient. I suggest a loop.
Any questions, feel free to ask.
-XxDohxX