ok, i'll post the code that was used with 6.3:
Code:
function bullet_event()
{
if (event_type == event_block)
{
c_trace(my.pos, your.pos, SCAN_TEXTURE);
if (tex_flag1)
{
ent_create("bulhole.tga",my.x,bullet_hole);
spark01_action();
}
if (tex_flag2)
{
ent_create ("bulhole.tga", my.x, bullet_hole);
}
if (tex_flag3)
{
ent_create ("bulhole.tga", my.x, bullet_hole);
}
my.bullethit = on;
ent_create ("cool_explo+9.tga", my.x, spark_spr_efx);
}
if (event_type == event_entity)
{
you.skill73 = 0;
you.skill72 *= 5;
if (you.blocking == 0)
{
you.health -= 5;
}
spark01_action();
wait(1);
my.bullethit = on;
//ent_create ("cool_explo+9.tga", my.x, spark_spr_efx);
ent_create ("dust+8.tga", my.x, dust_spr_efx);
sleep(10);
you.skill72 /= 5;
}
}
action bullet_move
{
//ent_create ("block.mdl", my.x, scan_block_act);
make_passable();
my.skill40 = 1;
my.scale_x = 0.5;
my.scale_y = my.scale_x;
my.scale_z = my.scale_x;
my.bright = on;
max_dist = 20000;
if (you.skill70 == 0)
{
turn_towards_target();
}
else
{
my.pan = you.pan;
my.tilt = you.tilt;
my.roll = you.roll;
}
my.enable_block = ON;
my.enable_entity = ON;
my.event = bullet_event;
while (my.skill20 < max_dist && my.bullethit == off)
{
move_mode = IGNORE_YOU + IGNORE_PASSABLE + IGNORE_PUSH + ignore_sprites;
my.skill20+= ent_move(vector(1000 *time,0,0),nullvector);
wait(1);
}
ent_remove (me);
}
function turn_towards_target()
{
vec_set(temp,vector(9999999,0,0)); //Set temp to a 2000 quant long line
vec_rotate(temp,camera.pan); //Rotate line by camera
vec_add(temp,camera.x); //Align temp with the camera
trace_mode = ignore_me + ignore_you + ignore_passable + ignore_sprites; //Or whatever you want
result = trace(camera.x,temp.x); //Trace between them, may want to use c_trace
if(result == 0) //Nothing was traced
{
vec_sub(temp,my.x); //Take my pos out of the trace-to location
vec_to_angle(my.pan,temp); //Point towards it
}
else
{
vec_set(temp,target.x); //Get the traced location
vec_sub(temp,my.x); //Take my pos out of the equation
vec_to_angle(my.pan,temp); //Point towards it
}
}
function spawn_bullet_chaingun()
{
var bulletCreatePos[3];
bulletCreatePos[0] = 85;
bulletCreatePos[1] = -42;
bulletCreatePos[2] = -5;
vec_rotate(bulletCreatePos, my.pan);
vec_add(bulletCreatePos, my.x);
ent_create("bullet.mdl", bulletCreatePos, bullet_move);
ent_create("m_flash.mdl", bulletCreatePos, muzzle_cgun2);
}
this is most of the relevant (and irrelavent) bullet code, the way a bullet is created is in the player's fire function, i call spawn_bullet_chaingun(); after setting the firetime, etc. please use it for reference, and see how it used to work, if any of you have played PreVa's beta demo, you'll know that this code worked perfectly fine then, but now it's not working at all, it gives a completely different result, and it's caused from the turn_towards_target function...