Wizard not moving straight

Posted By: Ruben

Wizard not moving straight - 05/24/16 02:59

I have a wizard model. If the player gets close enough to the wizard while climbing toward the top of a large spiral staircase, certain code is to be triggered where the wizard will start running down the big spiral staircase along a set path with path nodes.

I got the same path to work for an ogre toward the bottom of the same spiral staircase. The ogre will chase the player no problem up or down the stairs. However, every time the wizard starts moving toward the 1st node of the path, at the very top of the spiral staircase, instead of running straight toward that 1st node, the wizard will first run back and up in the air, before running (floating) in the air toward the 1st path node, kind of like a check mark shape path in the air toward the 1st path node.

I placed a "dummy block model" next to the 1st path node in the level to see if the wizard would move toward the dummy block without the check mark pattern in the air. I programmed it so that the wizard would move and face directly toward the dummy block, and once the wizard's .y location got above 239, the wizard would then travel on the spiral staircase path. The wizard did move directly toward the dummy block without a check mark pattern, but once the wizard started on the path, the wizard did the funny check mark pattern in the air again before starting down the path.

Does anyone know what may be causing the wizard to move in the check mark pattern in the air, as opposed to just running straight toward the first path node on the floor?

Here is my path_setter() function that seems to be making all this happen:

Code:
action path_setter()
{
   proc_kill2(path_setter,my);
   VECTOR vec_next_node;

   VECTOR temp;

   path_set(my,"path_001");

   while(1)
   {
      // PATH NODE DETECTION AND FACING //////////////
		
      if(vec_dist(my.x,vec_next_node.x) < 80) 
      {    
         if(pathSetNum == 1) // pathSetNum = 1 makes 
                             //    entity move down the 
                             //    spiral staircase.
	 {   
	    my.NODE_NEXT+=1; 	             
	 }
		 
	 if(pathSetNum == 2) // pathSetNum = 2 makes 
                             //    entity move up the 
                             //    spiral staircase.
	 {
	    my.NODE_NEXT-=1; 	          
	 }
	         
	 if(my.NODE_NEXT > 247) // if entity is past 
                                //    last node on bottom 
                                //    of staircase, that 
                                //    node is set as 
                                //    my.NODE_NEXT
	 {
	    my.NODE_NEXT = 247;	
	 }
		    	
	 if(my.NODE_NEXT < 1) // if entity is past first 
                              //    node on top of 
                              //    staircase, that node 
                              //    is set as my.NODE_NEXT
	 {
	    my.NODE_NEXT = 1;	
	 }
      }
		
      path_getnode(my,my.NODE_NEXT,vec_next_node,NULL);  
         
      vec_to_angle( my.pan, vec_diff(NULL, 
         vec_next_node.x, my.x)); // THIS SEEMS TO BE 
                                  //    WHERE THE CHECK 
                                  //    MARK MOVEMENT 
                                  //    PATTERN OCCURS 
                                  //    WITH THE WIZARD?
         // face the new node
         
      wait(1);
   }
}



Anyone have a clue why the wizard is making the check mark pattern when starting on the first path node in "path_001"? Any help would be appreciated. Thank you.
Posted By: Reconnoiter

Re: Wizard not moving straight - 05/24/16 09:44

Perhaps you placed the path nodes to high? Try to place them right above the ground/floor. You could also set the entity's tilt to 0 after doing vec_to_angle.
Posted By: Ruben

Re: Wizard not moving straight - 05/24/16 14:53

The path nodes are in the ground. Seems no matter where I place the wizard, he still does that check mark pattern in the air before moving toward path node 1. The ogre does not seem to do this. Strange.
Posted By: Reconnoiter

Re: Wizard not moving straight - 05/24/16 15:10

Does setting "my.tilt = 0;" after doing the vec_to_angle help?
Posted By: Ruben

Re: Wizard not moving straight - 05/25/16 02:37

It kind of does. The wizard is not moving in a check mark pattern in the air, but the wizard is moving the exact opposite direction from the path node 1.
Posted By: Reconnoiter

Re: Wizard not moving straight - 05/25/16 09:53

I am wondering if your VECTOR vec_next_node has something to do with it. Perhaps you haven't set vec_next_node correctly the first time. Try debugging its xyz values to if they are set wrong throughout the Wizards walking trip.
Posted By: Ruben

Re: Wizard not moving straight - 05/28/16 11:44

Well, I kind of figured out what was making the wizard move in a checkmark formation in the air. In the past, I opened the wizard's MED file, and moved the wizard to a different location in relation to the center point, and saved it. That is when the checkmark formation in the air started occurring. I brought back the original MED file of the wizard into my game, without it being moved the different location in relation to the center point, and now the wizard moves fine without the check mark pattern in the air.
© 2024 lite-C Forums