Here's the action of the troublesome machine gun bullets... I'll also post the function which creates them, just in case the problem is tied to that...

Code:
........................

// This is from the tank's action, and initiates the function to fire bullets
if(mouse_right){fire_turrmg();}

......................

// Function used to fire machine gun (still needs sound bug fixed)
function fire_turrmg()
{
   
   snd_stop(hnd_MGfire);
	hnd_MGfire = ent_playloop(player,snd_792MG,70);
	
	var firing_ang;
	VECTOR mg_barrel;
	vec_for_vertex(mg_barrel,player,28);
	
	 ent_create("MG_bullet.mdl",mg_barrel,mg_action);
  
   wait(-0.04);
   
   if(!mouse_right){snd_stop(hnd_MGfire);}
   
}


.................
// Action to handle machine gun bullets
action mg_action()
{
	
  wait(1);
  
   ang_for_bone(my.pan,player,"turret_bone");
  	ang_rotate(my.tilt,vector(Turr_Ang,0,0));

  c_move(me,vector(15,0,0),NULLVECTOR,IGNORE_YOU);  
  c_setminmax(my);
  
  	phent_settype(me,PH_RIGID,PH_BOX);
	phent_setmass(me,0.012,PH_SPHERE);//45kg
	phent_setfriction(me,100);
	phent_setdamping(me,2,100);

  	phent_addvellocal(my, vector(2000,0,0), nullvector);
wait(1);

  my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY | ENABLE_IMPACT); 
  my.event = impact_mghit;


  set(my,POLYGON);
  set(my,BRIGHT);
  set(my,METAL);
  set(my,INVISIBLE);

var mps;

 while(1)
 {
 	
 	phent_getvelocity(my,mps,NULLVECTOR);

 	wait(1);
   tracerglow.x = - 20; tracerglow.y = 0; tracerglow.z = 0;
	vec_rotate(tracerglow,my.pan);

 	VECTOR tail;
   vec_for_vertex(tail,me,1); 
   
   effect(effect_smktrail, 1, tail,tracerglow);
	
   effect(effect_tracer,1,tail,tracerglow);
   
   vec_rotate(tracerglow,my.pan);
   
   kill_bullet();
   
  wait(1);
 	
 }

wait(1);  
	
}

.................................

// Oh, and here's the event function

function impact_mghit() 
{
  switch (event_type)
  {
///////////////////////////////////////////////////////////////////////////////////////////////////  	
    case EVENT_IMPACT:
    wait(1);
    
    VECTOR placement;
    placement.x = my.x; placement.y = my.y; placement.z = my.z;
    
    effect(effect_sandhit,5,vector(my.x,my.y,my.z),NULLVECTOR);


    wait(1);
    ent_remove(me);   

///////////////////////////////////////////////////////////////////////////////////////////////////      
    case EVENT_ENTITY:
    wait(1); 

    VECTOR placement;
    placement.x = my.x; placement.y = my.y; placement.z = my.z;
    
    effect(effect_sandhit,5,vector(my.x,my.y,my.z),NULLVECTOR);

    wait(1);
    ent_remove(me);   

///////////////////////////////////////////////////////////////////////////////////////////////////    
    case EVENT_BLOCK: 
    wait(1);

    VECTOR placement;
    placement.x = my.x; placement.y = my.y; placement.z = my.z;
    
    effect(effect_sandhit,5,vector(my.x,my.y,my.z),NULLVECTOR);

    wait(1);
    ent_remove(me);   

    
  }
} 




I think that's all the relevant parts of the code. Funny thing is, the MG bullets are handled almost exactly like the main gun's 75mm bullet (big cannon), but those work perfectly. The MG bullets just act funny sometimes, and won't run their event.

Oh, if you're wondering what the c_move instruction was for, it's to make sure the bullet is carried outside the tank's bounding box before initiating physics and applying velocity. I originally had a problem where firing the gun while the turret faced straight ahead caused rounds to strike the inside of the BB. The c_move instruction fixed that for the main gun's HE rounds. So I used the same thing for the MG rounds.

EDIT: I noticed I've been using some American military jargon, and some of you may not be familiar with it, heheh. So just in case:

MG = machine gun
HE = High Explosive
75mm = The size of the tank's main gun's bullets (in this case)

laugh

Last edited by Jaeger; 05/25/09 22:48.