//my bullet do not removed after impact .and cause ent limit error
action gun_barrel_act{
gun_barrel_ent=me;
my.passable=on;
my.pan=180;
while(1){
wait(1);
if(mouse_left){ent_create("bullet.mdl",my.pos,move_bullet_func);wait(5);
}
}
}
function move_bullet_func{
my.pan=you.pan;
my.roll=you.roll;
my.tilt=you.tilt;
my.skill40=100;
my.ENABLE_IMPACT=on;
my.event=impact_func;
while(mouse_left){
WAIT(1);
ent_move(my.skill40,nullvector);
my.skill40+=20; //speed bullet
}
}
function impact_func{
var pos_tmp;
var pan_tmp;
var roll_tmp;
var tilt_tmp;
vec_set(pos_tmp,my.pos);
ent_remove(me);
if(event_type==event_impact){
wait(1);
vec_scale(normal,10); // produce an explosion into the normal direction
effect(effect_explo,50,pos_tmp.x,normal);
}
}