string mg_bullet = <bullet.mdl>;
entity* bullete;
entity* art;
var art_speed;
var fall_speed = 0;
sound artillerie="art.wav";
sound art2="art.wav";
sound stein="stein.wav";
function explode_rocket3();
function bullet23();
function animate_explosion();
string explosion_pcx = <explo+6.pcx>;


function artillerie2()
{
	
	while(1)
	{

		ent_create (mg_bullet, my.x, bullet23);
		wait(1);
      		sleep(random(10));
		
		
	wait(1);
}
	
}
action art4
{
	art=me;
	artillerie2();
}
function bullet23()
{
	bullete=me;
	mg_gun();
	my.pan = art.pan;
	my.tilt = art.roll;
	my.x +=random(1000);
	my.y +=random(1000);
	my.enable_impact = on;
	my.enable_block = on;
	my.enable_entity = on;
	my.transparent=1;
	my.event=explode_rocket3;
	my.skill5 = 1; // used for vertical movement
	art_speed.x = 0;
	art_speed.y = 0;
	art_speed.z -= 10;
	art_speed *= time;
	while (my != null)
	{
		my.skill5 += time;
		if (my.skill5 > 20) 
		{
		mg_speed.z -= fall_speed * time;
		}
		move_mode = ignore_you + ignore_passable; // ignores the barrel -> can't collide with it
		ent_move (art_speed, nullvector);
		my.transparent=1;
		wait(1);
	}
}
function animate_explosion()
{
	wait (1);
	my.passable = on;
	my.ambient = 100;
	while (my.frame < 7)
	{
		my.frame += 1 * time;
		wait (1);
	}
	ent_remove (me);
}
function explode_rocket3()
{
	wait (1);
	exclusive_global;

	// the following piece of code replaces A5's ent_playsound with a linear function
	my.skill10 = vec_dist (player.x, my.x);
	if (my.skill10 < 1000) {my.skill10 = 1000;} // all sounds below 1000 quants will be played with maximal volume
	my.skill10 = 100000 / my.skill10; // bigger distance -> lower volume; 


	vec_set (temp, my.pos);
	temp.z += 50; // create the explosion sprite a little higher
	ent_create(explosion_pcx, temp, animate_explosion); 
	snd_play(stein,100,0);
	ent_remove (me); 
}