Ok, then I suggest you try c_move.

This code works:

Code:

...
ent_create ("bullet.mdl", my.x, bullet_behaviour);
...

function bullet_behaviour() {
var covered_distance = 0;

vec_for_angle (my.x, you.pan);
vec_scale (my.x, 10);
vec_add (my.x, you.x);

vec_set(my.pan, you.pan);

//we need to store the you (parent entity) because it will be emptied after the next wait(1)
ENTITY* parent_ent = you;

while (me) {
you = parent_ent; //search back for the parent entity
covered_distance = c_move (me, vector(40 * time_step, 0, 0), nullvector, IGNORE_YOU); //move 40 quants ahead and ignore the parent entity

//bullet is stuck on impact, do possible damage and remove
if (covered_distance <= 0) {
you = c_trace (target.x, target.x, IGNORE_ME); //search for the entity hit
if (you) {you.health -= 5;} //If theres an entity, remove health. or whatever you had in mind ;)
ent_remove(me); //ptr_remove(me) if you have the newest version
}
wait(1);
}
}




Last edited by Joozey; 01/14/08 23:02.

Click and join the 3dgs irc community!
Room: #3dgs