ID:147453
 
Ok, So im working on this move in my game that makes some one warp to a turf that is 3 or less tiles away, This is what I have come up with so far... But.. it crashed dreamseeker the second they click that location.


turf
DblClick()
if(usr.Race=="Vampire")
var/turf/L = usr.loc
while(L != 0)
L = get_step_away(L,src,3)
if(L == src.loc)
usr.Move(src.loc)
else
usr<<"You can not swift there!"
Rollerc wrote:
Ok, So im working on this move in my game that makes some one warp to a turf that is 3 or less tiles away, This is what I have come up with so far... But.. it crashed dreamseeker the second they click that location.


turf
DblClick()
if(usr.Race=="Vampire")
var/turf/L = usr.loc
while(L != 0)
L = get_step_away(L,src,3)
if(L == src.loc)
usr.Move(src.loc)
else
usr<<"You can not swift there!"

I don't get what all the extra stuff there is for, but your problem is with while(L != 0). L will never equal zero with that, so that will loop forever. Why can't you just do if(usr.race=="vampire")usr.loc=src?
In response to Loduwijk
The person could then move threw walls, I dont want that.

edit: Also, wont it reach 0 if the target's too far away?
In response to Rollerc
Rollerc wrote:
The person could then move threw walls, I dont want that.

Ok, I think I see what you want. Here is a reply I made to someone who asked for the same thing as what I think you want: [link] .
edit: Also, wont it reach 0 if the target's too far away?

Ah yes, you are correct there. My mistake.
In response to Loduwijk
Ok so im right, That doesn't help my problem =).
In response to Rollerc
Rollerc wrote:
Ok so im right, That doesn't help my problem =).

What is that supposed to mean?
In response to Loduwijk
Means I still dont know what the problem is..
In response to Rollerc
Then I must not understand what your problem is. Try to explain a bit better.
In response to Loduwijk
Thanks for your help, Your proc worked perfectly =).