Complete fix I think, compiled ok though.
Also a few conversion improvements scattered throughout too.
Code:
action gun()
{	gatlin1 = me;
	proc_mode = PROC_LATE;
	set(my,PASSABLE);  // the Gatlin shouldn't slow down the player
	while(player != NULL)
	{	vec_for_vertex(my.skill1, you, 1446);	//
		vec_for_vertex(my.skill4, you, 1447);	//special vertex made for this
		vec_diff(my.skill7, my.skill4, my.skill1);	// compute the midpoint vector that will be used
		vec_to_angle(my.pan, my.skill7);		// align the Gatlin accordingly
		// put the origin of the Gatlin in the vertex that is placed at the bottom of the arm
		vec_set(my.x, my.skill1); 
		wait (1);
	}
} 


function fire_bullets()
{	proc_kill(4); 				// don't allow more than 1 copy of this function to run
	while (mouse_left == 1) 	// this loop runs for as long as the left mouse button is pressed
	{	vec_for_vertex (my.skill7, gatlin1, 75);	// get the coordinates for the bullets' origin
		// create the bullet at camera's position and attach it the "move_bullets" function				
//!!!!! MAKE SURE that skill 7,8,9 contain the correct origin x,y,z
//      and that nothing is "overwriting" these skill values 
		ent_create (bullet_mdl, my.skill7, move_bullets);
		ent_create (muzzle_pcx, my.skill7, display_muzzle);	// create the gun muzzle flash
		snd_play (bullet_wav, 100, 0); 			// play the bullet sound at a volume of 100
		//wait (1*time_step); // fire 7 bullets per second (0.14 * 7 = 1 second)
		wait(-1/7); 	// fire 7 bullets per second [1second(-1) divided by 7]
	}
}

function move_bullets()
{	VECTOR bullet_speed;		// this var will store the speed of the bullet
	// set the bullet to be sensitive to impact, entities and blocks
	my.emask |= ( ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_BLOCK);
	my.event = remove_bullets;	// when it collides with something, event "remove_bullets" will run
	my.pan   = camera.pan;		// the bullet has the same pan
	my.tilt  = camera.tilt;		// and tilt with the camera
	bullet_speed.x = 0.1 * time_step; 	// adjust the FORWARD speed of the bullet here
	bullet_speed.y = 0;	 				// the bullet doesn't move sideways
	bullet_speed.z = 0;					// the bullet ignores gravity
	while(my)	// this loop will run for as long as the bullet exists (ie, isn't "null")
	{	// move the bullet ignoring passable entities and the entity that called "fire_bullets"
		c_move (my, bullet_speed, nullvector, IGNORE_PASSABLE|IGNORE_YOU);
		wait (1);
	}
}

function remove_bullets() // this function runs when the bullet collides with something
{	ent_create (explosion_pcx, my.x, explosion_sprite); // create the explosion sprite
	set(my, PASSABLE); // the bullets becomes passable and invisible now
	set(my, INVISIBLE); // so it can't harm anything anymore
	wait(1);			// wait a frame to be sure (don't trigger engine warnings)
	ent_remove (my);	// and then remove the bullet
}

function display_muzzle()
{	// the muzzle-flash is passable, bright, and oriented
	set(my,PASSABLE|LIGHT|BRIGHT|DECAL);
	// also make the black parts transparent even without using tga files (using a pcx file here)
	my.ambient = 100; // and this line makes it even brighter
	// muzzle-flash will pan and tilt with the weapon and a random roll angle (looks nicer)
	vec_set(my.pan, vector(gatlin1.pan, gatlin1.tilt, random(360)));
	vec_fill(my.scale_x, 0.5);	// we scale it down on all the axis. This would only be needed for a 3D (model-based) muzzle
	gatlin1.ambient = 100; // highlight the weapon (makes it look more realistic)
	wait (2); // show the muzzle sprite for 2 frames
	gatlin1.ambient = 0; // restore the normal weapon ambient value
	ent_remove (my); // and then remove it
}

function explosion_sprite()
{
	set(my, PASSABLE); 			// the explosion sprite is passable
	my.scale_x = 0.15;			// we scale it down to 0.15
	my.scale_y = my.scale_x;	// on both axis
	set(my, LIGHT);				// set its flare				<<<this line was missing its ";"
	set(my,BRIGHT); 			// and bright flags
	my.ambient = 100; 			// and we give it an ambient of 100
	my.roll = random(360); 		// and has a random roll angle
	set(my,TRANSLUCENT); 		// and make it transparent
	my.alpha = 100; 			// but we set it to be completely opaque for now
	while (my.frame < 5) 		// go through all the animation frames
	{	my.frame += 2 * time_step; 		// animation speed
      	wait (1);
	}
	while (my.alpha > 0) 		// now fade the last frame quickly
	{	my.alpha -= 50 * time_step;		// 50 = fading speed
		wait (1);
	}
	ent_remove (my);
}
.



Last edited by EvilSOB; 09/18/09 04:49.

"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial