mob/verb
ThrowBomb()
set category = "Battle"
if(usr.AttackTarget in view(usr))
var/mob/M
M = usr.AttackTarget
var/turf/t = M.loc
var/turf/LastPlace = null
var/check = 0
while(usr.loc != t && check == 0)
LastPlace = locate(usr)
step_to(usr,t,0,32) //(D,t)Fallow
if(LastPlace == locate(usr))
check = 1
sleep(1)
world<<"Boom"
Problem description:
I've been helping a friend out with making new abilities and such in his game, and he wanted a 'throw' type skill, that would step to the location of the mob that you're targeting(for usr.AttackTarget, it's a reference to a mob, which is set via Click()), if you want to do that; or you could do it the old-fashion way, taking that out and putting in a input asking for the mob to attack) at the moment you use the move, not 'homing' in on them, but just going to where they were when the skill was used.
I've tried using a if(!step_to()) break statement, which(according to the reference), should work. Then I tried manually checking their last location and their current location(He wants to avoid checking via Move()). He also intended this to 'flash' to them each step, moving three step sizes each step, but when setting the step_size in step_to, it still defaults back to the 32 step_size of the usr. I explained to set it to something divisible by 32, which still did not work. Is there something with tile movement that messes this up, is it just something defined in his movement returning negative and still placing the mob there or is it just a bugged step_ system?
Update: He was playing around with it, and apparently putting in a sleep(2) will fix this, but not a sleep(1), would this mean step_to doesn't return right-away?