ID:139694
 
Code:
        MD_MProjectiles(action,delay,dmg,JAB)
var/left=9
while(left)
spawn()Projectiles(action,delay,dmg,JAB,left)//Projectiles(Action,delay,dmg,JAB,dir)


Problem description: It makes 8 projectiles that is supposed to spawn in different direction,except one of the projectiles doesn't go in a different direction. I need it to spawn in 8 different directions(unless it makes 9 projectiles but one is stuck in usr and the other one is in the same dir as one of them) or I could go back to my old code.

Well, you've shown absolutely nothing there that would do anything like what you describe, so I'm going to assume your problem is that you are not doing anything like what you describe.

Try doing something like what you describe.
In response to Garthor
It makes 8 projectiles. I want each projectile to face in a different direction. NORTH, SOUTH, EAST, WEST, etc. My problem is that two of the projectiles spawn in the same direction. I have another code that can do what i want, but the code I posted is way shorter then my other code.

edit: I know it doesn't do what I planed it to do. I was hoping to know if i could change the numbers to make it work or make a second var.

In response to RichardKW
You still have not shown a single line of code that does what you are describing. Therefore, I still stand by my original evaluation.
In response to Garthor
        MD_MProjectiles(action,delay,dmg,JAB)
var/left=9
while(left)
spawn()Projectiles(action,delay,dmg,JAB,left)//projectiel dir=left
left--
Projectiles(action,delay,dmg,JAB,dir=src.dir)
var/obj/attack/A=new(src);A.dir=dir
A.icon_state=action
//etc.

In response to RichardKW
There you go, that's what we needed.

Your issue is that you are spawning nine projectiles, with dirs of 1, 2, 3, 4, 5, 6, 7, 8, and 9. The cardinal directions are NORTH=1, SOUTH=2, EAST=4, WEST=8, with other directions being sums (technically, the bitwise OR, but they're equivalent here) of these directions. So, your nine directions are NORTH, SOUTH, NORTH|SOUTH, EAST, NORTHEAST, SOUTHEAST, NORTH|SOUTH|EAST, WEST, and NORTHWEST.

Naturally, two of these directions do not make any sense.

Your best solution would be to use a global list of the valid directions, and iterate through that. You could alternatively also use the turn() proc, but that would involve a bit more overhead.
In response to Garthor
Thanks.