Ok...I'm bumping this as I still can't get this to work. I'm really struggling with this and I feel like I'm REALLY close.

Everything is working correctly now except for the fact that, when I press the Space Bar and the code moves to STATE 4, the model goes through the jumping animation first, and THEN the model actually moves up and down. I still can't get them to both happen at the same time.

I understand c_move and what it does, and it's in the code at line 77, however, if I understand this correctly, it's NOT what's actually making the player move up and down...that bit is the "movedir.z = -jumpacc;" part of the code...right?

Keep in mind, this is using the "Improved Player Movement" code from the wiki...all I'm trying to do is add animations for the 3rd party camera.
Html:
http://www.opserver.de/wiki/index.php/Improved_Player_Movement



Why this isn't working...is really boggling me. Any help would be so appreciated!

Here's my entire code:

Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <mtlFX.c>

#define STATE skill1
#define ANIMATION skill2
///////////////////////////////

function main()
{
	//video_screen = 1;
	detail_size = 2;
	level_load("templatetest.WMB");
	wait(2);
}

function camera_follow(ENTITY* ent)
{
	while(1) 
	{
		vec_set(camera.x,vector(-150,10,50));  // camera position relative to the player      
		vec_rotate(camera.x,ent.pan); // rotate the camera position with the player
		vec_add(camera.x,ent.x);      // add player position
		vec_set(camera.pan,vector(ent.pan,-13,0)); // look in player direction, slighty down      
		wait(1);
	}
}

action player_move()
{
	camera_follow(me);
	
	if(key_cuu ==0 | key_cud ==0 | key_cul ==0 | key_cur ==0 | key_ins ==0 | key_ctrl ==0 | key_space ==0)
	{my.STATE = 1;}
	
	//Parameter
	var movespeed = 10;
	var turnspeed = 10;
	var fallacc = 3.68;
	var jumpacc = 20;
	
	//Temporary
	VECTOR movedir;
	vec_set(movedir, vector(0, 0, 0));
	ANGLE rotdir;
	vec_set(rotdir, vector(0, 0, 0));
	var grounddist;
	
	//determine player height
	c_setminmax(my);
	wait(1);
	var feedheight = -my.min_z;
	
	//adjust bounding box
	my.min_x *= 0.4;
	my.min_y *= 0.8;
	my.min_z = 0;
	my.max_x *= 0.4;
	my.max_y *= 0.8;
	my.max_z *= 0.8;
	
	proc_mode = PROC_EARLY;

	while(1)
	{
		//define key inputs
		movedir.x = key_cuu-key_cud; //*(1+key_shift*2); FORWARD-BACKWARD
		movedir.y = key_ctrl-key_ins; // STRAFE LEFT-RIGHT
			                         
		//calculate speed
		movedir.x *= movespeed*time_step;
		movedir.y *= movespeed*time_step;		

		my.pan += (key_cul-key_cur)*5*time_step;  // TURN/ROTATE LEFT-RIGHT
		
		c_move(my,vector(movedir.x, movedir.y, 0), nullvector, GLIDE|IGNORE_PASSABLE);
		if(key_cuu | key_cud)
		{
			my.STATE = 2;
		}
		if(key_ins | key_ctrl)
		{
			my.STATE = 3;
		}
		if(key_cuu & key_ctrl | key_cuu & key_ins)
		{
			my.STATE = 2;
		}
		if(key_cud & key_ctrl | key_cud & key_ins)
		{
			my.STATE = 2;
		}
		
		//check distance to ground
		grounddist = c_trace(my.x, vector(my.x, my.y, my.z-10000), IGNORE_ME|IGNORE_PASSABLE)-feedheight;
		if(grounddist > 0 || movedir.z < 0)
		{
			//gravity acceleration
			movedir.z += fallacc*time_step;
		}else
		{
			movedir.z = 0;
		}
		
		//apply gravity
		my.z -= minv(movedir.z*time_step, grounddist);
		
		if(grounddist-minv(movedir.z*time_step, grounddist) == 0)
		{
			//jump
			if(key_space)
			{
				my.STATE = 4;
			}

		}
	
		if(my.STATE == 1)
		{
			var stand_percentage;
			ent_animate(my,"stand",stand_percentage, ANM_CYCLE);
			stand_percentage += 2 * time_step;

		}
		
		if(my.STATE == 2)
		{
			my.ANIMATION += 1*movedir.x;
			ent_animate(my,"walk",my.ANIMATION,ANM_CYCLE);
			if(!key_cuu | !key_cud | !key_cul | !key_cur | !key_ins | !key_ctrl | !key_space)
			{my.STATE = 1;}
		}
		
		if(my.STATE == 3)
		{
			my.ANIMATION += 1*movedir.y;
			ent_animate(my,"walk",my.ANIMATION,ANM_CYCLE);
			if(!key_cuu | !key_cud | !key_cul | !key_cur | !key_ins | !key_ctrl | !key_space)
			{my.STATE = 1;}
		}
		
		if(my.STATE == 4)
		{
			var jump_percentage = 0;
			while(jump_percentage < 100)
			{
				movedir.z = -jumpacc;
				ent_animate(my,"jump",jump_percentage,0);
				jump_percentage += 10*time_step;
				wait(1);
			}
			if(!key_space)
			{
				my.STATE = 1;
			}
		}
		
	wait(1);	
	}

}




"To one who has faith, no explanation is necessary. To one without faith, no explanation is possible." - St. Thomas Aquinas