Problem description:
Hello there,
I have a question:
How do I make a user relocate to a random area, not a specific location but a general area, so that in case another player also relocates to that area, they are not on-top of that other player?
Red Dragon
![]() Dec 28 2013, 5:22 pm
|
|
You can use rand() procedure to generate a random location. You can save these values if you want players to respawn at the same point.
|
You could take the location that you are trying to take them to so like say a "warpPad" turf, and do something like:
proc If you have more z levels you would have to change the third parameter Whenever you called the proc you would pass in the turf that you are setting as the warp "focus" as the arguement. |
I tried to do that, but I am not sure how to add multiple x,y,z values to one rand statement
|
You could:
src.loc = locate((warped.x+rand(1,5)), (warped.y+rand(1,5)),1) However, that is much harder to read. |
maybe this will help use a random and add some differents locates
usr.random=rand(1,10) |
Now I'm getting an error though:
src.loc: undefined var This is the code I used: var warpX warpY warpX = floor.x + rand(1,14) warpY = floor.y +rand(1,8) src.loc = locate(warpX,warpY,1) |
Another proc is calling the proc, it is basically an auto-checker, and if the user doesn't pass, they move to that location.
|
Ok then we need to pass a refrence as the src of the second proc is the proc that called the new proc, if that makes sense.
So now what is this "warp" proc called? |
Ok so in the first proc we need to pass the player into the new proc so in theoriginal proc we need to do:
teleport(src) Now with the teleport proc we will need to initilize the refrence and then use that. proc |