//my bullet do not removed after impact .and cause ent limit error
define _hit, flag7;
define _sp, skill40;
define _normal, skill50;
define _tm1, skill69;
define _reloadTm, skill70;
function wpf_bullet1();
function wpf_bulletEvent();
STRING md_bullet1 = "bullet.mdl";
ENTITY* wp_eBarrel;
action gun_barrel_act {
wp_eBarrel = me;
my.passable=on;
my.pan=180;
my._reloadTm = 16 * 1.5;
while(me != NULL){
if (my._tm1 <= 0) {
if (mouse_left) {
my._tm1 = my._reloadTm;
ent_create(md_bullet1, my.x, wpf_bullet1);
}
}
wait(1);
}
}
function wpf_bulletEvent() {
if(event_type == event_impact
|| event_type == event_entity){
my.event = NULL;
my._hit = on;
vec_set(my._normal, normal);
}
}
function wpf_bullet1() {
vec_set(my.pan, you.pan);
my._sp = 100;
my.ENABLE_IMPACT=on;
my.event = wpf_bulletEvent;
while(me != NULL) {
if (my._hit == ON) {
break;
}
ent_move(my._sp, nullvector);
my._sp += 20 * time; //speed bullet
wait(1);
}
if (my._hit == ON) {
vec_scale(my._normal ,10); // produce an explosion into the normal direction
effect(effect_explo, 50, my.x, my._normal);
}
ent_remove(me);
}