Can I shoot bullets from this entity, by using this code?:
action playerweapon()
{
minig = my;
VECTOR wpnht;
VECTOR wpnoffset;
set(my,PASSABLE);
while(1)
{
vec_set(wpnoffset.x, vector(50,-18,-20));
vec_rotate(wpnoffset.x, vector(camera.pan, camera.tilt,0));
vec_add(wpnoffset.x, camera.x);
vec_set(my.x, wpnoffset.x);
my.pan = camera.pan;
my.tilt = camera.tilt;
wait(1);
}
}
function rmvblts()
{
ent_create("bullethole.pcx", vector(my.x,my.y,my.z), NULL);
set(my,PASSABLE);
set(my,INVISIBLE);
ent_remove(my);
}
function mvbllt()
{
VECTOR bspeed, trceblt;
set(my,ENABLE_IMPACT);
my.event = rmvblts;
my.pan = camera.pan;
my.tilt = camera.tilt;
bspeed.x = 200 * time_step;
bspeed.y = 0;
bspeed.z = 0;
vec_set(trceblt, vector(75,0,0));
vec_rotate(trceblt,camera.pan);
vec_add(trceblt, camera.x);
while(my!=NULL)
{
c_move(my,bspeed,nullvector,IGNORE_PASSABLE);
if(c_trace(my.x, trceblt, IGNORE_PASSABLE| USE_POLYGON| SCAN_TEXTURE)>0)
{
rmvblts();
}
wait(1);
}
}
function firegun()
{
proc_kill(4);
vec_for_vertex(temp.x, minig, 53);
ent_create("bullet.mdl", temp.x, mvbllt);
wait(0.14);
}
Also do you know why whenever I hit a rigid body (a barrel with a box bounds) the bullet will not destroy itself?
Last edited by fangedscorpion; 08/24/09 17:12.