ID:142407
 
Code:
Raikyuu()
set category = "Ninjutsu"
if(src.chakra >= 20000)
src.chakra -= 20000
view() << "<font color=\"blue\">{[src.rank]}{[src.clan]}{[src.village]}<b>[src]</b> \[Say]: </font><font color=\"#005500\">Raikyuu!</font>"
view() << "[src] shoots a lightning strike!"
var/L = null
if(src.dir == NORTH)
L = locate(src.x, src.y-5,src.z)
if(src.dir == SOUTH)
L = locate(src.x, src.y+5,src.z)
if(src.dir == EAST)
L = locate(src.x+5, src.y,src.z)
if(src.dir == WEST)
L = locate(src.x-5, src.y,src.z)
var/obj/raikyuu/P = new(src.loc)
var/dst = get_dist(P,L)
do
step_towards(P,L)
dst = get_dist(P,L)
sleep(2)
while(dst > 1)
var/d = 2*src.ninjutsu_strength
for(var/mob/M in P.loc)
M.hp -= d
view() << "[M] lost [d] health!</b>"
deathcheck(M)
del(P)
else
src << "You don't have enough chakra!"


Problem description:

Whenever I shoot the lightning, the lightning always goes down, no matter what direction the player is facing.
Couldn't you just make it walk() 5 tiles? And how you're doing it, it only hurts if the opponent is 5 tiles away.

Depending on the density of the projectile, you could use Bump() to make it damage others, and use Move() to check for people every time it moves.

This is another alternative I just thought of:
var/obj/projectile/P=new(loc) //Create a new projectile.
P.dir=dir //Change the projectile's direction to the shooter's.
for(var/n=5,n,n--) //A for() loop, looping 5 times.
for(var/mob/m in get_step(P,P.dir)) //Check for people.
//damage m
step(P.dir) //Move.
sleep(2) //Movement delay.
That code needs to be redone a little to make it more efficient. Also, you should make individual procs to handle certain aspects of the attacks so you don't use 10000 lines just to add 100 or so attacks.

Raikyuu()
set category = "Ninjutsu"
if(src.chakra >= 20000)
src.chakra -= 20000
view() << "<font color=\"blue\">{[src.rank]}{[src.clan]}{[src.village]}<b>[src]</b> \[Say]: </font><font color=\"#005500\">Raikyuu!</font>"
view() << "[src] shoots a lightning strike!"
var/obj/raikyuu/P = new(src.loc) //^that's all your stuff
P.d = 2*src.ninjutsu_strength //set its damage
walk(P,usr.dir,2)//move it in the usr's direction
else // \/ your stuff again
src << "You don't have enough chakra!"

obj/raikyuu
//have all your obj properties here
var/range = 5 //make a range variable
var/d //make a damage variable
Move() //Everytime the projectile tries to move
..() //let it move
range-- //subtract 1 from its range
if(range<=0) //if its range is less than or equal to 0
del(src) //delete it
Bump(var/mob/M) //when it bumps something (an atom of some sort. This is not called when it hits the edge of the map!)
if(ismob(M)) //if it bumps a mob (you have to check to prevent errors)
M.hp -= d //subtract its damage from the bumpee's hp
view(Center=M) << "[M] lost [d] health!</b>" //say that to everything within the bumpee's view
deathcheck(M) //call deathcheck
del(src) //delete it


I recommend making a single projectile object to handle all projectiles and then you should make another proc that "creates" the projectile (sets all it's variables like you would set them in the attack). That way, you only use about 3 lines per attack.