Yeah I write my own stuff, here is what is am doing:
Code:
var nc_gravity = 1;


/****************************************
*The sword is in
*this will handle all movement and other
*actions with the sword being in
****************************************/
function handle_SwordIn()
{

   VECTOR vFeet;
   vec_for_min(vFeet,me); // vFeet.z = distance from player origin to lowest vertex
	vec_set(tempV,my.x);
	tempV.z -=1000;
	
	
   while(1)
   {  
   
   
     
      //set the move friction to stick to the ground
        move_friction = 0.1;
			//move the entity forward
			var distance = 5 * (key_cuu + key_cud)* time_step;
			distance = sign(distance)* (abs(distance) + 0.5 * dist_down);
		 c_move(me,vector(distance,0,speed_down),vector(0,0,-dist_down),USE_BOX|IGNORE_PASSABLE|IGNORE_ME| GLIDE |USE_POLYGON);
		 	//rotate player with the left and right keys
			my.pan += (key_cul-key_cur)*5*  time_step;
		
     
      
		// adjust entity to the ground height, using a downwards trace
		c_trace(my.x,tempV,IGNORE_PASSABLE|IGNORE_ME|USE_POLYGON |SCAN_TEXTURE|GLIDE );
	  dist_down = my.z + vFeet.z - hit.z; // always place player's feet on the ground
		 
		//this will put the player on the ground and clamp him
     dist_down = clamp(dist_down,-1,100);
		//if the dist is greater than zero
	   if((dist_down > -1))
		{
		  //clamp the player to the ground and accelerate at a down speed
		  dist_down = clamp(dist_down,-1,accelerate(speed_down ,-nc_gravity *  time_step,0));
		 
		}
		else
	   {
	   	//do the speed down to equal 0 so that he snaps to the ground
	   	speed_down = -1;
	   	if((dist_down + speed_down)> -1)
	   	{
	   		speed_down = - dist_down + -1 ;
	      }
	      if(key_space == 1)
	      {
	      	jump_target = jump_height ;//* time_step
	     
	     	   
	      }
       }
       if(jump_target > 0)
       {
       	speed_down = (sqrt((jump_target)* nc_gravity))*time_step;
         	
       	jump_target -= speed_down ;
        }
  
	 
      //default state
		if(my.STATE == 0)
		{
			my.ANIMATION += time_step;
			my.ANIMATION %= 100;
		   ent_animate(me,"idleSWA",my.ANIMATION,ANM_CYCLE);
		  
			
		}
		//the run state without the sword in hand
		if(my.STATE ==1)
		{
			//animate the player
			my.ANIMATION += run_animation_speed  * time_step;
			my.ANIMATION %= 100;
			ent_animate(me,"runWS",my.ANIMATION,ANM_CYCLE);
			
					
		}
		//pressing the move key to make him run with out the sword
		//changing his state
		if((key_cuu) && !key_cud && my.STATE == 0 )
		{
		my.ANIMATION = 0;
		  ent_blend(my.STATE = 1,0,50) ;


		}
		else if((!key_cuu)&& key_cud ==1 && my.STATE == 0)
		{
			my.ANIMATION = 0;
			ent_blend(my.STATE = 1 ,0,50);
		
		}
		
		else if((!key_cuu)&& !key_cud && my.STATE == 1 && my.ANIMATION > 70)
		{
		  my.ANIMATION = 0;
		  ent_blend(my.STATE = 0, 0,100);
		  		
		}	
	/********************************************
	*put the sword away                         *
	********************************************/
		if(my.STATE == 5)
		{
			my.ANIMATION += 5 * time_step;
			ent_animate(me,"putSWA",my.ANIMATION,NULL);
			if(my.ANIMATION > 100)
			{
			 ent_blend(my.STATE = 0,0,50);
			}
			
		}
			if(my.STATE ==7)
		{
			my.ANIMATION += 50 * time_step;
			ent_animate(me,"jump",my.ANIMATION, 0);
			ent_blend("hang",20,5);
		}
		if(my.STATE == 9)
		{
			my.ANIMATION += 15 * time_step;
		   ent_animate(me,"land",my.ANIMATION,0);
		   if(my.ANIMATION > 0)
		   {
		     ent_blend(my.STATE = 0,25,50);
		   }
		}
		if(my.STATE == 11)
		{
			my.ANIMATION += 15 * time_step;
		   ent_animate(me,"land",my.ANIMATION,0);
		   if(my.ANIMATION > 100)
		   {
		     ent_blend(my.STATE = 1,50,70);
		   }
		}
		if(my.STATE == 20)
	   {
		var slide = 5 * (key_r - key_l) * time_step;
     		c_move(me,vector(0,slide,0),nullvector, IGNORE_ME|IGNORE_PASSABLE|GLIDE);
		my.ANIMATION += 10 * time_step; 
		ent_animate(me,"ledgeShimy",my.ANIMATION,ANM_CYCLE);
	   }
	
		//when your idle is sword in hand 
		//and you want to put it away
		if((key_p == 1) && my.STATE == 4)
		{
			my.ANIMATION = 1;
			my.STATE = 5;
			
		}
	//now you have put the sword away
	//go back to original state and start over again
	if((my.STATE == 5) && key_cuu == 1)
	{
			my.ANIMATION = 1;
    		my.STATE = 1;
   }
   if(my.STATE == 0 && key_space == 1 && !reached_height)
   {
   	my.ANIMATION = 0;
		my.STATE = 7;
	   reached_height = 1;
	  
   }
    
   if(my.STATE == 7 && dist_down ==-1)
	{
		 my.ANIMATION = 0;
	    my.STATE = 9;
	    reached_height = 0;	
	}
	else if(my.STATE == 1 && key_space == 1 && key_cuu == 1 && !reached_height)
   {
   	my.ANIMATION = 0;
		my.STATE = 7;
			reached_height = 1;
   }
   
   if(my.STATE == 7 && dist_down ==-1 && key_cuu == 1)
	{
		 my.ANIMATION = 0;
	    my.STATE = 7;
	    reached_height = 0;	
   }
 
wait(1);
}

}


This is code for my player with the sword in the sheath and with gravity set, I read the manuals for lite-c studied doc and everything. I looked at ph_setgravity and my player just stays in one place and according to the manual was told not to put that on a moving character, but just wondering how that works?

Last edited by Tman; 04/16/10 17:52.