mob
proc
Kaitendps()
loop
if(src.inKaiten)
for(var/mob/Z in oview(2))
var/damage = src.Tai*2.12
Z.health -= damage
view(Z)<< "<b><font size=1 face=verdana color=red>[Z] was hit by [src]'s Hakkesho Kaiten for [damage] damage!"
sleep(15)
Z.Death(src)
if(Z == null)
return
if(!usr.inKaiten)
usr<<"<font size=1><font face=verdana><font color=white>Your rotation has stopped."
return
goto loop
Problem description:
Sigh* How do I make it so that when the target is no longer in oview(2) the loop stops? it goes infinite loop whenever the target goes out of range or if there is no target.
Step two: I would recommend using a while() loop to keep it going while inKaiten is true.
As for the target, just do a check at the beginning of the for() loop - if(!Z) break. So something like this could be done:
One key thing in there to note: oview(2,src).
Take special care in just doing oview(2), because the default argument for the Center is usr, and depending on where this procedure is being called from, using usr could cause some funky output or even make it not work.
EDIT: You should also add a sleep delay in that while() loop so it isn't doing damage every tick. That would be devastating.