Well, I modified my code and editted it into my previous post. But here's the edittable anyway

PRE
k=x // Don't even ask 
//Sets it so that the bullet gets destroyed after a certain time.
if distance_to_object(object0)>1600
{
instance_destroy();
}
for (a=0;a<=speed;a+=1) //For loop cycles through the speed values to find the nearest object in bullet path piece by piece.
{
if collision_point(k+xv*a, y+yv*a, swswsw, 0,1) &&z+zv*a<=32 && z+zv*a>=0
{
i=collision_point(k+xv*a, y+yv*a, swswsw, 0,1)
d=a
global.zb=z+zv*a //Just a debug value.
with (i)
{
instance_destroy(); // Destroys the enemy.
}
m=instance_create(k+xv*d,y+yv*d,splash) //This is just like...a decal or whatever. It's to show where the bullet hit.
m.z=z+zv*d //Sets the z of the decal.
instance_destroy(); //Destroys the bullet.
break; // Ok, you found someone! Stop looking
.
}
else
{
i=noone; // If I is noone, then just continue until the loop ends or i becomes....someone o.O
continue;
}
}
Well, it seems I can get the proper distance now, and thus the proper x,y and z values. I'm now however, presented with a new problem. Sometimes the bullet just seems to go through the object at random, and I am literally stumped now as to what the problem might be.
I apologize for being such an idiot if its simple, I'm just getting my feet wet with this.
Also, I think I may have done a for loop too many, but that isn't the problem here anyway. And I used collision point at the beginning rather than collision line, as when two objects are on the same line, it takes the ID of the last one instead (atleast, that's what it seemed like it was doing).
Edit: Cleaned up my code so that it is far more readable and removed some useless lines.
Edited by GdaTerry, 20 December 2009 - 06:36 PM.